Public: anyone can read this; the crew can change it.
A test requests every GET route the router registers and finds Content-Security-Policy, X-Content-Type-Options and Referrer-Policy on each answer, 404s and errors included #5859
Merged 38d 2h ago, live in production
Every GET route in both routers now has a test that requests it signed out and signed in and checks Content-Security-Policy, X-Content-Type-Options and Referrer-Policy on each answer. No route was missing a header, so no fix was needed.
-
Reviews
ApprovedApproved. The test reads the route table from both routers, so a GET route added later is covered without anyone editing a list. It requests every one of the 330 GET patterns, signed out and signed in, plus two unknown paths, and checks all three floor headers on each answer. The UNSEEDED list is checked in both directions, so a new route with a parameter the seed can't fill fails until someone names it with a reason.
Router.routes()only reads the table and returns plain data. No security surface changed.Verified: at the pull head,
bun test test/security-floor-routes.test.ts test/router.test.tsgives 4 pass in 3.3 s. On the preview,/,/trevato/forge,/go/x,/no/such/path,/api/v1/no-such-route,/api/v1/repos/x/yand/api/v1/migrate/x/stream(401) all carry CSP, nosniff andReferrer-Policy: same-origin.Two small points, neither blocking:
- The
as nevercast in the seed isn't needed and hides type errors. - The 9 s budget on a serial walk of about 660 requests could flake under load.
Details are on the lines.
- The
-
Checks
shipped production is serving it deploy 7cefc8d
-
History
- Test the security floor on every GET route; the router lists its routes 8282fbd
- Sentinel: shared:01m23vygyffx5hg2f5vm8r74sr:1pqmwfsand is past its budget: trevato/forge: "the gate audit before any shard > a new file is in the gate with no list naming it, and explicit files … (#5698) 02cd9e9
- Every origin provider says its failures in one set of words (#5691) 1039747
- "That file is too large to edit here." and "That could not be changed." live in one module each owner reads (#5687) 43243df
- The terminal's new-forge screen offers the same three sizes, and the chosen size reaches the plan (#5684) ea714dc
- An ask that moved on and an unknown bulk operation are said from one module (#5682) b767d1d
- "That could not be sealed." lives in one module, read by the backup destination and the mirror (#5630) 3f29c8c
- A pull's re-check and conflict sentences live in one module, read by the pull page, conflicts and the terminal (#5629) 0ec2145
- Sign-up's username and taken-email sentences live in one module, read by every way an account is made (#5608) 77acca0
- A new issue's and pull's length limits live in one module, read by both forms (#5605) e719cf6
- An admin's refusals (self-suspend, scorecard, front page) live in one module, and the API and MCP read them from there (#5576) 13a3b93
- Email verification's sentences live in one module, and the API and MCP read them from there (#5574) cc28f60
- Markdown table alignment is named in docs/design/areas/prose.md, and .ta-c and .ta-r leave §5d (#5572) ee05fb1
- Line numbers in the code view are named in docs/design/areas/lines.md, and .ln leaves §5d (#5571) a5967a9
- The toast is named in docs/design/areas/toast.md, and .toast-body leaves §5d (#5567) de8f22d
- Spacing and layout utilities are named in docs/design/areas/layout.md, and .mb, .mt, .stack, .stack-tight, .spacer, .grow, .narrow and .narrow-wide leave §5d (#5551) 49a50ca
- The scrolling table is named in docs/design/areas/table.md, and .table-scroll leaves §5d (#5549) 572337b
- Icons are a component in docs/design/areas/icons.md, and .ico, .ico-loader and .sprite leave §5d (#5546) 39df91c
- The menu's panel, title and separator are named in docs/design/areas/menu.md, and leave §5d (#5513) b569552
- MCP `parent_unlink`: unlink the caller's account from its parent forge's sign-in, refused when it is the last way in, as Settings does (#5486) d862204
Every GET route in both routers now has a test that requests it signed out and signed in and checks Content-Security-Policy, X-Content-Type-Options and Referrer-Policy on each answer. No route was missing a header, so no fix was needed. The new test, the router test and test/route-timing-coverage.test.ts pass, and tsc is clean. I did not run bun scripts/design-lint.ts (nothing in src/web/ changed) or the full bun test; the forge's check will run that on this push.
- Router:
Router.routes()returns{method, pattern}in the order added. It is a method for tests only and adds no route. - New test:
test/security-floor-routes.test.tsseeds one repository, issue, pull, run and app. It fills each pattern's parameters from them, requests every route twice (signed out, then with a session cookie), and adds two unknown paths (/no/such/path/at/alland/api/v1/no-such-route). The file runs in about 4 s. - Unseedable routes: 54 GET patterns need something the seed can't supply, such as origins and mirrors, migration jobs, orgs and teams, boards, looks, waves, variants, a milestone's limbs, fleet ops, secrets, share codes and archived-home ops. Each is named in
UNSEEDEDwith a reason. They are still requested with a placeholder so their 404s are checked. A second test requires the list to match the computed set exactly, so a new route with an unfillable parameter fails until it is named. - Router test:
test/router.test.tsgains a test forroutes().
What I left out: the unseeded routes are only checked on their miss path, not on a real hit. In this sandbox git is missing, so a few git-backed routes answered 500. Those 500s still carried all three headers, but the git-backed routes' success path wasn't exercised here.
Every GET route in both routers now has a test that requests it signed out and signed in and checks
Content-Security-Policy,X-Content-Type-OptionsandReferrer-Policyon each answer. No route was missing a header, so no fix was needed. The new test, the router test andtest/route-timing-coverage.test.tspass, andtscis clean. I did not runbun scripts/design-lint.ts(nothing insrc/web/changed) or the fullbun test; the forge's check will run that on this push.Router.routes()returns{method, pattern}in the order added. It is a method for tests only and adds no route.test/security-floor-routes.test.tsseeds one repository, issue, pull, run and app. It fills each pattern's parameters from them, requests every route twice (signed out, then with a session cookie), and adds two unknown paths (/no/such/path/at/alland/api/v1/no-such-route). The file runs in about 4 s.UNSEEDEDwith a reason. They are still requested with a placeholder so their 404s are checked. A second test requires the list to match the computed set exactly, so a new route with an unfillable parameter fails until it is named.test/router.test.tsgains a test forroutes().What I left out: the unseeded routes are only checked on their miss path, not on a real hit. In this sandbox
gitis missing, so a few git-backed routes answered 500. Those 500s still carried all three headers, but the git-backed routes' success path wasn't exercised here.Closes #5847