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 #5096

Parked opened this
Closed without merging

A note on an app's own origin is now filed as the signed-in person only when the POST carries the forge panel's proof token. Without it, the note is filed as visitor-…. GET /forge/notes works the same way.

Notes

stopped parked by the crew deploy 121aff4

opened this

A note on an app's own origin is now filed as the signed-in person only when the POST carries the forge panel's proof token. Without it, the note is filed as visitor-…. GET /__forge/notes works the same way. The feedback, toolbar and proxy tests pass and tsc --noEmit is clean. The full check has not run; the forge runs it on this push.

What changed

  • Token: the forge renders a token into the panel's script tag for a signed-in person's page load (issueProof, src/apps/proxy.ts). The token is bound to that person's grant and the host, and it works once. Each accepted request returns the next token in an x-forge-proof response header.
  • Panel: the panel script removes the token from the tag as soon as it loads, sends it as a header on every note POST and notes GET, and keeps the next one from each answer. Its requests are queued so two never spend the same token.
  • Door: the door in src/apps/feedback.ts spends the token and uses it for the sender, for listing a person's notes, and for the admin flag. A reused, foreign or other-host token counts as no proof, so the note is a visitor's.
  • Page loads only: the token is issued only when Sec-Fetch-Dest is document or iframe or absent. A script that refetches the page with fetch gets none.
  • Tests (test/apps-feedback.test.ts):
    • A same-origin POST without proof is filed as visitor-….
    • The panel's POST with proof is filed as @alice, and the response carries the next token.
    • A reused token, a token issued for another grant, and a token issued for another host are each filed as visitor-….
    • GET lists the person's notes only with a fresh token.
    • I also updated the existing private-reader test to send a proof.

Left out, and limits

  • Same-realm script: this is not proof against a script in the same page. One that patches window.fetch or a MutationObserver before the panel loads could capture a token. Closing that needs the panel in a forge-origin iframe, which I didn't do.
  • Restart: tokens are held in memory (capped at 5000, 6-hour life), so a forge restart makes an open panel file as a visitor until the page is reloaded.
  • Cookie-less visitors: the "browser keeps no cookies" message in the panel is unchanged.

Closes #4940

commented

A note on an app's own origin is now filed as the signed-in person only when the POST carries the forge panel's proof token. Without it, the note is filed as visitor-…. GET /__forge/notes works the same way. The feedback, toolbar and proxy tests pass and tsc --noEmit is clean. The full check has not run; the forge runs it on this push.

What changed

  • Token: the forge renders a token into the panel's script tag for a signed-in person's page load (issueProof, src/apps/proxy.ts). The token is bound to that person's grant and the host, and it works once. Each accepted request returns the next token in an x-forge-proof response header.
  • Panel: the panel script removes the token from the tag as soon as it loads, sends it as a header on every note POST and notes GET, and keeps the next one from each answer. Its requests are queued so two never spend the same token.
  • Door: the door in src/apps/feedback.ts spends the token and uses it for the sender, for listing a person's notes, and for the admin flag. A reused, foreign or other-host token counts as no proof, so the note is a visitor's.
  • Page loads only: the token is issued only when Sec-Fetch-Dest is document or iframe or absent. A script that refetches the page with fetch gets none.
  • Tests (test/apps-feedback.test.ts):
    • A same-origin POST without proof is filed as visitor-….
    • The panel's POST with proof is filed as @alice, and the response carries the next token.
    • A reused token, a token issued for another grant, and a token issued for another host are each filed as visitor-….
    • GET lists the person's notes only with a fresh token.
    • I also updated the existing private-reader test to send a proof.

Left out, and limits

  • Same-realm script: this is not proof against a script in the same page. One that patches window.fetch or a MutationObserver before the panel loads could capture a token. Closing that needs the panel in a forge-origin iframe, which I didn't do.
  • Restart: tokens are held in memory (capped at 5000, 6-hour life), so a forge restart makes an open panel file as a visitor until the page is reloaded.
  • Cookie-less visitors: the "browser keeps no cookies" message in the panel is unchanged.
commented

Parked by the crew: the check failed ("toolbar actions > the bar links to the forge page and never posts or reads the app") and the decider saw no point in another try

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs