Public: anyone can read this; the crew can change it.
Every route that changes state refuses a cross-origin request, proven by one table-driven test over the route table #13500
Merged 18d 17h ago, live in production
A forged browser POST, PUT, PATCH or DELETE that arrives with no Origin header is now refused when the browser's own Sec-Fetch-Site says another site sent it. Before this change, a signed-in cookie request with no Origin passed every mutating route. Most of #13480 was already on main from #10931.
-
Reviews
ApprovedClean, small, security-positive. crossOrigin now also refuses a missing Origin when the browser's own Sec-Fetch-Site says cross-site or same-site; same-origin, none and absent (curl, tools) still pass. The route-table walk runs over both forged shapes and checks the refusal came from the origin check, and unit cases cover the four header values. No dependency, no README change, no new surface needing a TUI screen. Remaining Referer fallback is reasonably declined.
-
Checks
shipped production is serving it deploy 68f0754
-
History
- Try: curl -X POST -H 'sec-fetch-site: cross-site' -b forge_session=… <forge>/api/v1/user/email/verify answers 403 forbidden b29f4dc
- A forged browser mutation with no Origin but Sec-Fetch-Site: cross-site is refused, walked over every route (#13480) ba8e4d2
- A repository's wallet can hold a monthly cap, and spend past it pauses its crew with one line (#13343) ce719ab
- Saving a template validates its forge.json and names the first thing wrong (#13335) e9f793c
- A maintenance duty watches free space on the data volume and files one issue under 15% free (#13337) 8f16384
- A forge made from a template says so on its home in one line: Started from <template> (#13345) 80c52af
- The wallet page lists the last 20 spends, each as one row with the run it paid for (#13324) 2dfdbeb
- "before/after looks" is now the gate rule that fails most checks: a missing commit-message line should not cost a check and a builder run (#13364) 25eb4dc
- Automate a review finding as a lint or test: Both doors: Compute on Settings has no terminal screen in src/tui/ and no docs/f (#13378) 44b6735
- Every empty list says what it is waiting for in one sentence, from one table (#13312) 5d854a6
- A run's log never holds a secret: tokens and keys are masked before the log is stored (#13314) c14f943
- A talk reply that proposes an action shows it as a previewed card with Do it and Not now (#13346) cee6610
- A tell from the terminal's home screen carries the screen's context and prints its receipt (#13184) 71ce7cd
- A bet refuses to start when the repository's wallet cannot cover its estimate, in one plain sentence (#13354) 3ae56cb
- The owner can see one repository's spend per day for the last 14 days as a table (#13355) b8946df
- The drop: a private place per app and per forge to dump reference material the migration crew can read (#13245) 2e31bd3
- /status answers under 6 KB and under 50 ms from a cache of at most 10 s (#13352) f021bd2
- A check run as a cluster job holds the same egress wall as one on the box (#13272) fc1f404
- A sync at one door reaches an open fork card without a reload (#13278) e8209b2
- A file nothing can render shows its size, detected type and a download, never raw bytes (#13340) 8594e14
A forged browser POST, PUT, PATCH or DELETE that arrives with no Origin header is now refused when the browser's own Sec-Fetch-Site says another site sent it. Before this change, a signed-in cookie request with no Origin passed every mutating route.
Most of #13480 was already on main from #10931. test/origin-every-mutation.test.ts already walks every mutating route in both routers with a foreign Origin. It requires a 403 and no new events, and checks the refusal came from the origin check. Its EXEMPT list (the bearer-only /mcp and /oauth/userinfo) and UNCALLABLE list are checked against the routers. A new mutating route that isn't listed is walked automatically and fails if it has no check. The missing part was "with none from a browser context".
crossOrigin(src/http/context.ts): a request with noOriginandSec-Fetch-Siteofcross-siteorsame-siteis now treated as cross-origin, and the log line recordsorigin: "-". A page can't set that header.same-siteis included because apps are served on sibling subdomains of the forge. NoOriginwithsame-origin,noneor noSec-Fetch-Siteat all (curl, tools) still passes. A cookie can't be used from a non-browser client unless someone already has it.test/origin-every-mutation.test.ts: the route walk now runs over two forged shapes: a foreignOrigin, and noOriginwithSec-Fetch-Site: cross-site. With the fix reverted, the second shape fails on real routes (for examplePOST /api/v1/user/passwordanswers 401 with no origin check).test/consent-origin.test.ts: unit cases for the fourSec-Fetch-Sitevalues with noOrigin.
Not done: a Referer fallback for browsers that send neither Origin nor Sec-Fetch-Site. Every current browser sends Origin on cross-site mutations, so it adds rules without closing a real gap. src/http/respond.ts didn't need changes because the gate already calls crossOrigin.
Tests: scripts/fast.ts named 2216 files as too broad, so I picked the 238 test files that mention crossOrigin, sec-fetch-site or evil.example. All pass. bun x tsc --noEmit is clean, and scripts/gate.ts --fix rewrapped comments in three files, which are included. The extra empty commit is the "Try:" line the pre-push hook asks for.
To try it: signed in, POST /api/v1/user/email/verify with header sec-fetch-site: cross-site and no Origin answers 403 forbidden. With sec-fetch-site: same-origin it is not refused.
🤖 Generated with Claude Code
A forged browser POST, PUT, PATCH or DELETE that arrives with no
Originheader is now refused when the browser's ownSec-Fetch-Sitesays another site sent it. Before this change, a signed-in cookie request with noOriginpassed every mutating route.Most of #13480 was already on main from #10931.
test/origin-every-mutation.test.tsalready walks every mutating route in both routers with a foreignOrigin. It requires a 403 and no new events, and checks the refusal came from the origin check. ItsEXEMPTlist (the bearer-only/mcpand/oauth/userinfo) andUNCALLABLElist are checked against the routers. A new mutating route that isn't listed is walked automatically and fails if it has no check. The missing part was "with none from a browser context".crossOrigin(src/http/context.ts): a request with noOriginandSec-Fetch-Siteofcross-siteorsame-siteis now treated as cross-origin, and the log line recordsorigin: "-". A page can't set that header.same-siteis included because apps are served on sibling subdomains of the forge. NoOriginwithsame-origin,noneor noSec-Fetch-Siteat all (curl, tools) still passes. A cookie can't be used from a non-browser client unless someone already has it.test/origin-every-mutation.test.ts: the route walk now runs over two forged shapes: a foreignOrigin, and noOriginwithSec-Fetch-Site: cross-site. With the fix reverted, the second shape fails on real routes (for examplePOST /api/v1/user/passwordanswers 401 with no origin check).test/consent-origin.test.ts: unit cases for the fourSec-Fetch-Sitevalues with noOrigin.Not done: a
Refererfallback for browsers that send neitherOriginnorSec-Fetch-Site. Every current browser sendsOriginon cross-site mutations, so it adds rules without closing a real gap.src/http/respond.tsdidn't need changes because the gate already callscrossOrigin.Tests:
scripts/fast.tsnamed 2216 files as too broad, so I picked the 238 test files that mentioncrossOrigin,sec-fetch-siteorevil.example. All pass.bun x tsc --noEmitis clean, andscripts/gate.ts --fixrewrapped comments in three files, which are included. The extra empty commit is the "Try:" line the pre-push hook asks for.To try it: signed in,
POST /api/v1/user/email/verifywith headersec-fetch-site: cross-siteand noOriginanswers 403forbidden. Withsec-fetch-site: same-originit is not refused.🤖 Generated with Claude Code
Closes #13480