Require auth for github endpoints

This commit is contained in:
Nate Kelley 2025-09-11 09:57:16 -06:00
parent 9c1b86b171
commit 9c1a2f9c37
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
3 changed files with 10 additions and 5 deletions

View File

@ -13,10 +13,12 @@ const app = new Hono<{
Variables: {
busterUser: User;
};
}>();
}>()
// Apply authentication middleware to all routes
.use('*', requireAuth);
// Get organization datasets endpoint
app.get('/', requireAuth, async (c) => {
app.get('/', async (c) => {
const user = c.get('busterUser');
const dataSourceId = c.req.query('dataSourceId');

View File

@ -34,6 +34,7 @@ const app = new Hono()
return c.json(response);
})
// OAuth callback - no auth needed since GitHub redirects here
.get('/auth/callback', zValidator('query', AuthCallbackSchema), async (c) => {
const query = c.req.valid('query');
const result = await authCallbackHandler({

View File

@ -52,7 +52,9 @@ const app = new Hono().get(
const timeoutPromise = new Promise<never>((_, reject) => {
setTimeout(() => {
reject(new Error('Request timeout after 10 seconds. Returning current suggested prompts.'));
reject(
new Error('Request timeout after 10 seconds. Returning current suggested prompts.')
);
}, timeoutMs);
});