Repository navigation
feat: require a setup token to create the first user on a tunnel (#32324) - #32514
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)
b7fc77e to
3f6ab7f
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, no findings, COMMENT. Review Finding inventoryFinding inventory: PR #32514Findings
Contested and acknowledgedCross-check notes
Round logRound 1Full panel (round 1). Netero first pass: 1 P3, 1 P4, 1 Nit, 1 Note; no P0, panel proceeded. Law not run (effective additions 771 < 1000). Panel of 15: specialists ging-go, ging-ts, ging-react, kurapika, nami, ryosuke, luffy (new config flags), pen-botter (docs), melody (JSON fields across Go/TS); core pariston, mafuuu; pool bisky (tests), gon, leorio (once-per-PR floor); wildcard zoro (shuf). Exceeds the 9-12 target because nine specialists triggered. Result: no P0-P2 after cross-check. 5 P3, 4 P4, 5 Nit withheld per requester scope. Reviewed against 3e5fbd7..4836b66. About deep-reviewCRF = Coder Review Finding (P0-P4, Nit, Note)
|
There was a problem hiding this comment.
This backport requires a setup token to create the first user on a try.coder.app tunnel, through POST /users/first, GitHub and OIDC sign-up, the setup page, and coder login. No P0, P1, or P2 findings. The server, CLI, and frontend changes match #32324 line for line except cfg.password in scripts/develop/main.go, and the new Go and frontend tests pass at this head. As requested, 14 findings at P3 and below are not posted.
Out of scope (needs a ticket or explicit acceptance by a human):
coderd/users.go:188:postFirstUserreads the user count outside a transaction, so two concurrent requests that both pass the check can each create an owner. On a tunnel, both requests now need the setup token.docs/admin/setup/index.md:20: the Tunnel section does not say that the first user needs the setup token printed at startup, so a reader who starts there gets a 403 on the setup page without knowing why.docs/install/docker.md:159: this page points proof-of-concept users to the tunnel and does not mention the setup token, with the same result.
Notes:
- This is a
feat:change onrelease/2.37. In a patch release, a script that callsPOST /users/firstagainst a tunnel deployment now gets 403 until it sends the token. A human needs to accept the cherry-pick under the release-branch policy and add a release note that namesCODER_SETUP_TOKEN.
🤖 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/develop: keeps this branch's password handling and adds only the setup token.password_test.gois left out because it comes from fix: generate per-instance dev passwords and remove the shared default #32283, which is not on this branch.docs/install/index.mdand the RPM page are left out because those pages do not mention the tunnel here.coderdtest.Optionsand thecodersdkoption test keep this branch's fields and add the setup token entries.