Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: add the CODER_OAUTH2_PROVIDER_ENABLE deployment flag - #29248

Open
BobbyHo wants to merge 3 commits into
mainfrom
coder-plat-492-oauth-opt-in-flag
Open

feat: add the CODER_OAUTH2_PROVIDER_ENABLE deployment flag#29248
BobbyHo wants to merge 3 commits into
mainfrom
coder-plat-492-oauth-opt-in-flag

Conversation

@BobbyHo

@BobbyHo BobbyHo commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

TL;DR

First of five for PLAT-492. Adds CODER_OAUTH2_PROVIDER_ENABLE, an opt-in flag for Coder's OAuth 2.1 authorization server. Off by default. Nothing reads it yet, so there is no behavior change.

PR What it does
this Adds the flag, a public build info field, and the test default. No behavior change.
#29251 Gates the OAuth2 routes and dashboard navigation on the flag instead of the oauth2 experiment.
#29257 Makes the oauth2 experiment a no-op with a startup warning.
next Logs the provider state and any registered apps at startup.
next Docs.
  • No migration. The flag is not hidden, so it shows up in coder server --help and the CLI reference.

Implementation Details

The flag

  • --oauth2-provider-enable, CODER_OAUTH2_PROVIDER_ENABLE, YAML oauth2.provider.enable. Default false.
  • Lives in a new Provider group under OAuth2, beside the GitHub login group. The OAuth2 group description now covers both; it used to describe only GitHub login.
  • Opt-in and static, following the security team's call on PLAT-623: default on would turn OAuth2 apps back on for deployments that had turned the experiment off.

Build info

  • Adds oauth2_provider to /api/v2/buildinfo and the embedded page metadata. The dashboard will read it to show or hide OAuth2 navigation once the next PR stops reporting the experiment. It reveals nothing the discovery endpoint's 200 vs 404 does not.

Test default

  • coderdtest.DeploymentValues turns the flag on. Every OAuth2 test currently passes the experiment gate through the dev build bypass, and the new gate will have no bypass. Landing the default first means the next PR arrives with the suite already green. A test that wants the provider off passes a mutator.
Tests
  • TestBuildInfo asserts the field is true under the test default. TestBuildInfoOAuth2ProviderDisabled asserts false when a test turns it off.
  • Golden files cover the help text and the YAML config shape.
  • Two frontend fixtures gain the new field because the generated type requires it. No test logic changed.

Add an opt-in deployment flag for Coder's OAuth 2.1 authorization server.
The flag is off by default and nothing reads it yet; a follow-up moves the
OAuth2 routes and dashboard navigation off the oauth2 experiment and onto
this flag.

- Add oauth2.provider.enable (--oauth2-provider-enable,
  CODER_OAUTH2_PROVIDER_ENABLE) under a new Provider group beneath OAuth2,
  and reword the OAuth2 group so it covers more than GitHub login.
- Add oauth2_provider to the build info response so the dashboard can read
  the provider state without an admin-only config request.
- Turn the flag on by default in coderdtest so existing OAuth2 tests keep
  working once the routes are gated on it.
- Regenerate API docs, TypeScript types, the CLI reference, and golden files.

Part of PLAT-492.
@linear-code

linear-code Bot commented Sep 11, 2026

Copy link
Copy Markdown

PLAT-492

@github-actions

Copy link
Copy Markdown
Contributor

Docs preview

Check off each page once it's been reviewed. If a page changes in a later push, its checkbox clears automatically so it gets a fresh look. Pages not yet wired into the docs navigation aren't listed here.

@BobbyHo

BobbyHo commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

/coder-agents-review

@coder-agents-review

coder-agents-review Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Chat: Review in progress (18/18 reviewers complete) | View chat
Requested: 2026-09-11 20:36 UTC by @BobbyHo

deep-review v0.9.0 | Round 1 | d5fcd99..ad2d849

Last posted: Round 1, 7 findings (1 P2, 2 Nit, 4 Note), COMMENT. Review

Finding inventory

Finding inventory - PR #29248

Findings

# Sev Status Location Summary Round Reviewer Posted
CRF-1 P2 Open codersdk/deployment.go:2713 Flag help text promises enable/404 gating the flag does not perform this PR R1 Hisoka P2, Mafu-san P2, Leorio P2, Luffy P2, Chopper P2, Kite P2, Zoro P2, Mafuuu P3, Kurapika P3 Yes
CRF-2 Note Open codersdk/deployment.go:5129 buildinfo OAuth2Provider doc claims to report server-enabled but reports only the flag; diverges from reachability during experiment window R1 Mafuuu, Chopper, Kurapika, Luffy, Zoro, Pariston Yes
CRF-3 Nit Open coderd/coderdtest/coderdtest.go:1864 Comment claims flag makes OAuth2 routes reachable; routes still reach via experiment dev bypass R1 Hisoka, Pariston, Ryosuke, Kurapika Yes
CRF-4 Nit Open coderd/coderd.go:776 Reads options.DeploymentValues while sibling fields read api.DeploymentValues R1 Ryosuke, Kite Yes
CRF-5 Note Open site/src/testHelpers/entities.ts:251 MockBuildInfo default oauth2_provider:true will silently exercise enabled branch once a consumer lands R1 Nami Yes
CRF-6 Note Open codersdk/deployment.go:983 OAuth2ProviderConfig sits beside similarly named OAuth2ProviderSettings; disambiguate R1 Pariston Yes
CRF-7 Note Open coderd/coderdtest/coderdtest.go:1866 Suite-wide default-on hides negative-path regressions once route gating moves to the flag R1 Kite, Ryosuke, Kurapika Yes

