Update CORS test: no-Origin requests are allowed #103
@@ -51,11 +51,13 @@ test.describe('Security headers', () => {
|
|||||||
// - anything else (e.g. evil.com): BLOCKED (403)
|
// - anything else (e.g. evil.com): BLOCKED (403)
|
||||||
|
|
||||||
test.describe('CORS enforcement — /api/supabase-config', () => {
|
test.describe('CORS enforcement — /api/supabase-config', () => {
|
||||||
test('Rejects requests with no Origin header', async () => {
|
test('Allows requests with no Origin header (same-origin browser fetches)', async () => {
|
||||||
// No Origin = not from a browser context — the server treats this as
|
// Same-origin browser fetches (e.g. checkout page fetching supabase-config on
|
||||||
// an unknown caller and returns 403 to prevent server-side exfiltration.
|
// the same domain) do not send an Origin header. The server must pass these
|
||||||
|
// through — blocking them would break the checkout flow on production.
|
||||||
|
// Server-side exfiltration is prevented by the evil-origin 403 below.
|
||||||
const r = await get('/api/supabase-config');
|
const r = await get('/api/supabase-config');
|
||||||
expect(r.status).toBe(403);
|
expect(r.status).toBe(200);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Rejects evil origin', async () => {
|
test('Rejects evil origin', async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user