Skip to content

feat: require a setup token to create the first user on a tunnel (#32324) - #32512

Merged
BobbyHo merged 2 commits into
release/2.34from
backport/32324-to-2.34
Nov 20, 2026
Merged

BobbyHo merged 2 commits into
release/2.34from
backport/32324-to-2.34

Conversation

@coder-backporter-app

@coder-backporter-app coder-backporter-app Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

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.go is 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: the quickstart (docs/tutorials/quickstart.md), Azure and Compute Engine wording is applied to this branch's page layout. The sentences for docs/install/index.md and the RPM page are left out because those pages do not mention the tunnel here.
  • Generated API docs and CLI docs are regenerated with this branch's generators. This branch has no configuration reference page.
  • Setup page: the token rule is added to this branch's validation schema. The test expects the Templates page after setup, as it does on this branch.
  • cli/login_test.go: the prompt test uses ptytest, because testutil/expecter is not on this branch.

@coder-backporter-app coder-backporter-app Bot added the backport/v2.34 Backport PR targeting release/2.34 label Nov 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

👋 Hey @coder-backporter-app[bot]!

This PR is targeting the release/2.34 release branch, but its title does not start with fix: or fix(scope):.

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:

fix: description of the bug fix
fix(scope): description of the bug fix

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)
@BobbyHo
BobbyHo force-pushed the backport/32324-to-2.34 branch from 1fa8f7b to db03a86 Compare November 20, 2026 16:41
@BobbyHo BobbyHo changed the title feat: require a setup token to create the first user on a tunnel (#32324) (conflicts) feat: require a setup token to create the first user on a tunnel (#32324) Nov 20, 2026
@BobbyHo

BobbyHo commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator

/coder-agents-review Please limit the review to P0, P1, and P2 issues only.

@coder-agents-review

coder-agents-review Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Chat: Review posted | View chat
Requested: 2026-11-20 18:34 UTC by @BobbyHo
Spend: $8.71 / $100.00

Review history
  • R1 (2026-11-20): 15 reviewers, COMMENT. Review

deep-review v0.13.0 | Round 1 | 5f678f4..1120029

Last posted: Round 1, no findings, COMMENT. Review

Finding inventory

Findings

# Sev Status Location Summary Round Reviewer Posted

Contested and acknowledged

(none)

Round log

Round 1

Round type: round 1, full panel. Requester limited the review to P0, P1, and P2. Netero first pass: no findings; per-file comparison against #32324 shows server and CLI logic identical, with differences limited to those listed in the PR description. Law not run (effective additions 787, under 1000).
Panel (15): Ging-go, Ging-ts, Ging-react, Kurapika, Nami, Ryosuke, Pen Botter, Luffy, Melody (domain specialists, which pushed the panel over the 9-12 target), Pariston, Mafuuu (core), Bisky (tests changed), Gon, Leorio (once-per-PR floor), Zoro (wildcard).
No findings at P2 or higher from any reviewer. Reviewed against 5f678f4..1120029.
CI at review time: "Analyze PR for Documentation Updates Needed" failed; not inspected because gh had no valid credentials in this workspace.

About deep-review

CRF = Coder Review Finding (P0-P4, Nit, Note)

Reviewer Focus
Bisky tests
Chopper ops/errors
Churn-guard change verification
Ging language modernization
Gon naming
Hisoka edge cases
Killua perf
Kite change integrity
Knov contracts
Knuckle SQL
Komugi flake/determinism
Kurapika security
Law decomposition
Leorio docs
Luffy product
Mafu-san process
Mafuuu contracts
Melody dispatch/pairing
Meruem structural
Nami frontend
Netero mechanical checks
Pariston premise testing
Pen-botter product gaps
Razor verification
Robin duplication
Ryosuke Go arch
Takumi concurrency
Zoro shape

🤖 Managed by Coder Agents.

@coder-agents-review coder-agents-review Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR backports #32324 to release/2.34: a setup token is required to create the first user when coder server opens a try.coder.app tunnel. As requested, the review covered P0 to P2 only, and it found 0 P0, 0 P1, and 0 P2 findings. The server and CLI changes match #32324, and the remaining differences are the ones listed in the description. The targeted Go tests, the SetupPage vitest file, and tsc pass at 1120029.

🤖 This review was automatically generated with Coder Agents.

@BobbyHo
BobbyHo merged commit 31e4e8a into release/2.34 Nov 20, 2026
30 of 31 checks passed
@BobbyHo
BobbyHo deleted the backport/32324-to-2.34 branch November 20, 2026 21:25

This branch had an error being deployed

1 failed deployment
docs-preview — 1120029d Deployed Nov 20, 2026 by BobbyHo via cleanup #317
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/v2.34 Backport PR targeting release/2.34

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants