Repository navigation
fix(server): SameSite=Lax for the tailnet session, and log why a tailnet request was refused (#240) - #241
Conversation
…fore a rotation (#240) session.Verify returns ErrMalformed, ErrSignature, ErrExpired or ErrFuture; Check is Verify without the reason. token.Store keeps, in memory only, the token it held before the last rotation it saw, and DerivePrevious lets the log say a session was signed before the rotation rather than call it a bad signature. Nothing new is on disk. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…est was refused (#240) The session cookie is SameSite=Lax, so a top-level navigation from outside the site - a home-screen shortcut, another app's link - carries it (M13-R1; the operator's decision on #239). Cross-site writes, fetches and frames still go without it, and the Origin check still refuses a cookie-authenticated request with a foreign Origin. A test pins the set of GET routes, each audited as a read. Every tailnet request sent to the login page or refused is logged with its reason, and a login names the browser family from a coarse User-Agent parse (M13-R2). No cookie value, token, key or query is logged. The same reason from the same address is logged once a minute, and all callers together at most 30 lines a minute, with a count of what was left out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…, nothing else from it does (#240) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…#240) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The introduction's Authentication section says why Lax (the home-screen shortcut), what it still withholds, that v0.3.2 needs nothing from users, and what the refusal log says; docs/running.md says the same in short. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review — 942ee7cThe head had not moved when I started. I reviewed it in my own detached worktree and ran everything below against a daemon built from it: temporary token, state and root under my scratch directory, ports 874x/875x. Findings1. blocking: log injection through the request path (M13-R2). The same happens with Fix I'd expect: quote the path, e.g. 2. blocking: several tailnet refusals are not logged at all, and three docs say every one is (M13-R2, M13-R4). R2 says "every tailnet request sent to the login page or refused is logged with its reason".
Measured: In my Chromium matrix, the cross-site form POST to 3. nit: the GET-route guard catches only one spelling of a new route. The method-less check has the same holes. Today every route really is a single-line 4. nit: a typed URL did not lose the session under Strict ( 5. nit: the upgrade claim leaves out the one-time ask that the plan admits ( 6. nit: "in the last minute" can be hours late ( What I verified, and how
Verdict: changes requested |
…d log every tailnet refusal (#240) Review findings 1 and 2 and nit 6 on PR #241: - the path, the address, the method, the Host and the Origin go through logSafe: cut on a rune boundary, then every non-printable character written as its Go escape, so %0a, %0d, %1b, U+0085 and U+2028 in a path cannot forge a line or a terminal sequence; - the login form's refusals (405, 403 cross_origin, 400 unreadable form, 400 not https, 429) and the guard's forwarded-loopback-Host and absolute-form bad_host refusals are logged with their reasons, under the same bounds, and a wrong token's line says why; - the count of refusals left out of a capped minute names the minute it is about, since it is written with the next refusal, however late. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
) Review nit 3 on PR #241: the GET audit parsed only single-line HandleFunc calls in server.go. It now walks every non-test source in the package with go/parser and takes the literal pattern of any Handle or HandleFunc call, and refuses a pattern that is not a literal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nd every logged refusal (#240) Review nits 4 to 6 and the docs half of finding 2 on PR #241: a typed or bookmarked URL carried the cookie under Strict too; the first home-screen launch after the upgrade to v0.3.2 asks once; the refusal list includes the login form's and the Host guard's; the left-out count is written with the next refusal and names its minute. Closes #240 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review — 45bb114Round two covers the fix pass for round one (#241 (comment)), with the Decision addendum #240 (comment). I reviewed it in a fresh detached worktree at this head, with a daemon built from it on port 8761 and a scratch token and root. Findings1. blocking: the wrong-token line is not bounded, and the premise that the throttle bounds it is false. The addendum keeps That is about 350 lines a second, from anything the tailnet ACL admits. This is the very flood the original Decision says neither a dead cookie nor "a hostile node on the tailnet" should be able to write. The introduction also says every caller together gets "at most thirty lines a minute" ( Fix: send this line through No other findings. Round one's finding 2 is otherwise closed, and so are finding 1 and nits 3 to 6. The evidence is below. What I verified, and how
Verdict: changes requested |
…240) Review round two on PR #241: the line was written for every failed login, and the throttle's delay does not bound it for callers varying X-Forwarded-For (2000 lines in 5.7 s, measured). It now goes through logRefusal, with the per-address dedupe and the 30-a-minute cap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review — 950f7ceRound three covers the fix for round two's blocking finding (#241 (comment)), with the corrected addendum #240 (comment). I reviewed it in a fresh detached worktree at this head. FindingsNone. What I verified, and how
My round-one and round-two findings are all closed. Verdict: approve |
|
Operator confirmation: reviewed and accepted by @davison as both author and operator (pure solo tier, SPEC §5) — no independent principal exists in this project. |
…d log every tailnet refusal (#240) Review findings 1 and 2 and nit 6 on PR #241: - the path, the address, the method, the Host and the Origin go through logSafe: cut on a rune boundary, then every non-printable character written as its Go escape, so %0a, %0d, %1b, U+0085 and U+2028 in a path cannot forge a line or a terminal sequence; - the login form's refusals (405, 403 cross_origin, 400 unreadable form, 400 not https, 429) and the guard's forwarded-loopback-Host and absolute-form bad_host refusals are logged with their reasons, under the same bounds, and a wrong token's line says why; - the count of refusals left out of a capped minute names the minute it is about, since it is written with the next refusal, however late. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
) Review nit 3 on PR #241: the GET audit parsed only single-line HandleFunc calls in server.go. It now walks every non-test source in the package with go/parser and takes the literal pattern of any Handle or HandleFunc call, and refuses a pattern that is not a literal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nd every logged refusal (#240) Review nits 4 to 6 and the docs half of finding 2 on PR #241: a typed or bookmarked URL carried the cookie under Strict too; the first home-screen launch after the upgrade to v0.3.2 asks once; the refusal list includes the login form's and the Host guard's; the left-out count is written with the next refusal and names its minute. Closes #240 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Closes #240
The tailnet session cookie is now
SameSite=Lax, so a home-screen shortcut or a link from another app opens md-notes logged in. Every tailnet request sent to the login page or refused is logged with its reason. Milestone M13 (#239). This adopts capture #238, whichtask finishcloses.What changed
internal/server/tailnet.go:setSessionCookiewritesSameSite=Lax. That is the operator's decision on M13: A home-screen shortcut that stays logged in #239: M13: A home-screen shortcut that stays logged in #239 (comment)refusalLog, and a login names the browser family (useragent.go).internal/session:Verifysays why a value was refused.Checkis unchanged, and isVerifywithout the reason.internal/token:DerivePreviousgives the key of the token before the last rotation, in memory only. It is used for the log line and never to accept a session.internal/server/getroutes_test.gopins the GET routes, each audited as a read in the plan. A new GET route fails the test until someone adds it to that list.docs/running.mdandcontrib/mdn.1.Requirements
SameSite=Lax, and failed against today's code.ui/e2e/tailnet-session.test.mjsserves a second https site,attacker.test, and the proxy records whether the browser sent the cookie on each request./api/clipand/login, a credentialedfetchand aniframeall arrive without the cookie and are refused.Origingets 403, and the note is untouched.TestEveryGETRouteHasBeenAuditedAsARead.TestTailnetRefusalsAreLoggedWithTheirReasoncovers every reason and asserts that no secret appears.TestTailnetLoginNamesTheBrowserFamily,TestTailnetRefusalLogIsBounded,TestBrowserFamilyandTestVerifySaysWhycover the rest. Measured against the built daemon; the lines are in the Decision.docs/running.mdand the man page say the same in short.Decisions
Laxis the fix the operator chose.Checks
make checkandmake e2epass locally: 124 of 124, Chromium 153.No
featcommit: the commits arefix,testand onedocsfor the prose.🤖 Generated with Claude Code