Public: anyone can read this; the crew can change it.
The forge pill shows on an app whose CSP allows only its own scripts: the proxy serves it from the app's host #8215
Parked 34d 11h ago
The pill's script is now served from every app's own host, so an app with script-src 'self' loads it. I haven't looked at lab production, so the "dot bottom-right" check is not done; it needs this deployed first. The affected toolbar tests, tsc --noEmit and the new test pass.
-
Reviews
No review yet.
-
Checks
stopped parked by the crew deploy 80efd68
-
History
- The body-close test looks for the tag at the app's own address (#8209) 80efd68
- Merge remote-tracking branch 'origin/main' into scout/8209-the-forge-pill-shows-on-an-app-whose-csp 8ce7a54
- Re-run the check: shard 8 was killed on a slow machine, user-lists-page passes alone in 1.3 s (#8209) 83457f3
- The forge's app proxy adds under 5 ms to a warm app's answer, measured on loopback and named in the gate (#8193) 36389a2
- Anonymous readers cannot cost the forge either: deep git pages share one budget, and /tree answers from a cache (#8203) d18d601
- Sentinel: shared:01m23vygyffx5hg2f5vm8r74sr:1md4xgwelm is past its budget: trevato/forge: "a preview address only where an environment exists, and only for those who may enter the app" failed on… (#8217) 2b943ca
- A proxied app response names the forge's own time in Server-Timing, beside the app's phases (#8179) c5f927b
- The pill's script is served from every app's own host, so an app whose CSP allows only its own scripts shows it (#8209) 377f9ac
- Sentinel: shared:01m23vygyffx5hg2f5vm8r74sr:1md4xgwelm is past its budget: trevato/forge: "a preview address only where an environment exists, and only for those who may enter the app" failed on… (#8214) 10209f6
- A forge admin sets which Claude subscriptions each crew member of a repository may use, from the terminal, as the repository's Crew settings do (#8202) f3b4d1d
- An org admin makes a team with `n` (name and permission asked) and deletes the selected team with `D` after typing its name, from the terminal's Teams screen (#8194) 233d9c4
- A forge admin sets an organization's default Claude subscription grants from the terminal, as the organization page's Subscriptions form does (#8201) 495fab3
- Sentinel: shared:01m23vygyffx5hg2f5vm8r74sr:1md4xgwelm is past its budget: trevato/forge: "a preview address only where an environment exists, and only for those who may enter the app" failed on… (#8207) 4ec4716
- Sentinel: shared:01m23vygyffx5hg2f5vm8r74sr:1md4xgwelm is past its budget: trevato/forge: "a preview address only where an environment exists, and only for those who may enter the app" failed on… (#8204) 4a054a8
- A second read of an unmoved pull serves its diff from memory: `diff` under 5 ms when neither tip moved (#8171) 5986e05
- An admin sets the crew's autonomy from the terminal: mode off, assisted or autonomous, the dollar ceiling and the slots, as Settings › Autonomy does (#8137) 0b92259
- Proper web architecture: HTML is small, cacheable and streamed; everything else is a long-lived asset (#8104) 585be43
- The sentinel does not refile a test's budget breach in the hour after the pull that fixed it landed, unless it fails again on checks started after the fix (#8190) 0c4d3a4
- Sentinel: shared:01m23vygyffx5hg2f5vm8r74sr:13750cmn0i is past its budget: trevato/forge: "MCP backups > a listing that fails is a short sentence with no key in it" failed on 8 pulls in the last… (#8195) 713b783
- A test that only reads the tree never makes a lane's red: OpenAPI coverage, MCP docs, src imports and the README gates join TREE_GATES (#8189) 2dce28a
3 earlier comments
The pill's script is now served from every app's own host, so an app with script-src 'self' loads it. I haven't looked at lab production, so the "dot bottom-right" check is not done; it needs this deployed first. The affected toolbar tests, tsc --noEmit and the new test pass.
- Proxy (
src/apps/proxy.ts):GETorHEADon/__forge/toolbar-<hash>.jsnow answers the pill's bytes on any app host. It sendstext/javascriptandpublic, max-age=31536000, immutable, plus the security headers. The route comes before the access check, because the bytes are public and named by their hash. - Tag (
src/apps/toolbar.ts):toolbarTagwritessrc="/__forge/toolbar-<hash>.js"and addsdata-forge="<forge origin>", escaped like the other data attributes. - Pill script: every place that read the forge's origin from
me.srcnow readsdata-forge, falling back tome.src. That covers the home link, pull link, "what is this" link, the "Comment, tell, make it yours" link and the crew links, so they still point at the forge. - Tests:
- The new
test/apps-toolbar-same-origin.test.tsproxies an app that answersscript-src 'self'. It checks the tag's src is same-origin, thatdata-forgecarries the forge origin, and that the app host serves the exact bytes with the right headers. - I updated
apps-toolbar,never-lost,toolbar-keyboardandapps-pill-wherefor the new src. Inapps-pill-whereone assertion on the source text was wrong after the rename, so I changed it. - I did not run the new test against the unchanged code.
- The new
Not done or not run:
- I kept the old
/assets/toolbar-….jsroute on the forge, so already-cached pages still work. toolbar-keyboardskipped here because no chromium starts in this sandbox.- The repository has no
scripts/gate.ts, so the gate step did not run. - I did not run the full suite; the forge's check does that on push.
To try it: open a preview or lab's production in a browser. The page source should show <script src="/__forge/toolbar-…" data-forge="https://forge.open-platform.sh" …>, and the dot should appear bottom-right.
The forge's check on this pull failed because shard 8 was killed after 39 s while running test/user-lists-page.test.ts. I think that was machine load, not my change, but I haven't confirmed it.
- The failing test: it has nothing to do with the pill or the toolbar, and I didn't touch it. It passes here in 1.3 s on its own. All 58 shards reported 0 failed tests except the killed one.
- My change: the toolbar, proxy and pill tests pass here (48 pass, 4 skipped, 0 fail), and
tsc --noEmitis clean. - What I did: I changed no code. I pushed an empty commit (
83457f30) so the forge re-runs the check. If shard 8 is killed again, that's a real problem and needs another look.
What the pull does: the pill's script is now served from each app's own host. An app whose Content-Security-Policy allows only its own scripts therefore still shows the forge pill. The change is in src/apps/proxy.ts and src/apps/toolbar.ts, with a new test, test/apps-toolbar-same-origin.test.ts, and updated expectations in four existing toolbar tests.
To try it: open the preview at https://lab--8215--forge-trevato-apps.open-platform.sh, or any app that sends a self-only script CSP. The pill should appear.
What I left out: no change to how the pill looks or behaves, and nothing outside the proxy and toolbar modules.
The pill's script is now served from every app's own host, so an app with
script-src 'self'loads it. I haven't looked at lab production, so the "dot bottom-right" check is not done; it needs this deployed first. The affected toolbar tests,tsc --noEmitand the new test pass.src/apps/proxy.ts):GETorHEADon/__forge/toolbar-<hash>.jsnow answers the pill's bytes on any app host. It sendstext/javascriptandpublic, max-age=31536000, immutable, plus the security headers. The route comes before the access check, because the bytes are public and named by their hash.src/apps/toolbar.ts):toolbarTagwritessrc="/__forge/toolbar-<hash>.js"and addsdata-forge="<forge origin>", escaped like the other data attributes.me.srcnow readsdata-forge, falling back tome.src. That covers the home link, pull link, "what is this" link, the "Comment, tell, make it yours" link and the crew links, so they still point at the forge.test/apps-toolbar-same-origin.test.tsproxies an app that answersscript-src 'self'. It checks the tag's src is same-origin, thatdata-forgecarries the forge origin, and that the app host serves the exact bytes with the right headers.apps-toolbar,never-lost,toolbar-keyboardandapps-pill-wherefor the new src. Inapps-pill-whereone assertion on the source text was wrong after the rename, so I changed it.Not done or not run:
/assets/toolbar-….jsroute on the forge, so already-cached pages still work.toolbar-keyboardskipped here because no chromium starts in this sandbox.scripts/gate.ts, so the gate step did not run.To try it: open a preview or lab's production in a browser. The page source should show
<script src="/__forge/toolbar-…" data-forge="https://forge.open-platform.sh" …>, and the dot should appear bottom-right.Closes #8209