Round log

Round 1

Netero-only first pass: no findings, mechanical floor clean. Panel of 17 (Bisky, Hisoka, Mafu-san, Mafuuu, Pariston, Gon, Leorio, ging-go, ging-ts, Luffy, Nami, Chopper, Kurapika, Komugi, Ryosuke, Kite, Zoro). 1 P2, 3 Note, 2 Nit, 1 Note. No P0/P1. Event COMMENT. Reviewed against d5fcd99..ad2d849.

Convergence: 9 reviewers independently raised CRF-1 (flag help text overpromise), 7 at P2. Higher-severity tiebreaker sets P2. No structural, security-exposure, test-authenticity, determinism, or performance defects found (Bisky, Komugi, Gon, ging-go, ging-ts, Nami: no findings). The panel confirms the flag/buildinfo/test-default wiring is correct and proportional; the sole substantive defect is documentation that describes a later PR's behavior as current.

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.

First-of-five for PLAT-492: adds the CODER_OAUTH2_PROVIDER_ENABLE deployment flag, a public build-info field, and a coderdtest default. The wiring is clean and proportional. The flag lives in a new Provider group beside the GitHub login group, the build-info field follows the existing boolean pattern (Telemetry, WorkspaceProxy), and the value is snapshotted once at boot, which is correct for a static flag. Both directions of the new field are tested (TestBuildInfo asserts true under the coderdtest default, TestBuildInfoOAuth2ProviderDisabled asserts false via a mutator), and the generated golden/swagger/typesGenerated/docs are consistent with make gen. Six reviewers found nothing (Netero, Bisky, Gon, ging-go, ging-ts, Komugi, Nami), confirming no structural, mechanical, determinism, or test-authenticity defects.

Severity count: 1 P2, 2 Nit, 4 Note. No P0/P1.

The one substantive issue is convergent: nine reviewers independently flagged that the flag's operator-facing help text (CRF-1) documents behavior this PR does not implement. The description states "Enable the OAuth 2.1 authorization server... When disabled, the OAuth2 endpoints and discovery documents return 404," but nothing in this commit reads OAuth2.Provider.Enable to gate a route; the OAuth2 and discovery routes still gate solely on the oauth2 experiment. Because the flag is not hidden, that text ships now in coder server --help, the CLI reference, the config reference, and the YAML golden. The commit body is honest ("nothing reads it yet"), but the --help reader never sees the commit body. Under the no-follow-up assumption this is a standing operator-facing control whose documented effect is fiction. Not a runtime defect, so P2 rather than higher, but it is the one thing to fix before merge: reword the help to describe current reality (reserved / not yet gating routes) or land the route gate in this PR.

Process note: the PR TL;DR says "Nothing reads it yet, so there is no behavior change." That is imprecise. The PR additively changes the public /api/v2/buildinfo response by adding oauth2_provider. The Implementation Details section discloses this, so it is not concealment, just a TL;DR worth tightening.

Bisky, on the tests: "Not fifty outfits, two honest cases."

🤖 This review was automatically generated with Coder Agents.

Comment thread codersdk/deployment.go
Comment thread codersdk/deployment.go
Comment thread coderd/coderdtest/coderdtest.go
Comment thread coderd/coderd.go Outdated
Comment thread site/src/testHelpers/entities.ts
Comment thread codersdk/deployment.go
Comment thread coderd/coderdtest/coderdtest.go
Read the build info flag value through api.DeploymentValues like the
neighbouring fields, and distinguish OAuth2ProviderConfig from
OAuth2ProviderSettings in its doc comment.
@BobbyHo
BobbyHo marked this pull request as ready for review September 11, 2026 22:12
@coderagents

coderagents Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Documentation Check

Updates Needed

  • codersdk/deployment.go:2718 (flag help text, rendered into coder server --help, the CLI reference at docs/reference/cli/server.md and the auto-generated config reference at docs/admin/setup/configuration-reference.md) - The help text states "When disabled, the OAuth2 endpoints and discovery documents return 404", but this PR does not read OAuth2.Provider.Enable to gate any route. The OAuth2 authorization-server and discovery routes still gate solely on the oauth2 experiment (coderd/coderd.go, RequireExperimentWithDevBypass(api.Experiments, codersdk.ExperimentOAuth2, ...)). The flag is not hidden, so this description ships now and tells operators about behavior this PR does not implement. Reword to describe current reality, e.g. "Enable Coders own OAuth 2.1 authorization server... Reserved for use once the routing gate lands. Disabled by default."

Everything else this PR adds is auto-generated from the Go definitions (CLI reference, config reference, swagger, codersdk.OAuth2ProviderConfig schema, BuildInfoResponse.oauth2_provider example and table). The generated docs match the new code, so no further updates are needed.


Automated review via Coder Agents

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant