Repository navigation
feat: sign in with a pre-authorized auth key - #172
Merged
Merged
Conversation
Add a "Use an auth key" option to the login view. The extension sends the key to the helper with a new login-auth-key command. The helper hands it to the backend for the current profile only and registers without a browser login URL, the same way tsnet uses TS_AUTHKEY on first start, but scoped to one browser profile instead of the user's whole environment. The key is never written to storage, prefs, or logs. If the coordination server rejects it, the helper reports the rejection with the key redacted and resets the control client so the key is not retried. Older helpers do not advertise supportsAuthKeyLogin, so the option stays hidden until the helper is updated. Closes #154
sendMessage logged the whole message when the background port was disconnected. With auth key sign-in that would print the key to the popup console, and send-file messages would dump file data. Log the message type only. Flagged by CodeQL on #172.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #154
What
Adds a "Use an auth key" option to the login view. Pasting a pre-authorized (optionally tagged) key registers the current browser profile without a browser login page. This covers the case in #154: machines where users can't install the Tailscale app and shouldn't need their own Tailscale account.
Today the only way to do this is setting
TS_AUTHKEYin the user environment, which applies to every browser profile and every tsnet program for that user. This scopes the key to one profile.How
host/authkey_login.go): newlogin-auth-keycommand. Only accepted while the profile is inNeedsLogin. It callsStartwith the key, thenStartLoginInteractive, the same sequence tsnet uses forTS_AUTHKEYon first start. A watcher on the IPN bus reports a rejection or a 30s timeout. On rejection, the control client is reset so the key is dropped and not retried.supportsAuthKeyLogininprocRunning. Older helpers don't, so the option stays hidden until users update.Key handling
Testing
testcontrolwithRequireAuthKey: a wrong key returns a redacted rejection and leaves the profile logged out, then the right key reachesRunningwith no auth URL andWantRunning=true. Passed 8 repeated runs under-race.go test -race ./...,pnpm typecheck,pnpm test, andpnpm buildall pass.Not yet tried against real Tailscale or Headscale, and the form hasn't been checked in a real browser.