Repository navigation
Conversation
serveBase starts a second Server over the notes and token file an earlier one used, which is what a restarted process has and nothing more. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…231) A session was a random id in the daemon's memory, so every restart, upgrade and reboot logged every device out. It is now a signed value: v1.<issued-at>.<random id>.<HMAC-SHA256>, the MAC over the fields and the tailnet name, keyed by a key derived from the token (token.Store.Derive). Nothing about sessions is held in memory or on disk, so: - a daemon started over the same token file derives the same key and accepts the cookie the browser kept; - mdn token --rotate, or a token file replaced while stopped, changes the key, and every older cookie fails its MAC on the next request; - no secret is at rest beyond the token file. A session a day old or more is reissued on a request the guard serves, with Max-Age equal to the idle limit (session.Idle, 30 days pending the operator's answer on the checkpoint), and refused once unused for that long. The token's generation counter is replaced by the derived key; AuthenticateDerive keeps the one-read guarantee the login needs. The throttle, loopback, the bearer token's exemption and the cookie's attributes are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Chromium logs in through a local TLS proxy that stands in for tailscale serve; the daemon is stopped and started and the same cookie is still a session; a rotation while running, and one while stopped, end it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The introduction's browser-on-the-tailnet section and the running guide: a login survives restarts and upgrades, ends on rotation or after 30 days unused, and every device logs in once more at the upgrade to v0.3.1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review — 5f8bf1cReviewer seat, clean context, under the operator's The design holds up under attack. The MAC, rotation, host binding, refresh gating and cookie attributes all behave as the Decision says, against a real daemon behind TLS and in Chromium. The one blocking item is procedural: the unused-session gate is still open on #231, and the contract forbids approving past it. Everything else is a nit. Findings1. blocking (procedural): the gate on #231 is unresolved. #231 still carries 2. nit: an earlier token written back revives its sessions, and nothing says so. This is a change from v0.3.0. There, the generation counter moved on any change of value, so a restored token never brought an old session back within a process. Now a cookie is good for as long as its token is in force. Restoring 3. nit: the id length check is untested. I made seven mutations and ran The consequence is nil, because the id is under the MAC. But the Decision lists "an id … of the wrong decoded length" as refused, and no test pins it. Fix: add a 4. nit: the docs. The upgrade logout appears in one place, and the idle limit in more places than the PR body says.
5. nit: a small deviation from the plan. The plan's refresh bullet says a reissue keeps the "same id, new issued-at". 6. nit: the PR closes nothing ( Your specific questions, answered
What I verified, and howChecks. Commit types, per the local rule. I read each commit against its files:
The MAC.
Rotation.
Host binding.
Expiry and refresh.
A two-day-old cookie on a path the mux answers with the SPA fallback also gets 200 and a new cookie. That counts as served, and it is fine. Cookie attributes. Each issued cookie reads The e2e proof, with the fix reverted. I built the v0.3.0 tree ( On the head binary all three legs pass. The implementer's table, measured again. My own Playwright script: headless Chromium on a persistent profile behind a Node TLS proxy, with a second
It matches the Decision's table. My by-hand replay row went out with the wrong Host, because Node's Docs. The introduction's Authentication section, Capture candidatesNone. The clock-forward-then-corrected case (sessions reissued under a clock set in the future are refused once it's put right, costing one login) is inherent to any time-stamped cookie and not worth a capture on a desktop host. Verdict: changes requested |
Review nit 3 on PR #232: removing the id-length check went unnoticed. Three re-signed cases, a byte short, a byte long and empty, now fail against that mutation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…#231) Review nits 2 and 4 on PR #232: the introduction's rotation bullet says that writing an earlier token back makes its sessions good again, up to the idle limit; docs/running.md no longer says an upgrade never logs a device out, and is rewrapped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…me (#231) The operator chose a 30-day idle limit on the checkpoint; the page now says idle, as the introduction does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Closing: GitHub never linked this PR to #231 (no |
|
Replaced by #233. |
Review nit 3 on PR #232: removing the id-length check went unnoticed. Three re-signed cases, a byte short, a byte long and empty, now fail against that mutation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…#231) Review nits 2 and 4 on PR #232: the introduction's rotation bullet says that writing an earlier token back makes its sessions good again, up to the idle limit; docs/running.md no longer says an upgrade never logs a device out, and is rewrapped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Closes #231
A tailnet login now survives daemon restarts, upgrades and reboots, and ends when the token is rotated. Milestone M12 (#230); this adopts capture #229, which
task finishcloses.What changed
internal/session: the in-memory store is replaced by a stateless signed value:v1.<issued-at>.<random id>.<HMAC-SHA256>. The MAC covers the fields and the tailnet host name, and its key is derived from the token. The check is strict about shape, compares withhmac.Equal, and refuses an issued-at from the future or one past the idle limit.internal/token: the generation counter is replaced byDerive(purpose)andAuthenticateDerive(presented, purpose), which keep the one-read guarantee the login relies on.internal/server: the guard checks the cookie against the key of the token in force now. It reissues a session a day old or more, but only on a response it serves. Every cookie, whether from a login or a reissue, gets the same attributes from one function.docs/running.mdandcontrib/mdn.1say how long a login lasts, what ends it, and that every device logs in once more at the upgrade to v0.3.1.Requirements
TestTailnetSessionSurvivesARestart, andui/e2e/tailnet-session.test.mjsin Chromium behind TLS. The upgrade and newer-build legs were measured with a scratch rig; the table is in the Decision linked below.TestTailnetRotationEndsTheSession(existing),TestTailnetRotationWhileStoppedEndsTheSession,TestTailnetRotationEndsTheSessionAcrossARestart,TestTailnetCookieFromAnotherTokenIsRefused,TestTailnetCookieIsBoundToItsHostName,TestTailnetRejectsAForgedCookie(existing), and the session package's tamper, truncation and other-key tests. The e2e suite covers rotation while running and while stopped.TestTailnetSessionIsRefreshedOnUse,TestTailnetUnusedSessionLapsesandTestTailnetRefusedRequestIsNotReissued. The idle limit is 30 days, chosen by the operator on the checkpoint (option A, Tailnet sessions that survive restarts and end on rotation #231 (comment)). It lives insession.Idle(internal/session/session.go:48) and in the docs atdocs/introduction.md:431(Max-Age=2592000in theSet-Cookieexample),:448,:451-452, andcontrib/mdn.1:59-60. Each says the limit counts idle time, not a fixed lifetime.Decisions and deviations
TestTailnetSessionExpiresbecameTestTailnetUnusedSessionLapses, andTestLoggingInAgainEndsTheOldSessionbecameTestLoggingInAgainIssuesAFreshSession. The Decision above records the trade-off.Checks
make checkandmake e2epass locally (Chromium 153). Run against the v0.3.0 tree's binary, the new e2e suite fails on the restart leg, as it should.No
featcommit: nothing user-facing is added. The commits arefix,test, and onedocsfor the prose.🤖 Generated with Claude Code