Repository navigation
feat: require a setup token to create the first user on a tunnel (#32324) - #32511
Conversation
|
👋 Hey @coder-backporter-app[bot]! This PR is targeting the Only bug fixes should be cherry-picked to release branches. If this is a bug fix, please update the PR title to match the conventional commit format: If this is not a bug fix, it likely should not target a release branch. |
) fix(security): require setup token for first user on tunnels Prevent unauthorized users from claiming Owner access on public `try.coder.app` tunnels before initial setup. - Generate a setup token at startup when using a tunnel with no existing users. - Require the token for first-user creation via the API, web UI, and CLI. - Block GitHub/OIDC first-user signup until setup is complete. - Support custom tokens via `--setup-token` / `CODER_SETUP_TOKEN` and non-interactive CLI setup. - Update development scripts, documentation, and tests. - Preserve existing behavior for deployments with an access URL or existing users. Validated with automated tests and 23/23 manual scenarios using a real tunnel. Refs CORE-784 (cherry picked from commit 88d3494)
0840108 to
15f202a
Compare
|
/coder-agents-review Please limit the review to P0, P1, and P2 issues only. |
|
Chat: Review posted | View chat Review history
deep-review v0.13.0 | Round 1 | Last posted: Round 1, 1 findings (1 P2), COMMENT. Review Finding inventoryFinding inventory: PR #32511Findings
Contested and acknowledgedNone. Law analysisNot run. Effective additions 733, below the 1000 threshold. Round logRound 1Full panel (round 1). Netero first pass: no findings, panel proceeds. Panel of 14: specialists ging-go, ging-ts, ging-react, kurapika, luffy, melody, nami, ryosuke (triggered by Go, TS, TSX, auth endpoints, new config flags, new JSON fields); core pariston, mafuuu; pool bisky (tests changed), gon and leorio (once-per-PR floor); wildcard razor (random from distilled set). Size exceeds the 9-12 target because 8 specialists were triggered. PR comment from @BobbyHo limits the review to P0, P1, and P2. Findings below P2 are recorded here and not posted. CRF-1 kept at P2. Keep-argument: a fully flagged script that worked before the change now fails on a tunnel with an error that names neither the token nor the flag; the username branch at cli/login.go:230 already gives a named non-interactive error, so the codebase treats this message as required. Downward case considered: affects only tunnel deployments with no user created by script, and email and password prompts have the same EOF behavior when their flags are missing. Keep-argument is stronger because this PR adds a new required input to a path that previously completed with the existing flags. CRF-2 downgraded from P2 to P4. Keep-argument: a maintainer could read the comment as a guarantee that any accepted token carries about 142 bits. Downgrade reason: the comment states the capacity of 24 random letters and digits, which is accurate (log2(62^24) is about 142.9); it makes no claim about enforcement, has no runtime effect, and the generated token is 32 characters. Below the requested P0-P2 limit after downgrade. Netero, Ryosuke, Melody verified the production Go is identical to merge commit 88d3494 apart from alignment and the declared ptytest test rewrite. All new tests pass at head per Netero, Bisky, Melody, Ryosuke, Pariston, Nami. About deep-reviewCRF = Coder Review Finding (P0-P4, Nit, Note)
|
There was a problem hiding this comment.
This PR backports the setup token requirement for creating the first user on a try.coder.app tunnel to release/2.29. The production Go code matches #32324 apart from formatting and the declared test rewrite, and the new tests pass at this head. 1 P2. Items below P2 are left out, as the PR comment asked.
🤖 This review was automatically generated with Coder Agents.
Backport of #32324
Original PR: #32324 — feat: require a setup token to create the first user on a tunnel
Merge commit: 88d3494
Requested by: @BobbyHo
The automatic cherry-pick had conflicts. They are resolved by hand; the server and CLI changes are the same as in #32324.
Differences from #32324
scripts/developdoes not exist on this branch, so those changes are left out.scripts/develop.shalways passes an access URL, so it does not open a tunnel.docs/tutorials/quickstart.md), Azure and Compute Engine wording is applied to this branch's page layout. The sentences fordocs/install/index.mdand the RPM page are left out because those pages do not mention the tunnel here.typesGenerated.tsare regenerated with this branch's generators. This branch has no configuration reference page.TextFieldform, with the same validation, submit behaviour and hidden GitHub button. The test file isSetupPage.jest.tsx.cli/login_test.go: the prompt test usesptytest, becausetestutil/expecteris not on this branch.codersdkandcoderdtest.Optionskeep this branch's fields and add the setup token entries.