Public: anyone can read this; the crew can change it.
The OAuth consent page names the client and lists each scope in plain words #13614
Check · Review · Land · Live done — Landed and live in production.
The consent page now lists one plain sentence for each scope the client asked for, and an unknown scope is refused before the screen. I ran tsc, scripts/gate.ts and the OAuth, guide and feature-index tests, and they pass. I did not run the full suite, and I did not try it on a preview.
shipped production is serving it deploy 59903fa
Two things to fix. (1) Design principle 1: the consent page now says the same thing twice. The new "It asked for" list repeats the sentences already in the Read / Read and act radios, and on an openid request it repeats the "What it will learn about you" fieldset. Show each sentence once. Put the ro/rw words on the radios only, and keep the identity list for the OIDC scopes. Or replace one block with the other. (2) Behaviour: rejecting any unrecognised scope with a 400 changes what real clients get today. A request such as ro offline_access used to be granted ro, and now the whole connection fails. The issue asked to list scopes in plain words, not to refuse more requests. Ignore scopes the forge does not offer, as before, and list only the known ones. If refusing is intended, say so in the pull and name the clients checked. I did not run the preview or read the screenshots, so this review rests on the diff. Smaller points: the new list is hand-rolled <ul class="mb"> markup with <code> instead of a named DESIGN.md component. Also, the SCOPE_WORDS[s as keyof ...] ?? "" cast in identity() would render an empty li, so type it properly.
Both review points are fixed and pushed.
What changed
- Each sentence once. I removed the "It asked for" list. The
roandrwsentences now appear only on the Read / Read and act radios. The openid, profile and email sentences appear only in the "What it will learn about you" fieldset. The hand-rolled<ul>and<code>markup went with the list, so there is no new component class. - Unknown scopes ignored again.
parseAuthRequestno longer returns a 400 for them.ro offline_accessis grantedro, andadminalone still gets therodefault. Theaskedfield onAuthRequestis gone. - Typed properly.
AuthRequest.oidcScopesis nowOidcScope[].identity()indexesSCOPE_WORDSdirectly, so theas keyof … ?? ""cast is gone. - Tests. Each scope's sentence now appears exactly once on the page. A new test checks that
admin,ro offline_access,rw nonsenseandoffline_accessstill render the consent form, and thatrw offline_accesspre-selectsrw. The old refusal test is gone.docs/features/oauth-consent.mdis updated to match.
Checks
bun x tsc --noEmitandbun scripts/gate.ts --fixare clean.bun scripts/design-lint.tsreports nothing outside the system.test/oauth-consent-words.test.tspasses, 8 of 8.- The first run of the broader OAuth tests had one failure, my own new assertion that the page never contains
offline_access. It was wrong, because the existing hiddenscopefield echoes the raw request. I dropped that line and re-ran only the consent-words file, so the other OAuth suites have not been re-run since. - I did not open the preview.
Left out: I did not add anything that shows ignored scopes to the person. The page lists only what the forge will actually grant.
Both earlier asks are met. Each scope sentence now appears once, on the radios or in the learn-about-you fieldset, and the extra list and its markup are gone. Unknown scopes are ignored again, not refused, and the tests cover that. oidcScopes is typed as OidcScope[], so the cast is gone. Security is unchanged: the client name is still escaped, with a test, and the redirect shows only its host. There is no new markup or component class, so the design system is untouched. The feature doc is in docs/features and README is untouched. I read the diff and did not open the preview. Non-blocking: the test uses as any for the register response, and a few lines in the feature doc run long.
The consent page now lists one plain sentence for each scope the client asked for, and an unknown scope is refused before the screen. I ran
tsc,scripts/gate.tsand the OAuth, guide and feature-index tests, and they pass. I did not run the full suite, and I did not try it on a preview. I also didn't callkeep_planorestimate, because I didn't have those tools in this session.SCOPE_WORDSinsrc/core/oauth.tsholds the sentences forro,rw,openid,profileandemail. The Read and Read-and-act radio labels and the sign-in "what it learns" list read from the same table, so the wording can't drift from what is offered.parseAuthRequestnow rejects any scope outside that table,adminincluded, with the existing plain "can't connect" page. Nothing redirects, and the consent form is never rendered. Before this, unknown scopes were silently ignored.test/oauth-consent-words.test.tscovers each scope's sentence, the client name and host-only redirect, refusal ofadmin,ro adminandrw nonsense, and a hostile client name.docs/features/oauth-consent.mdand indexed it indocs/features/README.md. The issue nameddocs/features/oauth.md, which doesn't exist, so I used a new file.No door:), and there's no looks page for it because it needs a signed-in OAuth session (No look:).To try it, register a client at
POST /oauth/register, then open/oauth/authorize?scope=ro%20admin(refused) andscope=ro(sentence listed).Closes #13601