Repository navigation
fix: sign in through actions instead of exporting tailscale web - #26
Conversation
`tailscale web` was bound to 0.0.0.0:8240 and exported as the Tailscale Admin UI interface. On generic Linux the web client applies no login, and its login API can sign the node in to any tailnet or control server, or re-authenticate it. Upstream's own default is localhost-only. The web client is no longer run and the `web` host is retired in the 1.104.7:1 migration. Signing in and checking the node move to actions that run the tailscale CLI in a temporary subcontainer against tailscaled's socket on the main volume: - Sign In: `tailscale up --reset --json [--login-server]`, returning the AuthURL (copyable, QR, launchable). `--force-reauth` when the node still holds a key. - Sign In with Auth Key: the same with `--auth-key=file:` (masked input, key never on the command line). - Node Status: `tailscale status --json --peers=false`. - Log Out: `tailscale logout`, rewrite ts-status.json, restart. An important task points to Sign In while ts-status.json does not record Running, and is cleared once it does. Existing signed-in nodes keep their identity in tailscaled.state and stay signed in. Bumps start-sdk 3.1.1 -> 4.1.0 (no code changes needed). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
helix-white
left a comment
There was a problem hiding this comment.
Two correctness fixes before approval:
-
[P2] Preserve command failures in
withTailscaleCli(startos/utils.ts:226,startos/actions/logOut.ts:21–29). SDK 4.1.0'ssub.execresolves on nonzero exit and timeout; the wrapper discards those fields. Consequently Log Out reports success and restarts even iftailscale logoutfails (for example, the control-server logout request fails or times out), or the status rewrite fails. The owner cannot tell that the requested logout/key invalidation did not complete. The proposal usesexecFailat the shared command boundary, documents its rejection contract, and routes status queries through that same primitive. The sign-in script's intentional termination oftailscale upis unaffected: the shell still finishes by copying its captured output. -
[P2] Decode the JSON string before returning the sign-in URL (
startos/utils.ts:296). Upstream v1.104.7 uses Go'sjson.MarshalIndentforAuthURL(cmd/tailscale/cli/up.go:774). A valid control-server authorization URL such ashttps://login.example/auth?node=x&state=ytherefore contains\u0026in stdout. The regex currently returns that escaped text verbatim, and its truthiness prevents the already-decoded status fallback from being used. The launch button and QR code then carry the wrong query string. The proposal captures the JSON string token and decodes it withJSON.parse, including escaped quotes/backslashes.
The removal of the unauthenticated web daemon, host retirement, state preservation, task registration and owner-only action access look sound. I also checked upstream's pending-login ownership: stopping the CLI does not cancel daemon-owned authentication. The head merges cleanly into current master; x86 and arm CI builds passed.
Proposed changes: 02925df...proposal/26
The proposal is unexecuted: no build, typecheck, tests or VM run during review. Please verify adopted changes, including a failed logout and a sign-in URL containing JSON escapes.
Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol
Run action commands through execFail, so a failed or timed-out `tailscale logout` (or status rewrite) fails the action instead of reporting success and restarting. Decode the AuthURL JSON string, since Go's encoder escapes `&` as `&` in the printed URL. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Adopted both points from
|
Helix-Harness: pi Helix-Model: openai-codex/gpt-6.1-sol
helix-white
left a comment
There was a problem hiding this comment.
The two earlier findings are fixed correctly in c80bd40: command failures now reject through the shared execFail boundary, and the AuthURL is decoded as a JSON string. The head still merges cleanly into master.
One remaining [P2] finding, also raised by @kwsantiago: preserve a node awaiting device approval when either sign-in action is repeated (startos/utils.ts, signIn). NeedsMachineAuth is a reachable, already-authenticated state with a node key. The helper only protects Running, so repeating Sign In takes the HaveNodeKey → --force-reauth path. Upstream v1.104.7 then calls StartLoginInteractive (cmd/tailscale/cli/up.go:695–696), starting authentication again instead of leaving the pending device alone. Following the sign-in prompt again while waiting for admin approval should not start replacing the identity being approved.
The proposal returns the existing status before invoking tailscale up when it is NeedsMachineAuth. Both actions then reuse their existing Waiting for Approval result, without resetting preferences, consuming an auth key, or starting a fresh login. Switching accounts remains available through Log Out. It records the pending-identity contract at the shared helper and updates README/instructions.
Proposed changes: c80bd40...proposal/26
No build, tests, typecheck or VM run during review; the proposal is unexecuted. Please verify repeat Sign In and Sign In with Auth Key in NeedsMachineAuth preserve the pending device, then approve that device and confirm it reaches Running.
Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Adopted the proposal: |
helix-white
left a comment
There was a problem hiding this comment.
Reviewed 25e980a against the previous review. All three findings are resolved: CLI failures propagate, sign-in URLs are JSON-decoded, and both sign-in actions preserve an existing device awaiting approval. The pending-approval guard precedes all preference changes and auth-key writes, and the contract and user documentation match. No remaining correctness findings. The head merges cleanly into current master.
No builds or tests run during review. Current x86/arm CI builds are still running; the author explicitly records that the approval flow has not been box-tested.
Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol
What changed and why
The package ran
tailscale web --listen 0.0.0.0:8240and exported it as the Tailscale Admin UI interface. On generic Linux, Tailscale's web client applies no login of its own, and its login API can sign the node in to an arbitrary tailnet or control server, or re-authenticate it. So anyone who could reach that interface could take over the node. Upstream's default listen address is localhost-only, and Tailscale fully supports headless sign-in, so this PR stops running the web client and moves sign-in to owner-only StartOS actions.webdaemon and its health check are gone,setupInterfacesexports nothing, and thewebhost is retired in the1.104.7:1migration (sdk.MultiHost.of(effects, 'web').retire()), per the guide's "Retiring a Host or Binding".tailscaleCLI in a temporary subcontainer that mounts themainvolume and talks to the running tailscaled over its socket. All of them need the service running.tailscale up --reset --json --timeout=60s [--login-server=<url>]. The CLI runs in the background and is stopped once it prints theAuthURL(or aNeedsMachineAuthstate). The URL comes back as a copyable, QR and launchable result; if none was printed, it falls back totailscale status's pendingAuthURL. It adds--force-reauthwhen the node still holds a key (expired or previously signed in). It refuses if the node is alreadyRunning.--auth-key=file:/tmp/auth-key. The input is masked, and the key is written into the temp container and never put on the command line.http(s)://URL) for Headscale or another self-hosted control server.tailscale status --json --peers=false. It shows state, tailnet, device name, MagicDNS name, Tailscale IPs, a pending sign-in link, and health warnings.tailscale logout, then it rewritests-status.jsonin place and restarts the service, so serves are re-applied after the next sign-in. It warns before it runs.importanttask points to Sign In wheneverts-status.jsondoesn't recordRunning: a fresh install, an existing install that was never signed in, or after Log Out. It is cleared once the file recordsRunning.--resetis deliberate. Without it,tailscale uprefuses with "requires mentioning all non-default flags" on any node carrying earlier non-default prefs, such as a differentControlURLor an exit node set through the old web UI.tailscale setflags, but the README already describes this userspace-networking node as neither a subnet router nor an exit node, and Tailscale SSH would hand out a shell in the container, so I left them out. Prefs already set stay until the next Sign In resets them.npm install. Release notes open with "Requires StartOS 0.4.2 or later." in every locale.Existing installs
tailscaled.stateon themainvolume, which this change doesn't touch, and its serves keep working.Verification
npx tsc --noEmitis clean.rm -rf javascript && make javascript/index.jsis clean.prettier --checkis clean.cmd/tailscale/cli/up.go,logout.go,ipn/ipnstate).@tobomobo @kwsantiago, could you review this?
review effort: 'high'
🤖 Generated with Claude Code