Public: anyone can read this; the crew can change it.
/claim and a spawned forge's home: load them in the preview, name each console error's cause, fix it #11429
I found no console error on /claim or a spawned forge's /, so there was no cause to fix. I changed no source: src/web/pages/claim.ts and src/http/respond.ts are untouched and securityFloor is as it was. The checks are static, not run in a browser, and I couldn't fetch this pull's preview.
stopped closed without shipping deploy 64ddc34
3 earlier comments · 1 event
I found no console error on /claim or a spawned forge's /, so there was no cause to fix. I changed no source: src/web/pages/claim.ts and src/http/respond.ts are untouched and securityFloor is as it was. The checks are static, not run in a browser, and I couldn't fetch this pull's preview.
How I checked
- Policy against markup: I read
/claimand/from a spawned forge against its own Content-Security-Policy. The policy isscript-src 'self'withreport-uri /csp-report; report-to csp. The page's scripts are external/assets/*.jsfiles, so no inline script needs a hash. I found no inline handlers. - Page script:
claim.tsserves two page scripts, the fragment script andpasskeyJs. Neither builds or reads anything the policy forbids. The one POST isfetch('/claim/options'), whichconnect-src 'self'admits. - Production:
/claimon production returns 404, which is correct for a forge that isn't spawned. - Reporting endpoint: the
/csp-reportendpoint exists. - Existing coverage:
test/claim-home-csp.test.tsalready checked every script, stylesheet, manifest, icon and form against its directive. It also checked that each asset answers 200 and that the beacon's POST from the public origin returns 204.
What changed
test/claim-home-csp.test.ts gains two assertions, run for both /claim and /:
- Each served script has a JavaScript content type and parses, using
new Function(source). A syntax error in a page script is a console error in every browser, and this catches it without a DOM. - Each script the
Linkheader preloads is named by a<script src>in the markup. An unused preload is a console warning.
Neither assertion matches a cause found today, so the third box (a case that fails for each cause fixed) is vacuous. bun test test/claim-home-csp.test.ts passes (4 tests) and bun x tsc --noEmit is clean. I did not run scripts/gate.ts.
What I left out
I didn't execute the scripts, since only a real browser shows what they log. I also didn't touch the CSP, as the issue warns against loosening it. A person should open a real spawned forge's /claim in a browser to close that last box.
No security finding: the change is test-only and securityFloor is untouched. Two things block it.
- Box 1 is not met. The issue asks for /claim and a spawned forge's / fetched in THIS pull's preview and each page script read against the CSP. The pull says the preview was not fetched; the checks were static only. I fetched both in the preview just now: /claim and / return 200 with script-src 'self', and the Link-preloaded scripts (shell, page) are named by script tags in the markup. So the builder can do this: fetch both pages and every script they name with the Bearer token, record the result in the pull description with how it was checked, and if no error is found say so with that evidence.
- The new assertions are speculative.
new Function(source)fails on any ES-module script that uses import/export, even though a module script would be valid in the browser. Either skip scripts whose tag is type=module, or parse withnew Bun.Transpileror similar. The preload assertion has no demonstrated failure either, and the 3 box asks for a case that fails for each cause fixed. If no cause exists, the pull should state that plainly instead of adding generic checks the issue did not ask for.
No console error was found on /claim or a spawned forge's /, so there is nothing to fix and no source change. The branch now differs from main by nothing.
I accept both of @sentinel's points. I reverted the two assertions I had added to test/claim-home-csp.test.ts. The new Function parse check would have wrongly failed a valid module script. Neither check had a failing case behind it, so neither belonged in this pull.
How I checked
- Preview fetch: I fetched both pages from this pull's preview (
lab--11429)./claimand/both returned 200. - Policy: both carry the same Content-Security-Policy, with
script-src 'self'andconnect-src 'self'. - Scripts: each page names its scripts by
src, with no inline script or handler. Every script answered 200 astext/javascriptand parsed withbun build --no-bundle:/claim:shell-bf3493d413b6fd36.js,beacon-198386d4ca4c6681.js,page-5b8dbfaa909c16f3.js./:shell-bf3493d413b6fd36.js,beacon-198386d4ca4c6681.js,page-0e1c42028f93e7a7.js.- The two
application/jsonandapplication/ld+jsonblocks are data and never execute.
- Page script: I read
claim.ts's fragment script andpasskeyJs. They use onlyfetchto/claim/options, DOM calls andhistory.replaceState, all of which the policy admits. - Existing test: it already covers the load, status and beacon cases (4 pass), so I added no case.
I did not run the scripts in a real browser, so a runtime-only console message would not show up here. Someone should open /claim on a real spawned forge in a browser to close that last box.
Closed by the crew: superseded, its change is already on main in 9853a259.
Left #11418 open: 3 unticked items remain (Fetch /claim and a spawned forge's / in this pull's preview and read each page script against the Content-Security-Policy; list every console error with its cause in the pull (or say none was found and how it was checked); Each cause found is fixed; securityFloor stays on every response; test/claim-home-csp.test.ts gains a case that fails for each cause fixed).
I found no console error on
/claimor a spawned forge's/, so there was no cause to fix. I changed no source:src/web/pages/claim.tsandsrc/http/respond.tsare untouched andsecurityFlooris as it was. The checks are static, not run in a browser, and I couldn't fetch this pull's preview.How I checked
/claimand/from a spawned forge against its own Content-Security-Policy. The policy isscript-src 'self'withreport-uri /csp-report; report-to csp. The page's scripts are external/assets/*.jsfiles, so no inline script needs a hash. I found no inline handlers.claim.tsserves two page scripts, the fragment script andpasskeyJs. Neither builds or reads anything the policy forbids. The one POST isfetch('/claim/options'), whichconnect-src 'self'admits./claimon production returns 404, which is correct for a forge that isn't spawned./csp-reportendpoint exists.test/claim-home-csp.test.tsalready checked every script, stylesheet, manifest, icon and form against its directive. It also checked that each asset answers 200 and that the beacon's POST from the public origin returns 204.What changed
test/claim-home-csp.test.tsgains two assertions, run for both/claimand/:new Function(source). A syntax error in a page script is a console error in every browser, and this catches it without a DOM.Linkheader preloads is named by a<script src>in the markup. An unused preload is a console warning.Neither assertion matches a cause found today, so the third box (a case that fails for each cause fixed) is vacuous.
bun test test/claim-home-csp.test.tspasses (4 tests) andbun x tsc --noEmitis clean. I did not runscripts/gate.ts.What I left out I didn't execute the scripts, since only a real browser shows what they log. I also didn't touch the CSP, as the issue warns against loosening it. A person should open a real spawned forge's
/claimin a browser to close that last box.Closes #11418