Closes P0 #5 (CORS) from PARTIAL → RESOLVED. fix-auth-bypass
Brief 4 (commit 297afca) cleaned login + register; this brief
sweeps the remaining 24 pages/api/** handlers that carried the
identical scaffolded wildcard-CORS + redundant-OPTIONS pattern,
plus adds a blocking forbidden-cors-headers CI job to lock in
the cleanup against future regression.
Per architect Decision 1 — Option B (sweep all 24 in one PR)
chosen over Option A (narrow verify.js-only + queue separate
sweep). Pattern-drift audit (14 of 24 files spot-checked across
parent + architect) found zero drift; mechanical safety
confirmed.
Per Decision 2 — OPTIONS handler deleted entirely (matches
Brief 4 precedent). Same-origin Vercel deployment doesn't
preflight; method check at top of handler returns 405 if any
client ever sends OPTIONS again.
Per Decision 3 — verify.js's overly-permissive Allow-Methods:
'GET, POST, PUT, DELETE, OPTIONS' is moot (deleted under D2);
the handler's existing `if (req.method !== 'GET') return 405`
guard at line 17 (now line ~5) is the remaining gate.
Per Decision 4 — no new per-route tests this convoy. None of
the 24 routes have vitest coverage today; adding handler-level
tests is the queued fill-vitest-handler-coverage convoy.
Per Decision 5 — new `forbidden-cors-headers` CI job added,
modeled verbatim on `forbidden-endpoints`. Blocking (no
`|| true`, no `continue-on-error`). Greps pages/api/ for any
`Access-Control-Allow-(Origin|Methods|Headers)` reappearance
and exits 1 on hit.
Verification:
- npm run lint: 128 problems (baseline match)
- npm run test:run: 21/21 vitest pass (no regression)
- git grep -nE "Access-Control-Allow-..." -- 'pages/api/**':
zero matches
- git grep -nE "OPTIONS" -- 'pages/api/**': zero matches
(post-sweep)
- new forbidden-cors-headers grep exits 0 against swept tree
No code paths in lib/**, components/**, scripts/**, or test/**
touched. No package.json / lockfile churn. No workflow YAML
beyond the single ci.yml job addition. No AGENTS.md edits
(doc-writer pass at convoy close).
Co-authored-by: Cursor <cursoragent@cursor.com>
Ratifies the parent's recommendation (Option B — expanded sweep)
after a 10-file pattern-drift audit confirmed all 24 targets share
the identical scaffolded 3-line CORS block + OPTIONS-if. Records
5 architect-self-ratifiable decisions (D1 sweep-all, D2 delete-
OPTIONS-entirely, D3 verb-tightening-moot, D4 no-new-tests, D5
add forbidden-cors-headers CI job). Single mechanical brief
(~260 LOC; 240 deletions + ~20-line new CI job) under the
400-LOC per-brief budget. Awaiting human gate 1.
Co-authored-by: Cursor <cursoragent@cursor.com>
Scaffolds the cors-tighten convoy. Originally queued as a
one-file follow-up to fix-auth-bypass Brief 4 (only
pages/api/auth/verify.js), but a fresh repo-wide grep at
convoy creation found 24 files carrying the identical
scaffolded wildcard-CORS + redundant-OPTIONS pattern. The
documented narrow scope (verify.js only) materially
understates the actual exposure.
Two scope options spec'd in the convoy file for architect
ratification at gate 1:
Option A — narrow (verify.js only, ~10 LOC). Matches the
queued-convoy entry literally. Queues a separate
cors-sweep-all-routes for the remaining 23.
Option B — expanded (all 24 files, ~240 LOC). Single
mechanical sweep, same precedent as Brief 4 applied to
login + register, closes P0 #5 fully in one PR.
Parent recommends Option B. Architect verifies scope safety
(spot-check 5+ of 24 for pattern drift), confirms or splits,
adds optional CI regression lock if B wins.
Four decisions queued (scope option, OPTIONS-handler shape,
verify.js method-gate tightening, test coverage). No
operator action required — no env vars, no secrets, no infra.
Co-authored-by: Cursor <cursoragent@cursor.com>