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

Access 5: a visitor with no account is someone the forge knows, and what they made comes with them when they sign up #18069

opened this in answer to

Parked 2h 12m ago

A visitor with no account now has a signed id, a role in the CAN table, and a way to bring what they made into an account. Three things the issue lists are not done: the same-origin tab forge's and the Apple app's POST /visitor/work calls, the existing anonymous spawn, and the "same may() table".

Notes

opened this

A visitor with no account now has a signed id, a role in the CAN table, and a way to bring what they made into an account. Three things the issue lists are not done: the same-origin tab forge's and the Apple app's POST /visitor/work calls, the existing anonymous spawn, and the "same may() table". I ran bun x tsc --noEmit, bun scripts/design-lint.ts, bun test test/mcp-size.test.ts and about 400 related tests, all green. I did not run the whole suite; the forge's check does that.

Threat note. The risk is account takeover and privacy: someone planting their things into a victim's account, or lifting a victim's device list.

  • The id is signed under its own label (visitor-principal), not the analytics one. Cookie forge_vp, shape v…; forge_visitor and c… ids are never accepted as one, and the two are never joined.
  • The id is minted only at POST /visitor/work, never on a read. Do-Not-Track and Global Privacy Control mean no id is given.
  • Bringing needs a signed-in person, a same-origin form, the signed id, and a confirm bound to account, session, device and chosen rows. The confirm comes from the page that account was shown. A forged, borrowed or missing one moves nothing, with or without a passkey on the account.
  • A bringing is one transaction with a receipt. It can be undone for a day, then it is theirs.
  • Visitor events are not added to the reader-visible event list.

What changed

  • src/auth/visitor_principal.ts: mints and verifies the signed id and builds its cookie and confirmation token. It reuses cookieValue and the refusesTracking check.
  • src/core/visitor_work.ts: keeps what a visitor made (apps from the tab forge, notes, game players) and does the bringing and the undo. The visitor_principal, visitor_item and visitor_carry tables are in migration 20261204052000-visitor-principal.
  • src/core/roles.ts: a visitor role with read and keep_work. docs/ROLES.md is regenerated.
  • Limits: three visitor.* rows in settings/limits.ts: things per visitor (20), things per forge per day (1000), new ids per day (2000). Past one, the door answers 429.
  • Web: /visitor/bring (list, bring, undo) and POST /visitor/work, in src/web/pages/visitor_bring.ts. After sign-in the front page says once that something waits.
  • Move-in: /forges/move-in brings the visitor's tab_app items into the account that moves in.
  • Terminal: the palette entry "Brought in from a device" shows what was brought and the receipts. u undoes the newest bringing still inside its day.
  • Docs: docs/features/visitor-carry.md, and two threat bullets in docs/threats/automated-attacker.md.
  • Cookie roster: test/cookie-flags.test.ts gained entries for the new cookie.
  • Tests: test/visitor-carry.test.ts, 14 tests. They cover make as a visitor, bring, find it owned by the account, and a second visitor presenting the first's id without its signature being refused. They also cover forged, borrowed and missing confirms into a passkey account, a cross-site post, undo, limits, GPC/DNT, and the move-in hook.

What I chose not to do

  • Existing anonymous spawn: its own claim link (src/spawn/claim.ts) is untouched; moving it onto this model is a separate slice.
  • Callers of the door: the tab forge's and the Apple app's calls to POST /visitor/work (#18043, forge-apple #52) are theirs to add. There is no API route or MCP tool, so mcp-size is unaffected.
  • "Same may() table": contract/can.ts's may() is the evaluator for apps' contracts. The forge's own table is CAN, so the visitor role went there.
  • Account page: the account page and terminal can screen list every ability, so a member now also sees "Keep what you make before you have an account: no".
  • Per-client mint limit: there is no per-address limit on minting, since that would store an address-derived value. Minting is capped per forge per day, and each visitor is capped per kept item.

Try it. On the preview, curl -i -d 'kind=tab_app&ref=notes&label=Notes' -H 'origin: <preview url>' <preview>/visitor/work returns a forge_vp cookie. Open /visitor/bring signed out, then signed in, to choose and bring the item, then undo it. On the terminal, open the palette entry "Brought in from a device".

[
  {"go": "/visitor/bring", "look": "signed out, in a browser holding forge_vp with a kept item", "expect": "the item is listed with Sign in and Sign up buttons"},
  {"go": "/visitor/bring", "look": "signed in, same browser", "expect": "checkboxes and one button to bring the chosen things; after pressing it a receipt with Undo"},
  {"go": "/", "look": "signed in with an unbrought item on the device", "expect": "one notice pointing at /visitor/bring"}
]

🤖 Generated with Claude Code

Closes #18051

Show 14 earlier items

7 earlier comments · 1 event
commented

I merged main into the branch again and pushed it. This time only src/generated/marks.ts conflicted.

It is a generated file, so I took main's version and re-ran bun scripts/own-source.ts to rebuild it. That covers both sides' marks without a hand merge, and no conflict markers remain. bun x tsc --noEmit printed nothing. test/own-source.test.ts and test/may.test.ts passed: 12 tests, 0 failures. I didn't run the wider suite, so the forge's check on this push is the full run.

commented

I merged main into the branch again and pushed it. main had added its own visitor concept alongside the one on this branch, and the three conflicts came from the two overlapping.

  • docs/ROLES.md: I kept main's description of the visitor (the forge_maker cookie, the visitor.make action, the daily caps). I added a sentence for this branch: what a visitor keeps can be brought into an account on sign-up.
  • test/may.test.ts: an anonymous visitor now gets ["forge.read", "forge.keep_work", "visitor.make"], which is both sides' actions.
  • test/cookie-flags.test.ts: I kept both main's forge_maker entry and this branch's forge_vp entry, which src/auth/visitor_principal.ts sets. main had dropped the old src/apps/feedback.ts entries because that code no longer sets a cookie, so I dropped them too. Two cookie checks failed until I did.

bun x tsc --noEmit printed nothing. These suites passed, 61 tests and 0 failures: may, cookie-flags, own-source, the visitor* tests and palette-roster. I did not run the whole suite, so the forge's check on this push is the full run.

commented

I merged main into the branch again and pushed it. Only src/generated/marks.ts conflicted, as it did the last time.

It is a generated file, so I took main's version and rebuilt it with bun scripts/own-source.ts. No conflict markers remain. bun x tsc --noEmit printed nothing. test/own-source.test.ts, test/may.test.ts and test/cookie-flags.test.ts passed: 26 tests, 0 failures. I did not run the whole suite, so the forge's check on this push is the full run.

commented

I merged main into the branch and pushed it. The only conflict was src/generated/screens.ts.

That file is generated, so I took main's version and re-ran bun scripts/own-source.ts to rebuild it instead of merging the two sides by hand.

bun x tsc --noEmit is clean. test/own-source.test.ts and test/palette-roster.test.ts pass (18 tests). I did not run the full suite, and I did not run scripts/gate.ts or scripts/design-lint.ts on this merge. The forge will run the full check on the push.

The pull's own change is untouched.

commented

Still red on current main: apps: websockets through the proxy > a visitor's socket closes when their account is suspended; the app and others' sockets go on. Fix it and push.

the crew's run was interrupted: provider limit, resumes 15:07 UTC — every subscription this repository may use is resting (API Error: 402 This request requires more credits, or fewer max_tokens. You requested up to 128000 tokens, but can only afford 2000. To increase, visit https://)
commented

Still red on current main: apps: websockets through the proxy > a visitor's socket closes when their account is suspended; the app and others' sockets go on. Fix it and push.

commented

I fixed one of the two failing tests and pushed. The other fails on main too, so I left it alone.

  • Fixed: the check's test/apps-ws.test.ts failure ("a visitor's socket closes when their account is suspended…") came from this pull. It makes visitor a reserved username, and that test created a user named visitor, so createUser returned username_reserved. I renamed the test user to vera in test/apps-ws.test.ts. The file now passes (11 of 11). I didn't run the rest of the suite. The forge re-runs the full check on this push.
  • Left alone: test/data-browser.test.ts ("every forge.db column that could hold a secret…") fails because connection_lookup_audit.key_id is a new column not in the audited-clear list. The check log says it is red on main at 5ce50ab too, so it isn't counted against this pull. I did not touch it.
  • Gate: gate --fix printed two "one implementation?" similarity notes (receiptsOf, visitorRoutes). I made no change for them and the push went through.
commented

Closed by the crew: main moved under it 11 times and the branch could not be brought up to date. Conflicting files: src/generated/marks.ts.

Sign in to join this conversation.

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

Keyboard shortcuts

Docs