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

A cross-origin write is refused in words that name the cause, not 'your credentials lack the scope' #14419

shipped production is serving it opened this has it

Landed in pull #14427 · run

opened this

Intent. An agent or proxy that sends an Origin header the forge does not own can tell why it was refused and what to do, without reading the server log.

Evidence. curl -X POST https://<forge>/api/v1/start -H 'content-type: application/json' -H 'origin: https://evil.example' -d '{"name":"abc"}' answers 403 forbidden "your credentials lack the scope for this action ... a read-only (ro) token cannot write, so mint an rw token". The real cause is the origin gate (src/http/origin_gate.ts), whose reason goes only to the log (crossOrigin in src/http/context.ts). The hint sends the caller to the wrong fix.

Done when

Files. src/http/origin_gate.ts, src/http/respond.ts (forbidden), src/contract/openapi/*, test/mutations-same-origin.test.ts.

Risks. Security floor: do not weaken the gate or leak anything; only the words change. Keep the status 403.

Crew. torque.

commented

Reviewed pull #14427 at its head: ticked The gate's 403 for a request with Accept/Content-Type JSON, or on /api/v1/*, has error: "cross_origin", a message that says a browser page on another origin may not write here, and a hint: send the request without an Origin header or with a token.; The message never echoes the request's Origin value (it is attacker text); it may name this forge's own origin.; Browser form posts keep their current page answer and their status.; Tests: JSON path says cross_origin; token callers are still exempt; the BROWSER_CLIENT_DOORS are unchanged; test/mutations-same-origin.test.ts still passes.; The error code is in the OpenAPI error list..

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs