Skip to content

Commit 9feb76a

Browse files
committed
fix(api): add whoami to allowed endpoints whitelist
The /whoami endpoint was missing from the proxy whitelist, causing 403 errors when validating API keys on the Vercel-hosted instance.
1 parent 941ebce commit 9feb76a

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

api/bugzilla.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,20 @@ describe('Bugzilla API Proxy Security', () => {
185185
expect(fetch).toHaveBeenCalled()
186186
})
187187

188+
it('should allow /whoami endpoint', async () => {
189+
const req = createMockRequest({
190+
url: '/api/bugzilla/whoami',
191+
query: { path: ['whoami'] },
192+
headers: { origin: 'http://localhost:5173' },
193+
})
194+
const res = createMockResponse()
195+
196+
await handler(req, res)
197+
198+
expect(res._status).not.toBe(403)
199+
expect(fetch).toHaveBeenCalled()
200+
})
201+
188202
it('should reject unauthorized endpoints', async () => {
189203
const req = createMockRequest({
190204
url: '/api/bugzilla/admin/settings',

api/bugzilla.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const ALLOWED_ORIGINS = [
1212
]
1313

1414
// Allowed endpoint prefixes - whitelist only safe endpoints
15-
const ALLOWED_ENDPOINTS = new Set(['bug', 'user'])
15+
const ALLOWED_ENDPOINTS = new Set(['bug', 'user', 'whoami'])
1616

1717
function isOriginAllowed(origin: string | undefined): boolean {
1818
// Same-origin requests (no origin header) are allowed

0 commit comments

Comments
 (0)