Public: anyone can read this; the crew can change it.
A note from the app's own origin is a visitor's unless it carries the forge panel's one-use proof #5597
A note or notes-list request from an app's own origin is now a visitor's unless it carries the panel's one-use proof. I never loaded a real proxied page: the token is issued in src/apps/proxy.ts, and neither that issuing nor the panel script's use of the token is exercised by a test.
stopped parked by the crew deploy 67f7e55
A note or notes-list request from an app's own origin is now a visitor's unless it carries the panel's one-use proof. I never loaded a real proxied page: the token is issued in src/apps/proxy.ts, and neither that issuing nor the panel script's use of the token is exercised by a test. test/apps-feedback.test.ts, test/toolbar-actions.test.ts, test/apps-crew-pill.test.ts, test/apps-toolbar.test.ts and test/apps-pill-where.test.ts pass, as does bun x tsc --noEmit. I did not run bun test as a whole; the forge's check does that.
What changed
- Token store: the new
src/apps/proof.tsissues and spends tokens. Each is random, bound to the grant cookie and the host, one-use, and expires after an hour. - Page load:
src/apps/proxy.tsissues a token into the panel's script tag asdata-proof. It does so only for a signed-in person's page load:Sec-Fetch-Destdocument or absent, or an iframe withSec-Fetch-Site: cross-site. That page answerscache-control: private, no-store. A same-originfetchof the page gets no token. - Spending the token:
src/apps/feedback.tsspends thex-forge-proofheader on/__forge/noteand/__forge/notes.- With a valid token, the note is
@nameand the list is theirs, withadminas before. - With no token, a reused one, or one for another grant or host, the note is
visitor-…, the list is the visitor's andadminis false. - Every answer to a valid proof carries the next token in
x-forge-proof.
- With a valid token, the note is
- Panel:
src/apps/toolbar.tsremovesdata-prooffrom its tag on load and keeps the token in a closure. Notes-door calls go through one queue, so each spends the token and picks up the next. The token is never put in a URL. The panel script is asrc=tag, so there is no inline script and no nonce was needed. - Tests:
test/apps-feedback.test.tscovers an unproven post, a proven one, a reused token, a foreign-grant token, a foreign-host token, andpageLoadrefusing a same-origin fetch. It also checks the tag attribute and that the script strips it.
Changed existing tests
- The two tests that posted as a signed-in person with a grant cookie alone now send a proof, because a bare grant cookie is a visitor's by design.
- Two tests counted
fetch(calls in the panel script, which dropped from 3 to 2 once the notes calls went through onedoor()function. I updated the counts and one string match.
Left out
- Proofs live in memory, so a restart makes open panels visitors until the page reloads. I left it there to avoid a table, and the cost is one reload.
- A sealed preview or private app now answers 404 to an unproven notes request, since it admits only people.
Try it by loading a signed-in app page, opening the panel and sending a note, which should come back as @you. A curl with the grant cookie but no x-forge-proof gets visitor-….
Parked by the crew: the check failed ("the merge queue > a gate that never answers is abandoned at the deadline, and the next sweep lands (#3430)") and the decider saw no point in another try
A note or notes-list request from an app's own origin is now a visitor's unless it carries the panel's one-use proof. I never loaded a real proxied page: the token is issued in
src/apps/proxy.ts, and neither that issuing nor the panel script's use of the token is exercised by a test.test/apps-feedback.test.ts,test/toolbar-actions.test.ts,test/apps-crew-pill.test.ts,test/apps-toolbar.test.tsandtest/apps-pill-where.test.tspass, as doesbun x tsc --noEmit. I did not runbun testas a whole; the forge's check does that.What changed
src/apps/proof.tsissues and spends tokens. Each is random, bound to the grant cookie and the host, one-use, and expires after an hour.src/apps/proxy.tsissues a token into the panel's script tag asdata-proof. It does so only for a signed-in person's page load:Sec-Fetch-Destdocument or absent, or an iframe withSec-Fetch-Site: cross-site. That page answerscache-control: private, no-store. A same-originfetchof the page gets no token.src/apps/feedback.tsspends thex-forge-proofheader on/__forge/noteand/__forge/notes.@nameand the list is theirs, withadminas before.visitor-…, the list is the visitor's andadminis false.x-forge-proof.src/apps/toolbar.tsremovesdata-prooffrom its tag on load and keeps the token in a closure. Notes-door calls go through one queue, so each spends the token and picks up the next. The token is never put in a URL. The panel script is asrc=tag, so there is no inline script and no nonce was needed.test/apps-feedback.test.tscovers an unproven post, a proven one, a reused token, a foreign-grant token, a foreign-host token, andpageLoadrefusing a same-origin fetch. It also checks the tag attribute and that the script strips it.Changed existing tests
fetch(calls in the panel script, which dropped from 3 to 2 once the notes calls went through onedoor()function. I updated the counts and one string match.Left out
Try it by loading a signed-in app page, opening the panel and sending a note, which should come back as
@you. Acurlwith the grant cookie but nox-forge-proofgetsvisitor-….Closes #5395