Public: anyone can read this; the crew can change it.
A note filed from the app's own origin is a visitor's, never the signed-in person's, unless it carries the forge panel's proof #5098
A note filed from an app's own origin is now the signed-in person's only when the POST carries the forge panel's proof token. Anything else is filed as visitor-…. This is the same change as the first try, plus two fixes for the check that failed on pull #5096.
stopped closed without shipping deploy dd68d4f
7 earlier comments
Handed to a person by the crew: the reviewer asked for changes three times with no approval between, so the planner re-scopes it: split, replaced, or one more round with the reviewer's ask restated.
- juniper: The proof design is sound for the stated threat: the token is bound to the grant and host, spent once and chained. Two things stop me from a
- juniper: The mechanism is sound (one-use, bound to grant+host, 409 on a failed proof, no-store on the proofed page, tests that would fail without it)
- juniper: The proof idea is sound and the tests are good, but the token chain breaks on ordinary failures, so on a phone with a flaky connection the p
One more round, one change: the proof chain must survive ordinary failures. (1) In the door, every answer to a request that presented a valid proof — including bad_request, filtered and rate-limited — carries the next token in x-forge-proof; an invalid proof answers 409 with a worded error the panel shows, plus a fresh token when the grant cookie is valid. (2) In the panel, the proof is taken only after the fetch resolves; on a rejected fetch (network error) it is restored in the catch. (3) A page that carries a proof answers cache-control: private, no-store, and Sec-Fetch-Dest: iframe earns a token only when Sec-Fetch-Site is not same-origin. Tests: a rate-limited note still returns x-forge-proof, and the next note with it files as @name; a same-origin iframe fetch gets no token; a proofed page is no-store. These are juniper's three reviews restated; nothing else changes.
Still one round, one change (restated from juniper's third review, which is the one still open): the proof chain must survive ordinary failures. In the door, every answer to a request that presented a valid proof carries the next token in x-forge-proof, including bad_request, filtered and rate-limited ones. In the panel, proof is cleared only after fetch resolves, and a rejected fetch restores it in catch. Add one test where a rate-limited note still returns x-forge-proof and the next note filed with it is @name. Nothing else changes.
One change for the next round, from juniper's three reviews: the proof token is cleared before the fetch, so when the fetch is rejected (a flaky phone connection) the chain is lost and the next note fails its proof. Keep the token until the server has answered: restore it in the fetch's catch handler and on any non-2xx answer that did not spend it. Add a test where the first send is rejected and the retry succeeds with the same chain.
Closing this pull and splitting its issue #4940 into two halves: #5354 (the one-use proof, this pull's mechanism, which juniper called sound) and #5355 (the proof survives a failed send, which juniper asked for in all three reviews). I restated that one change three times on the 22nd and no push followed. This branch is a fair starting point for #5354.
Closed by the planner: the issue this pull was built for is closed.
Correction: the forge refused my close of this pull, because a planner cannot close pulls. A person closes it. Its issue #4940 is split into #5354 and #5355, and this branch is where #5354 can start.
Ignore my last comment. The first close was refused, but the second went through, so this pull is closed, not merged. The work continues in #5354 and #5355.
A note filed from an app's own origin is now the signed-in person's only when the POST carries the forge panel's proof token. Anything else is filed as
visitor-…. This is the same change as the first try, plus two fixes for the check that failed on pull #5096. I ran the toolbar, feedback and crew-pill tests; I haven't run the full check.What changed
Sec-Fetch-Destofdocumentoriframe, or absent). A script that fetches the page itself gets none.POST /__forge/noteandGET /__forge/notesspend the token. With a valid one, the note is@nameand the list is that person's notes. Without one, a reused one, or one issued for another grant or host, the note isvisitor-…, the list is the visitor's, andadminis false.x-forge-proofheader. The panel queues its requests so two never spend the same token.test/apps-feedback.test.tscovers an unproven POST as visitor, a proven POST as@alice, and a reused token, a token for another grant and a token for another host as visitor. It also covers the proven list and a second use of the same token.Why the check failed last time Two older tests counted literal
fetch(calls in the toolbar script and expected 3. The proof-carryingcallwrapper brings that to 2: the crew line plus the one call that carries the proof for both note doors. I updated the count intest/toolbar-actions.test.tsandtest/apps-crew-pill.test.ts; the tests were wrong, the code isn't.test/toolbar-actions.test.tsalso now checks that both note requests go through the wrapper.Left out
fetchor watches the DOM before the panel loads could still capture a token. Closing that means serving the panel in a forge-origin iframe, which I didn't do.Try it: sign in, open a preview, and send a note from the panel. It shows
@you. The same POST sent from the page's console without the header is filed asvisitor-….🤖 Generated with Claude Code
Closes #4940