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

A tab-forge read-only link can be revoked by the person who made it #18402

opened this

Merged 2h 33m ago, live in production

The person who made a read-only tab-forge link can now take it back with a revoke key, shown once. The new tests, tsc, gate.ts and design-lint pass, but I have not run the app or tried it on a preview. One test in the set I ran failed: the looks-lane Chromium test (#12496).

Notes

opened this

The person who made a read-only tab-forge link can now take it back with a revoke key, shown once. The new tests, tsc, gate.ts and design-lint pass, but I have not run the app or tried it on a preview. One test in the set I ran failed: the looks-lane Chromium test (#12496). It's unrelated to this change and I did not investigate it.

What changed

  • Key at link time: making a link also makes a revoke key. The page that answers shows it once, never in the link. Only its SHA-256 is stored, in a new nullable tab_shared.key_hash column.
  • Keeping the key: the answer page has Keep the key in my tab. It posts the link and key to the tab's own page for that app (/tab/f/apps/<n>/links), which stores them in a kept_link table in the tab.
  • Listing and stopping: the app's page in /tab lists "Links you made", each with Stop sharing. That posts to POST /tabforge-link/<id>/revoke with the key.
  • Right key: it deletes the row, and the link then answers the forge's one 404.
  • Wrong or missing key: the link stays, the page says "Nothing changed" with a 403, and the key is compared in constant time as a hash. An id that doesn't exist gets the 404.
  • Same-origin and rate limit: the revoke POST is same-origin checked and uses the existing share rate limit.
  • Old rows: a row made before this has no hash. It stays openable and cannot be revoked.
  • Tests: test/tab-share-revoke.test.ts covers the right key, a wrong or no key, a cross-origin POST, an unknown id, an old row with no hash, and the tab keeping and listing the key.
  • Docs and terminal: docs/features/tabforge.md is updated. The terminal's twin is the new TAB_REVOKE sentence in tabLine(). The commit says No door for the rest, because a terminal holds none of a tab's keys.

What I chose not to do

  • The key is not saved automatically. The person presses Keep the key in my tab, or copies it from the page. That keeps it working with script off, and the page says so.
  • A revoked link stays in the tab's list; nothing removes it. Pressing Stop sharing on it again gives "Not stopped" (404).
  • If a person clears the site's data in the browser, the stored keys are lost and those links can't be stopped. The page says this.

Reuse: I did not run similar.ts. I extended linkForm with an optional from app id rather than adding a second form builder.

Try it: on a preview, open /tab, make an app, press Get a link and then Keep the key in my tab. On the app's page, press Stop sharing, then reopen the link. It should answer 404.

Gate: the migration pin is committed. The look-page warning is answered with a No look: line, since the route isn't in app.looks.

Closes #18398

2 earlier comments
commented

The person who made a read-only tab-forge link can now take it back with a revoke key, shown once. The new tests, tsc, gate.ts and design-lint pass, but I have not run the app or tried it on a preview. One test in the set I ran failed: the looks-lane Chromium test (#12496). It's unrelated to this change and I did not investigate it.

What changed

  • Key at link time: making a link also makes a revoke key. The page that answers shows it once, never in the link. Only its SHA-256 is stored, in a new nullable tab_shared.key_hash column.
  • Keeping the key: the answer page has Keep the key in my tab. It posts the link and key to the tab's own page for that app (/tab/f/apps/<n>/links), which stores them in a kept_link table in the tab.
  • Listing and stopping: the app's page in /tab lists "Links you made", each with Stop sharing. That posts to POST /tabforge-link/<id>/revoke with the key.
  • Right key: it deletes the row, and the link then answers the forge's one 404.
  • Wrong or missing key: the link stays, the page says "Nothing changed" with a 403, and the key is compared in constant time as a hash. An id that doesn't exist gets the 404.
  • Same-origin and rate limit: the revoke POST is same-origin checked and uses the existing share rate limit.
  • Old rows: a row made before this has no hash. It stays openable and cannot be revoked.
  • Tests: test/tab-share-revoke.test.ts covers the right key, a wrong or no key, a cross-origin POST, an unknown id, an old row with no hash, and the tab keeping and listing the key.
  • Docs and terminal: docs/features/tabforge.md is updated. The terminal's twin is the new TAB_REVOKE sentence in tabLine(). The commit says No door for the rest, because a terminal holds none of a tab's keys.

What I chose not to do

  • The key is not saved automatically. The person presses Keep the key in my tab, or copies it from the page. That keeps it working with script off, and the page says so.
  • A revoked link stays in the tab's list; nothing removes it. Pressing Stop sharing on it again gives "Not stopped" (404).
  • If a person clears the site's data in the browser, the stored keys are lost and those links can't be stopped. The page says this.

Reuse: I did not run similar.ts. I extended linkForm with an optional from app id rather than adding a second form builder.

Try it: on a preview, open /tab, make an app, press Get a link and then Keep the key in my tab. On the app's page, press Stop sharing, then reopen the link. It should answer 404.

Gate: the migration pin is committed. The look-page warning is answered with a No look: line, since the route isn't in app.looks.

commented

I fixed all three points from the review and pushed. I did not run the full suite. The type check and gate are clean, and the revoke, share, door, design-lint and dead-code tests pass.

  • Dead link stays listed: each "Stop sharing" form in the tab's "Links you made" list now sends the app's number. When the revoke succeeds, or the link is already gone (a 404 page with the same form), the answer offers "Remove it from my tab's list". That form posts to /tab/f/apps/<n>/links with forget=<id>, which deletes the kept row after checking the id. Without the app number, an unknown id is still the bare 404.
  • Wording: the answer page now says one line: "Shown once, not in the link: the only way to take this link back." The "kept in this tab" claim is gone from it. The long TAB_REVOKE paragraph stays on the app page and in tabLine().
  • Own door: revoke attempts now use a new revoke door (10 a minute per address, 60 for the forge) instead of share, so stopping several links is not throttled by making them. This adds a new Door member in src/http/strangers.ts.
  • Tests and docs: a new test revokes with the app number and checks the forget form on the success page. It repeats the revoke and checks the same form on the 404. It then confirms the tab's list drops the row, and that a bad forget id is refused with a 422. docs/features/tabforge.md is updated.
  • Terminal side: the commit says No door: because tabLine() already covers this.

I left out forgetting the row when the revoke answers 403 for a wrong key, since the link is still live then.

commented

A person who made a tab-forge read-only link can now take it back with a key. The key is shown once when the link is made, and only its hash is stored. The right key deletes the link and the wrong key changes nothing. A dead link drops off the tab's list, and revoking is rate-limited per address separately from making links.

This push answers the review:

  • The revoke limit is now tested (test/tab-share-revoke.test.ts). The test resets the per-address counters, makes 10 revoke posts from one address, checks the 11th is 429 Too many tries, and then checks that making a link from the same address still answers 201. If revoke shared the make limit, it would refuse the 10th revoke and the final make.
  • The answer page explains the key once (src/web/pages/tabforge-link.ts:75). With no app number, the page says "the only way to take this link back" once, followed by "Keep it somewhere safe." A test checks the phrase appears exactly once.

Checks run: bun scripts/gate.ts (39 rules, 0 fail), bun x tsc --noEmit, bun scripts/design-lint.ts, and the tab-forge, share and strangers test files (161 pass, 1 skipped, 0 fail). I did not run the full suite: scripts/fast.ts listed nearly every test file for this diff, so the forge's check on this push runs it.

To try it on the preview, go to /tab and make a link from an app. With no app number, the answer page names the key's purpose once. Post to /tabforge-link/<id>/revoke more than 10 times in a minute with a wrong key: the 11th answers 429, and making a new link still works.

[{"go":"/tab","look":"make a read-only link from an app, then open the answer page","expect":"the key is shown once and 'the only way to take this link back' appears a single time"},{"go":"/tab/f/apps/1","look":"press Stop sharing with a wrong key more than ten times in a minute","expect":"the eleventh answers 'Too many tries from here', and making a new link still works"}]

🤖 Generated with Claude Code

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs