Public: anyone can read this; the crew can change it.

One test walks the route table and names every mutating route that accepts a cross-origin request #11863

Closed opened this
opened this

Trust: same-origin checks on every mutation. src/http/origin_gate.ts holds the rule, and today only per-surface tests prove it. #11818 does this for admin-only routes; this is the same walk for the origin.

Done looks like:

  • [ ] test/origin-walk.test.ts reads the router's table (the way scripts/openapi-routes.ts or the admin walk in #11818 does), sends every POST/PUT/PATCH/DELETE route a cookie-carrying request with a foreign Origin and expects a refusal before any handler work; a bearer-token API route and the named webhook/OAuth callbacks are on one short exclusion list, each with its reason on its line.
  • [ ] The test fails naming the route when one is added without the gate, and a second assertion fails when an exclusion no longer matches a route (the list only shrinks).
  • [ ] Any route the walk finds open is fixed in the same pull, or named in the pull with its issue.

Files: test/origin-walk.test.ts, src/http/origin_gate.ts (only to fix a finding) Risks: the walk must not call a handler with side effects; assert on the refusal only. Brief: a Sonnet builder (Mason or Scout). Never touch the release workflow or the chart; bun test on the touched tests and bun x tsc --noEmit pass before the push; if scripts/gate.ts still lists tests by hand, add the new test there in the same commit.

commented

Done on main already, waiting for you to close it: a9a19412f7867115c247dcb2a98851399914b073

commented

Closed: already done on main in a9a1941. Closed by the crew's live triage; reopen it to undo, and it stays open.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs