Skip to content

feat: warn before narrowing a self-registered OAuth2 app's scope allowlist - #29777

Merged
BobbyHo merged 17 commits into
mainfrom
bobby/plat-664-dcr-scope-warning
Sep 24, 2026
Merged

BobbyHo merged 17 commits into
mainfrom
bobby/plat-664-dcr-scope-warning

Conversation

@BobbyHo

@BobbyHo BobbyHo commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

Closes PLAT-664.

Self-registered clients usually request every scope Coder advertises rather than reading the app's allowlist. Narrowing the allowlist for such an app does not narrow what the client asks for, so every new authorization fails with invalid_scope while existing tokens keep their scopes. PLAT-664 proposed refusing the change on the API. This PR warns instead.

  • Expose dynamically_registered on the OAuth2 app response so the UI can tell a self-registered app from an admin-created one.
  • Show a warning in the scope picker when an edit removes scopes from a self-registered app's allowlist. Widening and clearing stay quiet.
  • Add a Registration row to the app page reading "Self-registered" or "Admin created".
  • Document the failure mode under Scopes and link to it from the invalid_scope troubleshooting entry. Remove the stale note that the web UI cannot set the allowlist.

Based on main. Independent of the PLAT-619 stack (#29603).

image image
Verification
Check Result
Go targeted tests, go vet Pass
Biome check, format, TypeScript Pass
Form unit tests 66 passed
Docs lint Pass
Story tests Not run locally, Playwright could not launch a browser in the session

Manual Tests

Scenario summary, 26 of 27 pass

Run on 2026-09-23 against a dev server built from 980355459d. The later head, 54380ef8a8, only merges main and changes none of this PR's files.

# Scenario Result
0a Workspace up, PR checked out, dev server with the provider flag, tunnel; empty apps table Pass
0b Request helpers; admin session is owner; the four scope names used below are advertised Pass
0c Enable DCR, starting value noted (false) Pass
0d Seed four apps: public DCR with scopes, public DCR without, confidential DCR, admin-created Pass
1a dynamically_registered on list and single-app responses: true for the three DCR apps, false for the admin app, always a boolean Pass
1b Admin PUT that omits scope keeps the flag and the allowlist Pass
2a Registration row, admin-created app: Admin-created, plain text, no copy button Pass
2b Registration row, public DCR app: Self-registered Pass
2c Registration row, confidential DCR app: Self-registered, secrets table still shown Pass
3a Clean load of a self-registered app with two scopes: no warning, Update disabled Pass
3b Remove one scope: warning with the expected copy and a Learn more link to #scopes, Update enabled Pass
3c Put the scope back: warning gone, Update disabled Pass
3d Add a third scope: no warning Pass
3e Clear every scope: no warning Pass
3f Replace the list with coder:all: no warning Pass
3g Unrestricted self-registered app, add one scope: warning Pass
3h Admin-created app, remove a scope: no warning Pass
4a Stored name the deployment does not offer, remove it: no warning Pass
4b Same app, keep the unknown name and remove the offered one: warning Pass
4c Whitespace-only stored allowlist, add a scope: no warning Pass
5a Authorize with the full registered list before narrowing: code= Pass
5b Narrow through the UI past the warning: toast, API shows the narrower list, row still Self-registered Pass
5c Authorize with the full list after narrowing: expected invalid_scope Not as expected (see note)
5d Authorize with only the remaining scope: code= Pass
5e Clear the allowlist through the UI, authorize with the full list: code= Pass
6a Docs: Scopes section and cross-references Pass
7a-7b Cleanup: delete the seeded apps, restore the DCR flag Pass

5c is a test design issue, not a bug. The narrowing used in 3b and 5b removes workspace:ssh and keeps coder:workspaces.access, but that composite already grants workspace ssh, and the authorize endpoint compares coverage, not names. So the request was granted. The warning on that edit is the over-warning narrowsAllowlist documents: it cannot see coverage beyond coder:all, so it can warn about a change the server accepts, but never stays quiet about one it rejects. A real narrowing would drop coverage, for example keep workspace:ssh and remove coder:workspaces.access.

Setup and verification commands

The dashboard on :8080 drives every UI scenario from a browser. The API on :3000 is used for seeding, read-backs, and the authorize calls, through a coder port-forward ... --tcp 8080:8080 --tcp 3000:3000 tunnel. The session token is read inside the workspace on each call.

BASE_URL=http://localhost:3000

req() {  # $1=method $2=path $3=json body; body saved to /tmp/plat664-resp.json
  token=$(ssh dev.<workspace> 'cat ~/coder/.coderv2/session' 2>/dev/null)
  curl -s -o /tmp/plat664-resp.json -w 'HTTP %{http_code}\n' -X "$1" "$BASE_URL$2" \
    -H "Coder-Session-Token: $token" -H 'Content-Type: application/json' ${3:+-d "$3"}
}

rows() {  # app rows from the embedded Postgres
  pg "SELECT name, client_type, dynamically_registered, scope FROM oauth2_provider_apps WHERE name LIKE 'plat664-%' ORDER BY name;"
}

authz() {  # $1=client_id $2=redirect_uri $3=scope; POST /oauth2/authorize as the admin with a fresh PKCE pair
  ...
  curl -s -X POST "$BASE_URL/oauth2/authorize?client_id=$1&response_type=code&state=$STATE&code_challenge=$CHALLENGE&code_challenge_method=S256&redirect_uri=...&scope=..." \
    -H "Coder-Session-Token: $token" -w 'HTTP %{http_code} redirect=%{redirect_url}\n'
}

A redirect carrying code= means the scope was granted; error=invalid_scope means the allowlist refused it.

UI scenarios were checked by reading the page before each capture: the Allowed scopes chips, whether an element with role="alert" mentioning "self-registered client" exists, and the disabled state of Update application.

0. Prerequisites and seed data
$ curl -s $BASE_URL/api/v2/buildinfo | jq -c '{version,oauth2_provider}'
{"version":"v2.37.0-devel+980355459d","oauth2_provider":true}

$ req GET /api/v2/users/me
HTTP 200
{"username":"admin","roles":["owner"]}

$ curl -s $BASE_URL/.well-known/oauth-authorization-server | jq -c '.scopes_supported | length'
52
$ (same list) are the four names used below advertised?
{"coder:workspaces.access":true,"workspace:ssh":true,"workspace:read":true,"coder:all":true}

$ req GET /api/v2/oauth2-provider/settings
{"dynamic_client_registration_enabled":false}      (starting value)
$ req PUT /api/v2/oauth2-provider/settings '{"dynamic_client_registration_enabled":true}'
{"dynamic_client_registration_enabled":true}

Seeded four apps, each HTTP 201:

POST /oauth2/register  plat664-dcr-scoped        token_endpoint_auth_method=none, scope="coder:workspaces.access workspace:ssh"
POST /oauth2/register  plat664-dcr-unrestricted  token_endpoint_auth_method=none, no scope
POST /oauth2/register  plat664-dcr-confidential  no auth method (defaults to client_secret_basic), scope="workspace:read"
POST /api/v2/oauth2-provider/apps  plat664-admin-scoped  scope="coder:workspaces.access workspace:ssh"

$ rows
plat664-admin-scoped|confidential|f|coder:workspaces.access workspace:ssh
plat664-dcr-confidential|confidential|t|workspace:read
plat664-dcr-scoped|public|t|coder:workspaces.access workspace:ssh
plat664-dcr-unrestricted|public|t|
1. API field
$ req GET /api/v2/oauth2-provider/apps
HTTP 200
{"name":"plat664-admin-scoped","client_type":"confidential","dynamically_registered":false}
{"name":"plat664-dcr-confidential","client_type":"confidential","dynamically_registered":true}
{"name":"plat664-dcr-scoped","client_type":"public","dynamically_registered":true}
{"name":"plat664-dcr-unrestricted","client_type":"public","dynamically_registered":true}

$ jq -c '[.[] | .dynamically_registered | type] | unique'
["boolean"]

$ req GET /api/v2/oauth2-provider/apps/<scoped>   -> {"name":"plat664-dcr-scoped","dynamically_registered":true}
$ req GET /api/v2/oauth2-provider/apps/<admin>    -> {"name":"plat664-admin-scoped","dynamically_registered":false}

The flag follows how the app was registered, not its client type: both confidential apps are present and only the DCR one is true.

1b, admin PUT without scope:

$ req PUT /api/v2/oauth2-provider/apps/<scoped> '{"name":"plat664-dcr-scoped","callback_url":"http://localhost:9876/callback"}'
HTTP 200
{"name":"plat664-dcr-scoped","dynamically_registered":true,"scope":"coder:workspaces.access workspace:ssh"}
$ req GET /api/v2/oauth2-provider/apps/<scoped>
{"name":"plat664-dcr-scoped","dynamically_registered":true,"scope":"coder:workspaces.access workspace:ssh"}
$ rows | grep dcr-scoped
plat664-dcr-scoped|public|t|coder:workspaces.access workspace:ssh
2. Registration row

Read from the details list on each edit page:

admin-created app       Registration = Admin-created    (no <code>, no copy button)
public DCR app          Registration = Self-registered
confidential DCR app    Registration = Self-registered  (Client secrets section with the registration-issued secret still shown)
<div class="flex items-center gap-2"><dt class="text-sm">Registration</dt><dd class="m-0 text-sm text-content-secondary">Admin-created</dd></div>

Client ID, Authorization URL, and Token URL each keep their <code> value and copy button; the Registration row is last and plain text.

3. Warning in the scope picker

All on plat664-dcr-scoped (stored coder:workspaces.access workspace:ssh) unless noted. Nothing in this section was saved.

3a  clean load                      chips=[coder:workspaces.access, workspace:ssh]  warning=no   update=disabled
3b  remove workspace:ssh            chips=[coder:workspaces.access]                 warning=yes  update=enabled
3c  add workspace:ssh back          chips=[coder:workspaces.access, workspace:ssh]  warning=no   update=disabled
3d  add workspace:read              chips=[..., workspace:read]                     warning=no   update=enabled
3e  remove every chip               chips=[]                                        warning=no   update=enabled
3f  empty, then add coder:all       chips=[coder:all]                               warning=no   update=enabled
3g  plat664-dcr-unrestricted (""),
    add workspace:read              chips=[workspace:read]                          warning=yes  update=enabled
3h  plat664-admin-scoped,
    remove workspace:ssh            chips=[coder:workspaces.access]                 warning=no   update=enabled

3b warning, read from the page:

role:  alert
text:  A self-registered client that requests every advertised scope fails new authorizations with invalid_scope once its allowlist is narrower than that list. Existing tokens keep their scopes. Learn more
order: label, description, alert, picker
link:  https://coder.com/docs/admin/integrations/oauth2-provider#scopes

The link has no /@v<version> segment here because the page was served by Vite, which does not carry the server-rendered build info that docs.ts reads. The path and anchor are correct.

In 3e the warning showed on the way down at one chip and cleared at zero, since an empty allowlist means unrestricted.

4. Names the deployment does not offer

4a and 4b, with an unknown name planted through the admin API:

$ req PUT /api/v2/oauth2-provider/apps/<scoped> '{..., "scope":"workspace:ssh legacy:thing"}'
HTTP 200
{"name":"plat664-dcr-scoped","scope":"workspace:ssh legacy:thing","dynamically_registered":true}
$ curl -s $BASE_URL/.well-known/oauth-authorization-server | jq '.scopes_supported | index("legacy:thing")'
null

4a  load                  chips=[workspace:ssh, legacy:thing]  warning=no
    remove legacy:thing   chips=[workspace:ssh]                warning=no   update=enabled
4b  load                  chips=[workspace:ssh, legacy:thing]  warning=no
    remove workspace:ssh  chips=[legacy:thing]                 warning=yes  update=enabled

4c, whitespace-only allowlist:

$ req PUT /api/v2/oauth2-provider/apps/<unrestricted> '{..., "scope":"   "}'
HTTP 200
$ pg "SELECT name, length(scope) FROM oauth2_provider_apps WHERE name = 'plat664-dcr-unrestricted';"
plat664-dcr-unrestricted|3

load                 picker empty ("Select scopes")  warning=no
add workspace:read   chips=[workspace:read]          warning=no   update=enabled

Same edit as 3g with the opposite result: " " is a configured list that grants nothing, so adding a scope widens it. Both apps were restored afterwards and rows matched the seed output.

5. Authorize before and after narrowing
5a  $ authz <scoped> http://localhost:9876/callback "coder:workspaces.access workspace:ssh"
    HTTP 302 redirect=http://localhost:9876/callback?code=<redacted>&state=...

5b  UI: removed workspace:ssh, warning shown, clicked Update application
    toast:        Successfully updated the OAuth2 application "plat664-dcr-scoped".
    registration: Self-registered
    $ req GET /api/v2/oauth2-provider/apps/<scoped>
    {"scope":"coder:workspaces.access","dynamically_registered":true}

5c  $ authz <scoped> http://localhost:9876/callback "coder:workspaces.access workspace:ssh"
    HTTP 302 redirect=http://localhost:9876/callback?code=<redacted>&state=...     (expected error=invalid_scope)

5d  $ authz <scoped> http://localhost:9876/callback "coder:workspaces.access"
    HTTP 302 redirect=http://localhost:9876/callback?code=<redacted>&state=...

5e  UI: removed the last chip, no warning, clicked Update application, toast shown
    $ req GET /api/v2/oauth2-provider/apps/<scoped>
    {"scope":""}
    $ authz <scoped> http://localhost:9876/callback "coder:workspaces.access workspace:ssh"
    HTTP 302 redirect=http://localhost:9876/callback?code=<redacted>&state=...

Why 5c was granted, from coderd/rbac/scopes.go:

"coder:workspaces.access": {
	ResourceTemplate.Type:           {policy.ActionRead},
	ResourceOrganizationMember.Type: {policy.ActionRead},
	ResourceWorkspace.Type:          {policy.ActionRead, policy.ActionSSH, policy.ActionApplicationConnect},
},

negotiateScope accepts a request once the allowlist covers every requested name, so coder:workspaces.access alone still covers workspace:ssh.

6. Docs

Against docs/admin/integrations/oauth2-provider.md in the checkout:

$ grep -n "web UI cannot\|web UI does not yet"               (no output)
$ grep -n "^## Scopes"
322:## Scopes
$ grep -n "Allowed scopes"
66:   - **Allowed scopes**: Optional. Refer to [Scopes](#scopes).
345:An administrator sets one with the **Allowed scopes** field in the web UI, ...
862:The **Allowed scopes** field on the application page in the web UI makes the same change.
$ grep -n "registration_access_token. can replace or clear"
356:An allowlist set by an administrator also does not hold against the client: the holder of the application's `registration_access_token` can replace or clear it ...
$ grep -n "registered itself and an administrator has since narrowed"
530:  If the application registered itself and an administrator has since narrowed its allowlist, refer to [Scopes](#scopes).

The narrowing paragraph no longer tells the admin to re-register the client; it says only a client that can be configured to request fewer scopes can be narrowed, by whoever operates it. It also says a client "may then request anything that allowlist covers", which matches the 5c result.

7. Cleanup

The apps were deleted through the admin API rather than the edit page's Delete button.

$ for id in <scoped> <unrestricted> <confidential> <admin>; do req DELETE /api/v2/oauth2-provider/apps/$id; done
HTTP 204
HTTP 204
HTTP 204
HTTP 204
$ rows                                                        (no output)
$ req GET /api/v2/oauth2-provider/apps                        []

$ req PUT /api/v2/oauth2-provider/settings '{"dynamic_client_registration_enabled":false}'
{"dynamic_client_registration_enabled":false}

Apps table back to "No OAuth2 applications configured"; DCR back to its starting value.

…wlist

Self-registered clients usually request every scope Coder advertises
rather than reading the app's allowlist. Narrowing the allowlist for such
an app does not narrow what the client asks for, so every new
authorization fails with invalid_scope while existing tokens keep their
scopes. PLAT-664 proposed refusing the change on the API. This takes the
lighter route and warns instead.

- Expose dynamically_registered on OAuth2ProviderApp so the UI can tell
  a self-registered app from an admin-created one.
- Show a warning in the scope picker when an edit removes scopes from a
  self-registered app's allowlist. Widening and clearing stay quiet.
- Add a Registration row to the app page reading Self-registered or
  Admin created.
- Document the failure mode under Scopes and cross-reference it from the
  invalid_scope troubleshooting entry. Remove the stale note that the web
  UI cannot set the allowlist.

Closes PLAT-664
@linear-code

linear-code Bot commented Sep 23, 2026

Copy link
Copy Markdown

PLAT-664

@github-actions

github-actions Bot commented Sep 23, 2026 •

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 23, 2026

Copy link
Copy Markdown
Collaborator Author

/coder-agents-review

@coder-agents-review

coder-agents-review Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Review could not be started (account spend limit)
Requested: BobbyHo

deep-review v0.9.0 | Round 3 | fd5b375..fe90c82

Last posted: Round 3, 29 findings (1 P1, 9 P2, 9 P3, 1 P4, 5 Nit, 4 Note), COMMENT. Review

Finding inventory

Finding inventory: PR #29777

Findings

# Sev Status Location Summary Round Reviewer Posted
CRF-1 P1 Author fixed (931c405) OAuth2AppForm.tsx:271 Warning never fired when an allowlist was imposed on an unrestricted self-registered app R0 Netero Yes
CRF-2 P2 Author fixed (931c405) OAuth2AppForm.stories.tsx:98 Only coverage of the warning was an assertion-free story that passed with the feature deleted R0 Netero Yes
CRF-3 P2 Author fixed (488ca37) oauth2-provider.md:812 Limitations (and :862) still say the web UI cannot set the allowlist, contradicting :345 and :356 R0 Netero Yes
CRF-4 P3 Open (re-raised R3: the new name "submits only the changed fields" is also false; the unchanged icon is submitted) OAuth2AppForm.test.tsx:70 Test named for a dynamically registered client runs on a fixture pinned to dynamically_registered: false R0 Netero; R3 re-raise Gon P3, Chopper Nit Yes
CRF-5 Note Author fixed (726a5ac) db2sdk.go:490 Comment claimed pre-column rows are NULL; migration 000344 backfills false R0 Netero Yes
CRF-6 Note Author fixed (726a5ac) entities.ts:4996 MockOAuth2ProviderAppPublic coupled public client type with self-registration R0 Netero Yes
CRF-7 Note Author fixed (726a5ac) EditOAuth2AppPageView.tsx:195 Registration row had no story or test coverage R0 Netero Yes
CRF-8 P2 Author fixed (40b5e0d) OAuth2AppForm.test.tsx:962 New warning tests assert toBeInTheDocument, an FE1 hard stop; predicate has no FE1-compliant coverage R1 Netero Yes
CRF-9 P3 Author fixed (40b5e0d); remainder acknowledged, panel closed R3 (24/24 evaluating reviewers accept) OAuth2AppForm.tsx:271 Predicate compares scope names while the server compares coverage, so widening to coder:all shows the failure warning R1 Netero Yes
CRF-10 P3 Author fixed (40b5e0d) EditOAuth2AppPageView.stories.tsx:72 Play functions assert the Registration row (:72, :98), which FE1 forbids R1 Netero Yes
CRF-11 Note Dropped by orchestrator (3/3 clean orchestrator runs; Netero's failures were load-bound and hit base tests; no nondeterminism mechanism in the new tests) OAuth2AppForm.test.tsx:950 Intermittent timeouts in OAuth2AppForm.test.tsx under load R1 Netero No
CRF-12 P2 Open oauth2-provider.md:354 Remedy "re-register it with a narrower set of scopes" fails for the client class the paragraph describes, and the admin cannot perform it R3 Mafu-san P2, Mafuuu P2, Pariston P2, Chopper P2, Kite P2, Leorio P2, Pen Botter P2, Razor P2, Hisoka P3, Meruem P3, Robin P3, Zoro P3 Yes
CRF-13 P2 Open OAuth2AppForm.tsx:405 Warning copy repeats the unworkable "re-register it with fewer scopes" remedy R3 Chopper P2, Hisoka P3, Knov P3, Luffy P3, Melody P3, Nami P3, Robin Note Yes
CRF-14 P3 Open OAuth2AppForm.tsx:402 Warning says "scopes you remove" when the admin imposed a first allowlist and removed nothing R3 Chopper P3, Gon P3, Leorio P3, Nami P3 Yes
CRF-15 P2 Open OAuth2AppForm.tsx:284 Rationale comment says clients request "every scope it registered", contradicting the docs and the predicate's empty-allowlist branch R3 Gon P2, Mafu-san P2, Mafuuu P3, Chopper P3, Kite P3, Leorio P3, Razor P3, Zoro Nit Yes
CRF-16 P2 Open oauth2-provider.md:354 Docs present admin narrowing of a self-registered app as a restriction, but the client's RFC 7592 update overwrites or clears it R3 Kurapika P2, Pariston P2, Meruem P3, Razor P3, Ryosuke P3 Yes
CRF-17 P2 Open OAuth2AppForm.tsx:81 Predicate compares raw stored names (unsupported and whitespace-only lists), so it warns on the documented repair path R3 Mafuuu P2, Knov P2, Nami P3, Hisoka P3, Meruem P4, Zoro Note Yes
CRF-18 P3 Open OAuth2AppForm.tsx:287 No story or test covers the dynamically_registered gate; deleting it changes nothing R3 Bisky P3, Chopper P3 Yes
CRF-19 P3 Open provider_test.go:322 No test asserts an admin PUT on a self-registered app keeps dynamically_registered true R3 Bisky Yes
CRF-20 P3 Open entities.ts:5009 MockOAuth2ProviderAppDynamic comment claims it differs only in registration; id, name, URIs, endpoints also differ R3 Gon P2, Robin P3, Zoro P3, Nami Nit Yes
CRF-21 P3 Open EditOAuth2AppPageView.stories.tsx:75 SelfRegistered duplicates DynamicallyRegisteredValues, which now renders "Admin created" R3 Zoro Yes
CRF-22 P3 Open db2sdk.go:490 NOT NULL invariant lives only in a comment; a NULL now shows "Admin created" and silences the warning, which the comment calls safe R3 Knuckle P3, Gon P2, Ryosuke P4, Leorio Nit, Kite Note, Meruem Note Yes
CRF-23 P2 Open PR description Verification table predates three fix commits; "widening and clearing stay quiet" overclaims; no reason given for warn over refuse R3 Mafu-san P2, Leorio P3 Yes
CRF-24 P4 Open tokens.go:64 checkScopeStillCovered comment says only the client can change registered scopes R3 Leorio P3, Melody P4 Yes
CRF-25 Nit Open OAuth2AppForm.tsx:75 "coder:all" literal is untyped against the generated APIKeyScope union R3 Gon Nit, Ryosuke Nit, Meruem Note Yes
CRF-26 Nit Open provider_test.go:296 RegistrationOrigin sits under a validation test and makes a redundant GET R3 Ryosuke Nit, Zoro Nit Yes
CRF-27 Nit Open EditOAuth2AppPageView.tsx:197 "Admin created" should be "Admin-created" to match "Self-registered" R3 Gon Nit, Leorio Nit Yes
CRF-28 Nit Open PR title Title is 74 characters; CONTRIBUTING.md caps it at 72 R3 Leorio Yes
CRF-29 Note Open OAuth2AppForm.tsx:286 Warning keys on registration origin; the failure keys on client behavior R3 Pariston Note, Knov Note Yes
CRF-30 Nit Dropped by orchestrator (name mirrors the API field dynamically_registered and was proposed by the first-pass review in CRF-6; renaming now is churn) entities.ts:5011 MockOAuth2ProviderAppDynamic uses "Dynamic" while stories use "SelfRegistered" R3 Gon No
CRF-31 Note Dropped by orchestrator (reviewer marks it marginal with no change needed) OAuth2AppForm.tsx:81 stored.some could use Set.isSubsetOf R3 Ging-TS No
CRF-32 Note Dropped by orchestrator (same load-bound pattern as CRF-11; Komugi 89/89 at lower load and pinned to 2 cores; new tests are pure) OAuth2AppForm.test.tsx:944 Base tests time out under host load R3 Bisky No
CRF-33 Note Dropped by orchestrator (environment limit, not a finding; Mafu-san and Komugi ran both story files 21/21) OAuth2AppForm.stories.tsx:98 Story tests could not run in Bisky's worktree R3 Bisky No
CRF-34 Nit Open OAuth2AppForm.tsx:66 JSDoc narrates the branches (FE4) and does not say the predicate over-warns and never under-warns R3 Gon P2, Meruem Note Yes

Contested and acknowledged

CRF-9 (P3, OAuth2AppForm.tsx:271) - narrowing predicate compares names, server compares coverage

  • Finding: The warning predicate treated any removed scope name as narrowing, but firstScopeBeyondCeiling accepts a request when the allowlist covers it, so widenings such as workspace:ssh to coder:all showed a warning that new authorizations would fail. Proposed: stay quiet when the next list contains coder:all; open question whether other covering pairs could be handled client-side.
  • Author defense (R2, PRRC_kwDOGkVX1s7ze0O_): narrowsAllowlist now returns false for any list containing coder:all. "Other covering pairs still warn, since the UI cannot see what scopes grant."
  • Panel closure (R3, 24/24 accept): Every reviewer who evaluated it (Bisky, Hisoka, Mafu-san, Mafuuu, Pariston, Chopper, Ging-React, Gon, Kite, Knov, Knuckle, Komugi, Kurapika, Leorio, Luffy, Melody, Meruem, Nami, Pen Botter, Razor, Robin, Ryosuke, Zoro, Takumi) accepted. Verified: ExternalAPIKeyScopes carries names only, so the UI cannot reproduce rbac.FirstScopeNotCovered; the predicate errs one way (a name superset always covers at least as much, so it can over-warn but never miss a real narrowing); the warning never blocks submit; stored all is canonicalized to coder:all before the form sees it. Chopper adds that under the documented client model (requests all of scopes_supported), any allowlist short of full coverage already fails, so the remaining warning is rarely false for those clients. Not covered by this closure: unsupported and whitespace-only stored names (CRF-17), a separate root cause.

Round log

Round 0 (prior session)

Netero-only first pass posted in an earlier session as review PRR_kwDOGkVX1s8AAAABOx2P8Q. Local deep-review state for that round is not available, so its findings are recorded here as R0 with their original IDs (CRF-1 to CRF-7). 1 P1, 2 P2, 1 P3, 3 Notes.

Round 1

Netero-only (second consecutive first-pass round; the panel has not reviewed this PR). Reviewed against 528dd3c..726a5ac.

Prior findings: CRF-1, CRF-5, CRF-6 verified fixed by Netero. CRF-2 and CRF-7 were fixed as prescribed, but both prescriptions conflict with FE1 (.claude/docs/FRONTEND_PATTERNS.md, hard stop on toBeInTheDocument/toBeVisible and on play-function assertions, in force since #29016); the resulting code is raised as CRF-8 and CRF-10. CRF-3 and CRF-4 were posted only in the prior review body, received no author response, and are unchanged at head; re-raised.

New: 1 P2 (CRF-8), 2 P3 (CRF-9, CRF-10). 1 Note dropped (CRF-11).

Orchestrator verification: FE1 text read at head. firstScopeBeyondCeiling (coderd/oauth2provider/authorize.go:114-138) compares coverage, and TestScopesCoverEveryExternalScope (coderd/rbac/scopes_test.go:411) pins that coder:all covers every external scope, confirming CRF-9. OAuth2AppForm.test.tsx ran 86/86 three times in the orchestrator worktree (CRF-11 drop).

Interaction: CRF-8's fix (extract the predicate into a pure function and table-test it) is also where CRF-9's coverage cases belong, and it replaces the four render-based tests that CRF-11 observed timing out under load.

Next round: the consecutive Netero-only cap (2) is reached by R0 plus R1. The CLI counts only local rounds and will not enforce it, so the next orchestrator must skip step 3a and go straight to panel selection.

Round 2 update

BLOCKED. CRF-3 and CRF-4 silent for a second round (no author reply, unchanged at 40b5e0d: docs lines 812 and 862, test name at OAuth2AppForm.test.tsx:69). No review. Churn guard classified CRF-8, CRF-9, CRF-10 as addressed by 40b5e0d with author replies; those fixes are author claims, not yet verified by a reviewer. Reviewed against 726a5ac..40b5e0d.

Observation: across R0 to R2 the author replied to all eight thread-anchored findings and to neither body-only finding (CRF-3 and CRF-4 sit on lines outside the diff, so post folds them into the review body). The author's workflow may only process threads.

CI at 40b5e0d: the Storybook job failed with a Pixel service error (ApiError: HTTP 500, api key lookup failed) while creating the build, before any snapshot comparison. Not caused by this PR.

Next round: the panel is still owed and the Netero-only cap still applies, so skip step 3a and go straight to panel selection once the churn guard returns PROCEED.

Round 3

First panel round. Churn guard PROCEED (CRF-3, CRF-4 addressed in 488ca37; the author replied in a PR comment). Netero skipped per the consecutive first-pass cap (R0, R1). Law not triggered (212 effective additions). Panel: 25 trigger-matched (Bisky, Hisoka, Mafu-san, Mafuuu, Pariston, Chopper, Ging-Go, Ging-TS, Ging-React, Gon, Kite, Knov, Knuckle, Komugi, Kurapika, Leorio, Luffy, Melody, Meruem, Nami, Pen Botter, Razor, Robin, Ryosuke, Zoro) plus wildcards Killua and Takumi (all distilled personas were trigger-matched, so both came from the full pool). Reviewed against fd5b375..fe90c82.

New: 6 P2 (CRF-12, 13, 15, 16, 17, 23), 6 P3 (CRF-14, 18 to 22), 1 P4 (CRF-24), 5 Nit (CRF-25 to 28, 34), 1 Note (CRF-29). CRF-4 re-raised. CRF-9 remainder closed by panel. 4 dropped (CRF-30 to 33).

Cross-check decisions:

  • Convergence: 16 reviewers flagged the re-register remedy. Split by surface into CRF-12 (docs) and CRF-13 (Alert), because each surface needs its own edit and thread. The consequence chain across CRF-12, CRF-13, CRF-16: the PR gives admins no working way to restrict a self-registered client while implying two (re-register, narrow). Kept at P2 each; no reviewer argued P1 and the RFC 7592 overwrite predates the PR.
  • CRF-15 at P2 (Gon, Mafu-san) over P3 (five others). Keep-argument: the comment is the local rationale for the empty-allowlist branch that fixed CRF-1 (P1), and under its model that branch is wrong, so aligning code with the comment reintroduces CRF-1 (Kite, Leorio).
  • CRF-22 at P3, not Gon's P2. Keep-argument for P2: the comment is the only record of an unenforced invariant and this PR makes a violation silently disable the feature. That supports the finding at Knuckle's P3; Gon's specific rewrite ("NULL is unreachable: the column defaults to false") is false, because an explicit NULL from sql.NullBool{} bypasses the DEFAULT (Knuckle).
  • CRF-20 at P3, not Gon's P2. Keep-argument for P2: the comment is false and the full literal lets base-mock changes silently diverge. Downgrade reason: no test or story depends on the claim; consequence is confined to fixture maintenance.
  • CRF-34 at Nit, not Gon's P2. Keep-argument for P2: an exported approximate predicate should state its error direction. Downgrade reason: Leorio, Pen Botter, Robin, and Knuckle cite this JSDoc as honestly documenting the limit; the gap is one clause plus FE4 narration.
  • CRF-24 at P4 (Melody), not Leorio's P3. Keep-argument for P3: this PR's subject is the admin path the comment denies. Downgrade reason: the admin update path (apps.go at 528dd3c) and the Allowed scopes field predate the PR, so the comment was already stale and the PR adds no new contradiction to it.
  • CRF-23 at P2 (Mafu-san) over P3 (Leorio). Keep-argument: the Verification table is the author's only stated evidence and describes a tree three fix commits old, and "widening stays quiet" contradicts the author's own CRF-9 reply.
  • Contradiction: Mafu-san said the dynamically_registered gate is covered by Pixel. Bisky and Chopper checked every story; the orchestrator confirmed no story edits an admin-created app's scopes (CRF-18 stands).
  • Structural alternative (Ryosuke, Pariston, Kurapika): separate an admin-owned ceiling from the client-owned registered scope, or trim grants to the allowlist in negotiateScope. Carried in CRF-16 as a human decision.

Orchestrator verification: coderd/mcp.go:1918-1928 registers without scope and :2065 requests asMeta.ScopesSupported; registration.go:404 writes Scope: scopeAllowlist(req.Scope) on client update; CanonicalScopeList keeps unknown names while grantableScopes drops them; the Alert text at OAuth2AppForm.tsx:402-405; DynamicallyRegisteredValues at EditOAuth2AppPageView.stories.tsx:184 spreads MockOAuth2ProviderApps[0]; CONTRIBUTING.md:282-283 caps titles at 72 and the title is 74.

Next round: churn guard, then Netero (post-panel, advisory), then a panel of at least 2-3 trigger-matched reviewers plus wildcards. Gon and Leorio are mandatory if the Alert copy, docs, or comments change, which CRF-12 to CRF-15 require.

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.

@BobbyHo BobbyHo left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

First-pass review only. These are mechanical findings from a single first-pass reviewer; the full review panel has not yet reviewed this PR and will do so after these are addressed.

The framing is the strongest part of this change. "Warn instead of refuse" is the right call for a failure mode the admin can't see from the edit screen, and the docs section explains the mechanism (client requests scopes_supported, allowlist doesn't shrink the request, Coder rejects rather than trims) better than an API error ever could. The Go side is clean: the new RegistrationOrigin subtest asserts false then true across the two creation paths and cannot pass without the SDK field this PR adds.

1 P1, 2 P2, 1 P3, 3 Notes.

The P1 is that the warning does not fire in the case it most needs to. narrowsSelfRegisteredScopes requires form.initialValues.scope.some(...), and a self-registered app with no stored allowlist gives initialValues.scope === [], so the predicate is always false. An admin imposing an allowlist on an unrestricted self-registered app, which is the default shape of a DCR app that registers without a scope field, gets no warning. The docs this PR adds claim otherwise at line 356.

The P1 and the first P2 are the same defect seen twice: the only coverage of the new conditional is a Storybook play function with no assertion, and it still passes when the feature is short-circuited. A test enumerating the transitions would have caught the empty-allowlist gap.

On the reviewer's verification of that story:

I ran pnpm vitest run --project=storybook .../OAuth2AppForm.stories.tsx: 9 passed. I then short-circuited the feature (const narrowsSelfRegisteredScopes = false && ...) and re-ran: 9 passed again. The story cannot fail when the feature is deleted.

One process note: the PR description lists "Remove the stale note that the web UI cannot set the allowlist" as an intended change, and one of the three instances was removed. The other two now contradict the text this PR adds in the same file.


docs/admin/integrations/oauth2-provider.md:812

P2 [CRF-3] Limitations still says the web UI cannot set a scope allowlist, contradicting two lines this PR adds. (Netero)

The line reads: "The web UI cannot set or change a scope allowlist; declare one at Dynamic Client Registration or set it through the management API, as described under Scopes". The PR adds "Allowed scopes: Optional." to the web UI creation steps (line 66) and "An administrator sets one with the Allowed scopes field in the web UI" (line 345). The same file now states both.

Sibling at line 862: "The web UI cannot change it.", closing the paragraph about fixing an app whose registered scope names unsupported values. Also false; the picker sets any name the deployment offers.

The PR description lists "Remove the stale note that the web UI cannot set the allowlist" as an intended change. It removed one of three instances.

Confirmed: grep -n "web UI" docs/admin/integrations/oauth2-provider.md at head returns both 812 and 862 alongside the new 345 and 356.

The claim was already false at the base commit, but "pre-existing" does not apply here. At base the document did not contradict itself; this PR adds the opposing statement and leaves both in place, so a reader who lands on Limitations or on the DCR fix note is now told the opposite of what Scopes says three hundred lines up. Both are one-line deletions.

🤖

site/src/pages/DeploymentSettingsPage/OAuth2AppsSettingsPage/OAuth2AppForm.test.tsx:62

P3 [CRF-4] Test named "submits edited dynamically registered client values" now runs against a fixture this PR marks as not dynamically registered. (Netero)

The test builds its app from MockOAuth2ProviderApps[0], which site/src/testHelpers/entities.ts:4982 pins to dynamically_registered: false. Before this PR the field did not exist and the name was merely vague; now it makes a claim the fixture contradicts. The test body edits the name and asserts scope is omitted from the payload, which has nothing to do with registration origin.

Confirmed. This PR is what turns a vague name into a false one, and the name now sits next to a real dynamically_registered distinction that a future reader will assume the test covers. Rename it to what it checks (the "omit an untouched allowlist on update" case), or switch the fixture to MockOAuth2ProviderAppPublic.

🤖

🤖 This review was automatically generated with Coder Agents.

Comment thread coderd/database/db2sdk/db2sdk.go Resolved
Comment thread site/src/testHelpers/entities.ts Resolved
…rn when an allowlist is imposed on an unrestricted self-registered app

The narrowing warning compared the new selection against the stored
allowlist with `some`, which is always false when the stored list is
empty. An empty allowlist means unrestricted, so imposing any list on a
self-registered app that had none is the strongest narrowing and is the
default shape of a DCR client that registered without `scope`. Treat a
non-empty selection against an empty stored list as narrowing.

Adds Vitest coverage for the empty-to-list case and for the cases that
must stay silent: clearing the allowlist and editing an admin-created
app.
…ope-warning

# Conflicts:
#	site/src/pages/DeploymentSettingsPage/OAuth2AppsSettingsPage/OAuth2AppForm.tsx
@BobbyHo

BobbyHo commented Sep 23, 2026

Copy link
Copy Markdown
Collaborator Author

/coder-agents-review

…tration row

The public client mock also carried dynamically_registered, so every
test that picked it for the client type became a self-registered case.
Add a confidential self-registered mock that differs from the admin
created mock only in registration origin, and point the scope warning
tests and story at it.

Assert the Registration row text in both edit page stories, and correct
the db2sdk comment: the column has no NOT NULL constraint, but every
write path sets a value, so false is the safe read rather than a legacy
NULL case.
@coder-agents-review

coder-agents-review Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Chat: Review in progress (28/28 reviewers complete) | View chat
Requested: 2026-09-23 17:16 UTC by @BobbyHo

🤖 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-pass review only. These are mechanical findings from a single first-pass reviewer (Netero); the full review panel has not yet reviewed this PR and will do so after these are addressed. This is the second first-pass round, so the next round goes to the panel regardless.

The fixes from the last round landed well. The empty-allowlist case from CRF-1 now warns, and its test fails without the new clause. The CRF-5 comment now matches migration 000344. CRF-6 split the mock so registration origin and client type vary independently.

New this round: 1 P2, 2 P3. Still open from last round: CRF-3 (P2) and CRF-4 (P3).

Two corrections to the previous review. CRF-2 asked for Vitest cases without saying how to assert them, and CRF-7 prescribed a toBeVisible() assertion inside a play function. FE1 in .claude/docs/FRONTEND_PATTERNS.md calls both a hard stop, so the code written to satisfy them comes back as CRF-8 and CRF-10. That mistake is the first pass's, not yours. The underlying asks still stand (predicate coverage that can fail, both Registration states captured), and the FE1 route is a pure-function table test plus assertion-free stories.

CRF-3 and CRF-4 were only in the previous review's body, not in threads, and have no response. Both are unchanged at 726a5ac and both are small. Each needs a fix in this PR or a reply saying why it should stay.

CRF-9 is worth doing together with CRF-8: the predicate compares scope names while the server compares coverage, so widening to coder:all shows a warning that says new authorizations will fail. From Netero:

The test name says "removed", but the scope set it submits is strictly wider than the stored one.

One Netero note (intermittent timeouts in OAuth2AppForm.test.tsx under load) was dropped: the file ran 86/86 three times on a clean worktree, and the failures Netero saw hit tests this PR does not touch.


In reply to PRR_kwDOGkVX1s8AAAABOx2P8Q:

P2 [CRF-3] Still open at 726a5ac, with no response yet. docs/admin/integrations/oauth2-provider.md:812 still reads "The web UI cannot set or change a scope allowlist", and :862 still reads "The web UI cannot change it." Both contradict :345 and :356, which this PR adds, so a reader landing on Limitations or on the DCR fix note is told the opposite of what Scopes says. This finding was in the previous review's body rather than a thread, which may be why it was missed. Needed: fix both lines in this PR, or reply with why they should stay.

🤖

In reply to PRR_kwDOGkVX1s8AAAABOx2P8Q:

P3 [CRF-4] Still open at 726a5ac, with no response yet. OAuth2AppForm.test.tsx:70 is still named "submits edited dynamically registered client values" and still builds its app from MockOAuth2ProviderApps[0] (dynamically_registered: false). With MockOAuth2ProviderAppDynamic now defined next to it, a reader will assume this test covers self-registered apps. The body checks the update payload after a name edit: the name is trimmed, and the untouched redirect URIs and allowlist are omitted. Needed: rename it to what it checks, or reply with why not.

🤖

🤖 This review was automatically generated with Coder Agents.

…tract the scope narrowing predicate and stay quiet for coder:all

The warning compared scope names, but the server compares what scopes
grant, so replacing a scope with coder:all showed a warning on a
widening. Extract narrowsAllowlist as a pure function that treats a
list containing coder:all as never narrowing, and keep the
self-registered gate at the call site.

Replace the render tests, which asserted DOM presence against FE1,
with a table test on the predicate. Add a widening story for the quiet
state and drop the play assertions on the Registration row, which the
screenshots already capture.
@BobbyHo

BobbyHo commented Sep 23, 2026

Copy link
Copy Markdown
Collaborator Author

/coder-agents-review

@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.

Review blocked. Two findings from earlier rounds have gone two rounds with no fix and no reply, so the full panel review is on hold until each gets one.

Both sit on lines outside the diff, so neither has a comment thread; they have only appeared in review bodies. Each needs a fix pushed to this PR, or a reply (a PR comment is fine) saying why it should stay:

  • P2 CRF-3, docs/admin/integrations/oauth2-provider.md:812 and :862. Line 812 says "The web UI cannot set or change a scope allowlist" and line 862 says "The web UI cannot change it." Both contradict :345 and :356, which this PR adds. Deleting or rewriting the two lines resolves it.
  • P3 CRF-4, site/src/pages/DeploymentSettingsPage/OAuth2AppsSettingsPage/OAuth2AppForm.test.tsx:69. The test is named "submits edited dynamically registered client values" but builds from MockOAuth2ProviderApps[0], which is admin created. Renaming it to what it checks (the update payload after a name edit) resolves it.

CRF-8, CRF-9 and CRF-10 have replies and a fix in 40b5e0d; the panel will verify them when the review resumes.

The failing Storybook check is a Pixel service error (ApiError: HTTP 500, api key lookup failed) raised while creating the Pixel build, before any snapshot comparison. It is not caused by this PR.

🤖 This review was automatically generated with Coder Agents.

Two lines in the OAuth2 provider docs still said the web UI cannot set
or change a scope allowlist, contradicting the Scopes section this PR
updated. Drop the Limitations bullet and point the fix paragraph at the
Allowed scopes field.

Rename a form test that claimed to cover a dynamically registered client
but builds from the admin created mock. It checks the update payload
after a name edit.
@BobbyHo

BobbyHo commented Sep 23, 2026

Copy link
Copy Markdown
Collaborator Author

CRF-3 and CRF-4 are fixed in 488ca37. The Limitations bullet is removed and the fix paragraph now points at the Allowed scopes field. The test is renamed to "submits only the changed fields when a name is edited".

@BobbyHo

BobbyHo commented Sep 23, 2026

Copy link
Copy Markdown
Collaborator Author

/coder-agents-review

@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 full panel review (27 reviewers). The core of this PR holds up. narrowsAllowlist is a pure function whose table test fails when any branch is removed. dynamically_registered is written on every create path, and neither admin updates nor client updates change it. The RegistrationOrigin test goes through the real DCR endpoint. CRF-3, CRF-8 and CRF-10 are verified fixed. The panel closed the CRF-9 remainder: the name comparison can over-warn but never miss a real narrowing, and the UI has no coverage data to do better.

6 P2, 6 P3, 1 P4, 5 Nit, 1 Note, plus CRF-4 re-raised (the new test name also misdescribes what the test asserts).

Most of the P2s are about what the PR tells the admin, not what the code does. Sixteen reviewers independently caught the same contradiction: the docs say these clients request every advertised scope, then advise re-registering with fewer scopes, which cannot change what such a client requests (CRF-12 in the docs, CRF-13 in the warning). Coder's own MCP client works this way (coderd/mcp.go:2065). The code comment at OAuth2AppForm.tsx:284 states the other model, the only one under which that advice works (CRF-15). Separately, Kurapika and Pariston each reproduced that a client's RFC 7592 update overwrites or clears an admin-narrowed allowlist, and the new paragraph does not say so (CRF-16). Taken together, the PR gives admins no working way to restrict a self-registered client while implying two. The docs fix is small. The server-side fix (an admin-owned ceiling the client cannot overwrite, or granting the covered subset instead of rejecting) changes behavior and needs a human decision: file a ticket or accept the gap explicitly.

CRF-17 is the one functional bug. The predicate compares raw stored names, so removing an unsupported name, which is the repair this PR's docs now point admins to at line 861, shows a warning that the repair will break the app.

From Ryosuke:

Right now the admin and the client drive the same car from different seats. Each can overrule the other, and neither sees what the other did.

The PR comment answering CRF-3 and CRF-4 is what unblocked this round.


In reply to PRR_kwDOGkVX1s8AAAABO42LAg:

P2 [CRF-23] PR description: the Verification table describes a tree three fix commits old, "Widening and clearing stay quiet" is still stated after the author acknowledged a widening that warns, and the description never says why this PR warns instead of refusing. (Mafu-san P2, Leorio P3)

The table says "Form unit tests: 66 passed". At head the file has 89 tests, and all 89 pass (run above). [...] "Story tests: not run locally, Playwright could not launch a browser" was an honest disclosure at the time. The stories do run in this worktree (21 passed), so the gap could have been closed. (Mafu-san)

It says "PLAT-664 proposed refusing the change on the API. This PR warns instead." and never says why. A reviewer can't get that from the diff, and it's the decision this whole PR rests on. (Leorio)

Mafu-san suggests: "Adding scopes and clearing stay quiet; replacing a scope with a broader one other than coder:all still warns." CRF-16 bears on the missing rationale: refusing on the API would not hold either, because the client can rewrite the allowlist.

🤖

coderd/oauth2provider/tokens.go:64

P4 [CRF-24] The checkScopeStillCovered doc comment says "Only the client can change them, through its RFC 7592 registration", while this PR documents admins changing the same allowlist. (Melody P4, Leorio P3)

The runtime behavior is correct. An admin who narrows the list while a code is still outstanding causes an errStaleScope redemption failure, which the recheck handles. Only the comment is wrong. A later reader will assume the recheck only covers changes made by the client. (Melody)

Rated P4 because the admin update path and the Allowed scopes field predate this PR, so the comment was already stale. Leorio's one-line fix: "The client can change them through its RFC 7592 registration, and an administrator through the management API or the web UI."

🤖

In reply to PRR_kwDOGkVX1s8AAAABO42LAg:

Nit [CRF-28] PR title: feat: warn before narrowing a self-registered OAuth2 app's scope allowlist is 74 characters, and docs/about/contributing/CONTRIBUTING.md:282-283 says "no more than 72". (Leorio)

The squash-merge commit gets this title. Suggestion: feat: warn before narrowing a self-registered OAuth2 app's scopes (65). (Leorio)

🤖

🤖 This review was automatically generated with Coder Agents.

Comment thread coderd/oauth2provider/provider_test.go Resolved
…allowlist

Re-registering a client does not change what it requests, and the admin
cannot re-register a client they do not operate. Say instead that a
client requesting every advertised scope cannot be restricted through
its allowlist, and that the registration token holder can replace or
clear an admin-set allowlist at any time.

Shorten the form's warning to the failure and a link to the Scopes
section, so the explanation lives in one place, and point the code
comment at the same section.
…nore scope names the deployment does not offer when warning about narrowing

The server drops names outside the scope catalog before comparing an
allowlist to a request, so removing such a name changes nothing. The
warning compared raw names and told an admin following the documented
repair that the fix would break the app. A whitespace-only stored value
was also read as unrestricted, although the server treats it as a list
that grants nothing.

Give the predicate the loaded catalog and the raw stored value, filter
both sides to offered names, and treat a stored list that grants
nothing as one any list can only widen.
…capture an admin-created app narrowed without the scope warning

The self-registered gate on the warning had no story or test that would
change if it were removed. Add a story that narrows an admin-created
app's scopes so the quiet state is in the screenshots.
…arning

Move the registration origin test beside its sibling and assert the
flag survives an admin update. Derive the self-registered mock from the
admin created one, mark the existing DCR values story self-registered
instead of adding a second story, and hyphenate Admin-created. Type the
coder:all literal, state which way the narrowing predicate errs, and
say what a NULL registration flag hides.
@BobbyHo
BobbyHo marked this pull request as ready for review September 23, 2026 21:29
@BobbyHo
BobbyHo requested a review from jakehwll September 23, 2026 21:30

@dylanhuff-at-coder dylanhuff-at-coder left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Two comments on the scope warning, lgtm tho :)

…en the scope warning docs link in a new tab

The warning only shows while the scope edit is unsaved. Navigating the
current tab to the docs triggered the leave-page prompt, and continuing
dropped the edit. The link now opens in a new tab and carries a visually
hidden cue for screen readers, matching the navbar support links.
…over swapping one allowed scope for another

The table had rows for removing a scope and for replacing one with
coder:all, but none where the list stays the same length while its
contents change. A length-only check would have passed every row.
@BobbyHo
BobbyHo merged commit c95a87c into main Sep 24, 2026
30 of 31 checks passed
@BobbyHo
BobbyHo deleted the bobby/plat-664-dcr-scope-warning branch September 24, 2026 15:03
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants