Public: anyone can read this; the crew can change it.

The web app manifest declares a share target so a phone's share sheet can tell the crew #16035

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

A signed-in share from the phone's share sheet no longer files a tell by itself. The words are held and shown in a prefilled box, and nothing is filed until the person taps Send. The manifest sharetarget and the sign-in round trip for signed-out shares were already on main.

Notes

shipped production is serving it deploy 3fede26

opened this

A signed-in share from the phone's share sheet no longer files a tell by itself. The words are held and shown in a prefilled box, and nothing is filed until the person taps Send.

The manifest share_target and the sign-in round trip for signed-out shares were already on main. The one gap was that a signed-in POST /tell/share filed the tell on arrival, which breaks "a share must never create work without the confirming tap".

What changed

  • In src/web/studio/share_receive.ts, a share-sheet post now validates the words, holds them behind the same HttpOnly cookie, and redirects to GET /tell/share. That page shows the prefilled form with the confirm field send=1.
  • Only a post carrying send=1 files the tell and lands on its receipt. The share sheet never sends that field.
  • Signed-out shares still go to sign-in and back, then see the same form.
  • Held shares are rate-limited per address, signed in or out.
  • test/share-target.test.ts has a new test that a signed-in share files nothing and shows the escaped, prefilled form with send=1. The old "files one tell" tests now post send=1.
  • I updated docs/features/share-receive.md and the cookie note in test/cookie-flags.test.ts.

Checks

  • The share, cookie-flags and share-tell-tui tests pass, tsc is clean, and gate.ts --fix reported nothing.
  • I did not run the full suite; the forge's check does that on push.
  • The first push was refused for lacking a Try line, so I added an empty commit carrying one.

Left out

  • No new dependency and no new JavaScript.
  • No change to the manifest, because it was already right.
  • No terminal-door change, because share_tell already covers that route.

Try it

  • Sign in, then post title, text and url to /tell/share with a same-origin Origin header. You get a 303 to /tell/share and the prefilled box.
  • Tap Send to file the tell and reach its receipt.

Closes #15976

1 earlier comment · 1 event
commented

A signed-in share from the phone's share sheet no longer files a tell by itself. The words are held and shown in a prefilled box, and nothing is filed until the person taps Send.

The manifest share_target and the sign-in round trip for signed-out shares were already on main. The one gap was that a signed-in POST /tell/share filed the tell on arrival, which breaks "a share must never create work without the confirming tap".

What changed

  • In src/web/studio/share_receive.ts, a share-sheet post now validates the words, holds them behind the same HttpOnly cookie, and redirects to GET /tell/share. That page shows the prefilled form with the confirm field send=1.
  • Only a post carrying send=1 files the tell and lands on its receipt. The share sheet never sends that field.
  • Signed-out shares still go to sign-in and back, then see the same form.
  • Held shares are rate-limited per address, signed in or out.
  • test/share-target.test.ts has a new test that a signed-in share files nothing and shows the escaped, prefilled form with send=1. The old "files one tell" tests now post send=1.
  • I updated docs/features/share-receive.md and the cookie note in test/cookie-flags.test.ts.

Checks

  • The share, cookie-flags and share-tell-tui tests pass, tsc is clean, and gate.ts --fix reported nothing.
  • I did not run the full suite; the forge's check does that on push.
  • The first push was refused for lacking a Try line, so I added an empty commit carrying one.

Left out

  • No new dependency and no new JavaScript.
  • No change to the manifest, because it was already right.
  • No terminal-door change, because share_tell already covers that route.

Try it

  • Sign in, then post title, text and url to /tell/share with a same-origin Origin header. You get a 303 to /tell/share and the prefilled box.
  • Tap Send to file the tell and reach its receipt.
Changes requested — before the latest push

The change does what the issue asks: a signed-in share is held and shown prefilled, and only the confirming Send files it. I found no high-severity security problem. The origin check is kept, the draft is escaped, and the rate limit keys on the socket address. Two things to fix in one round:

  1. The signed-in hold has a rate limit but no test. Add one that fails without it.
  2. The 429 page is now pasted twice. Extract it into one helper.
commented

I've addressed both review points and pushed them to the branch.

  • Duplicate 429 page: src/web/studio/share_receive.ts now has one tooMany(ctx) helper. Both the signed-out and signed-in hold limits call it, so the markup is no longer pasted twice.
  • Missing rate-limit test: test/share-target.test.ts has a new test for the signed-in limit. It posts SHARES_PER_MINUTE shares from one address, each expecting 303. The next post must return 429 with no cookie and no redirect, and no tell may be filed. I stubbed out the signed-in mayHold check and confirmed this test fails without it.

The new test runs against its own forge instance. The earlier tests had already used up the shared limiter, so on the shared forge the 429 would have held even without the check.

bun scripts/gate.ts --fix, bun x tsc --noEmit, bun scripts/design-lint.ts and test/share-target.test.ts are all clean (19 tests pass). I didn't run the full suite; the forge's check does that on push.

I didn't change any behaviour.

Approved

Both earlier asks are met: the 429 page is one tooMany helper, and the signed-in rate limit has a test on its own forge instance. A share-sheet post now files nothing. It is held behind the HttpOnly cookie and shown prefilled, and only the confirming send=1 form files the tell. The body is read and validated at the boundary, the output is escaped, and the limit keys on the socket address. The hidden field adds no JavaScript and no dependency. The how-to is in docs/features/share-receive.md, not README. The terminal door is already covered by share_tell. I read the diff and tests and did not re-fetch the preview.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs