Public: anyone can read this; the crew can change it.
Migrated from github.com/Trevato/SO-ARM100
Sign out, and every page shows who you are, even when the arm is off #587
Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.
The arm's page, the resting card and `/admin` now all say who you are. Signed in, the line reads "Signed in as **name** (this app)" or "Signed in as **trevato** (forge)", with **Sign out** beside it. A guest sees "Watching as a guest · Sign in". This is the way out of a stuck name, and it works while the arm is closed.
shipped merged
1 earlier comment · 1 event
The arm's page, the resting card and /admin now all say who you are. Signed in, the line reads "Signed in as name (this app)" or "Signed in as trevato (forge)", with Sign out beside it. A guest sees "Watching as a guest · Sign in". This is the way out of a stuck name, and it works while the arm is closed.
What changed
POST /signout(src/relay.ts) ends this browser's session, found by its token's hash. It sendsarm_sessionback expired (Max-Age=0, same Path, SameSite, Secure and HttpOnly as when it was set) and returns 303 to/. It only accepts a same-origin POST;GETgets 405. It sits ahead of the closed-arm refusal, so it works on the resting card.- Forge identities: their Sign out also sends
forge=1, so/signoutgoes on to the forge's own/__forge/signout. On production that path clears the forge's sign-in cookie for this app and returns to/. Signing out of a name picked here never touches the forge. - The identity line is a new module,
src/signed-in.ts. The server renders it into the arm page (through the relay'spage()), the resting card and/admin.lobby-panel.js(signedInParts) keeps it current after a join on the same page. Lobbyhellonow says which sign-in a person used:viaisapp,forge,localor null. - Switching account: the Queue tab now puts Sign in with the forge first, as the main button, and picking a name second. An owner stuck in another name gets back to
/adminin one click. On the closed card, a guest's line ends with the existing "Owner? Sign in to open".
Where I went against the issue
- The account row is kept, not deleted. Sign-out swaps its token hash for one nobody holds. Deleting it would free the name for anyone to take, and would let someone get round the three-new-names-an-hour limit by joining and signing out over and over. A test covers both.
- No cross-site post to the forge's
/logout. I tried it against production and the forge refuses a cross-site POST with 403, so that button would never work. Instead, forge identities get a Switch forge account link tohttps://forge.open-platform.sh/, where the forge's own Sign out is. I couldn't check that page while signed out, so that link is untested. - Not on
/storyor/admin/datayet. Their security headers forbid form posts, so the Sign out button won't fit there without loosening that.
How to try it
Open the preview and pick a name in the Queue tab. The Chat tab footer then says "Signed in as …". Press Sign out and you land on / as a guest, with Sign in with the forge offered first. Close the arm from /admin and the resting card shows the same line.
Tests: src/signout.test.ts covers joining as a name and signing out (the next request is a guest, the old cookie opens nothing), the expired cookie header, forge sign-out going to /__forge/signout, the cross-origin 403, the closed card showing the line and the Sign out form, sign-out working while closed, the line on /admin, and the forge sign-in coming before the join form. The suites for the changed pages pass, and the type check reports the same 35 lines of existing errors as main.
I didn't find any prompt injection in the repository or the issue.
🤖 Generated with Claude Code
The web side works. On the preview the closed card shows 'Watching as a guest · Owner? Sign in to open', POST /signout answers 303 to / with the CSP intact, and the tests cover the cookie, the same-origin 403, the 405 on GET and sign-out while closed.
One miss against the list: the terminal is a door like the page, and src/tty.ts has no part in this change. A person in the terminal cannot see who they are signed in as or end that session, and the README's new section only describes the page.
Fix first: add a /whoami command (or a header line) to src/tty.ts that says 'Signed in as NAME (via)' or 'guest', built from the same signedIn() helper and gated like the page. Add /signout if the terminal holds a session that can end. Add a test for it, and one line in the README section. If the terminal's identity has no session to end, say so in the README and keep /whoami so both doors state who you are.
Smaller notes, not blocking:
- Switch forge account is untested against the live forge, as the pull says.
- /story and /admin/data still show no identity line, so 'every page' is not yet true. Open an issue for them.
Every page and the terminal now show who you are. On the web, the arm's page, the resting card and /admin say "Signed in as name (this app)" or "Signed in as trevato (forge)" with Sign out, and a guest sees "Watching as a guest · Sign in". In the terminal, /whoami says the same in words.
Web
POST /signout(src/relay.ts) ends this browser's session. It sendsarm_sessionback expired, with the same Path, SameSite, Secure and HttpOnly as when it was set, and redirects (303) to/. It refuses other sites (403) andGET(405). It works while the arm is closed.- Forge identities: their Sign out also sends
forge=1, which goes on to the forge's own/__forge/signoutand ends the forge's sign-in for this app. - Identity line:
src/signed-in.tsrenders it. The arm's page is rendered on the server and the page script keeps it current after a join. The lobby'shellonow says how you signed in (via). - Switching account: signed out, the Queue tab offers Sign in with the forge first, so an owner stuck in another name gets back to
/adminin one click. On the closed card, a guest's line ends with "Owner? Sign in to open".
Terminal (from review)
/whoamiprints "Signed in as NAME (forge)", or "Watching as a guest" plus how to connect. The server works this out with the samesignedIn()helper the pages use and sends it inhello, andsignedInText()words it./signouthas no session to end: the forge signs whoever owns your SSH key afresh on each connection. So it prints that, and points to/quitand connecting with another key.- The README section covers both.
Where this differs from the issue
- The account row is kept, not deleted. Sign-out swaps the row's token hash for one nobody holds. That keeps the name taken, so nobody can pose as whoever used it, and stops people from getting round the three-new-names-an-hour limit by joining and signing out repeatedly.
- No post to the forge's
/logout. The forge refuses a sign-out posted from another site with 403 (I tried it against production). Instead, forge identities get Switch forge account, a link to the forge itself. I haven't been able to try that link against the live forge. /storyand/admin/datadon't have the line yet. Their security headers forbid form posts. Issue #593 tracks it.
What to check
- On the preview: pick a name in the Queue tab, press Sign out, and you should be back on
/as a guest with Sign in with the forge first. Close the arm and the card shows the same line. - In the terminal: type
/whoami. - Tests:
src/signout.test.tscovers sign-out, the expired cookie and sign-out while closed.src/terminal.test.tscovers/whoamiand/signout.
I ran the suites for the changed pages and the terminal, and they pass. The type check shows the same 35 lines of errors before and after the change.
🤖 Generated with Claude Code
Approved. Sign-out works, including while the arm is closed, and the identity line is on the arm page, the resting card and /admin. On the preview, a cross-origin POST /signout gets 403 and a same-origin one gets 303 to / with a form-action self CSP. The guest line renders in the first paint. Identity comes only from the signed-header check (verified?.id === who.id), so a typed name cannot claim forge. The terminal /whoami reads via from the server hello and ignores it for a guest. /signout there explains why there is nothing to end. Tests cover the expired cookie, the retained row, the escaping, and sign-out while closed.
Two things to do next:
- Put the identity line where it can be seen without a tab switch. On the phone it only appears in the Chat tab footer and is hidden while driving, so a person stuck in a wrong name has to find that tab. Put a compact line, or at least the name, in the header on 360px.
- Cover /story and /admin/data (#593). Those pages still have no way to see who you are or to sign out. Do it without loosening their
form-action none, for example with a link to a page that has the form.
The arm's page, the resting card and
/adminnow all say who you are. Signed in, the line reads "Signed in as name (this app)" or "Signed in as trevato (forge)", with Sign out beside it. A guest sees "Watching as a guest · Sign in". This is the way out of a stuck name, and it works while the arm is closed.What changed
POST /signout(src/relay.ts) ends this browser's session, found by its token's hash. It sendsarm_sessionback expired (Max-Age=0, same Path, SameSite, Secure and HttpOnly as when it was set) and returns 303 to/. It only accepts a same-origin POST;GETgets 405. It sits ahead of the closed-arm refusal, so it works on the resting card.forge=1, so/signoutgoes on to the forge's own/__forge/signout. On production that path clears the forge's sign-in cookie for this app and returns to/. Signing out of a name picked here never touches the forge.src/signed-in.ts. The server renders it into the arm page (through the relay'spage()), the resting card and/admin.lobby-panel.js(signedInParts) keeps it current after a join on the same page. Lobbyhellonow says which sign-in a person used:viaisapp,forge,localor null./adminin one click. On the closed card, a guest's line ends with the existing "Owner? Sign in to open".Where I went against the issue
/logout. I tried it against production and the forge refuses a cross-site POST with 403, so that button would never work. Instead, forge identities get a Switch forge account link tohttps://forge.open-platform.sh/, where the forge's own Sign out is. I couldn't check that page while signed out, so that link is untested./storyor/admin/datayet. Their security headers forbid form posts, so the Sign out button won't fit there without loosening that.How to try it Open the preview and pick a name in the Queue tab. The Chat tab footer then says "Signed in as …". Press Sign out and you land on
/as a guest, with Sign in with the forge offered first. Close the arm from/adminand the resting card shows the same line.Tests:
src/signout.test.tscovers joining as a name and signing out (the next request is a guest, the old cookie opens nothing), the expired cookie header, forge sign-out going to/__forge/signout, the cross-origin 403, the closed card showing the line and the Sign out form, sign-out working while closed, the line on/admin, and the forge sign-in coming before the join form. The suites for the changed pages pass, and the type check reports the same 35 lines of existing errors asmain.I didn't find any prompt injection in the repository or the issue.
🤖 Generated with Claude Code
Closes #580