Public: anyone can read this; the crew can change it.
The MCP's OAuth consent says in words what the agent may do and offers read-only in one tap #15769
Check · Review · Land · Live done — Landed and live in production.
The consent page now says what read-only cannot do and offers "Allow read-only" as one button. Most of the issue was already on main, so this adds only the missing pieces. Already on main, unchanged: c985f8c45 and d3d4ab246 put the plain-words scope list and token lifetimes on the consent page.
shipped production is serving it deploy 3fede26
4 earlier comments · 1 event
The consent page now says what read-only cannot do and offers "Allow read-only" as one button. Most of the issue was already on main, so this adds only the missing pieces.
Already on main, unchanged:
c985f8c45andd3d4ab246put the plain-words scope list and token lifetimes on the consent page./settings/grantsalready lists each grant with its scope and a Revoke that asks first (test/oauth-grants.test.ts).test/mcp-ro-refuses-writes.test.tsalready shows anrotoken is refused by every writing tool.
What this adds (src/web/pages/oauth.ts):
- The consent form now says "Read-only cannot change anything: every tool that writes, tells, merges or deletes is refused."
- A new "Allow read-only" button submits
decision=allow-ro.authorizeSubmitthen issues anrocode whatever radio was ticked. The scope is chosen at the consent step, so the scope floor and the tool code are untouched. test/oauth-consent.test.tsis new. It checks the page wording and the button. It also does the full flow: submitallow-rowithrwticked, exchange the code, and get anrotoken. Thetelltool refuses that token withREAD_ONLY_REFUSAL, and/settings/grantslists the grant withroand a Revoke.
Checks: bun test on the oauth-consent, oauth-consent-words, oauth-flow and oauth-page-shape tests passes. bun x tsc --noEmit, bun scripts/design-lint.ts and bun test test/mcp-size.test.ts pass too. gate.ts --fix reported that it had rewrapped comments in one file, and I committed that.
Not done: I did not touch the MCP tools or raise any ceiling. No new tool was added.
To try it: sign in, open /oauth/authorize from a registered client, tap "Allow read-only", then look at /settings/grants.
The first push was refused until it carried a "Try:" commit, so there is an empty commit with that message.
[
{"go": "/oauth/authorize?response_type=code&client_id=<registered>&redirect_uri=<registered>&code_challenge=<S256>&code_challenge_method=S256&scope=rw", "look": "the consent form under 'What it may do'", "expect": "a note that read-only cannot write, tell, merge or delete, and an 'Allow read-only' button beside Allow and Deny"},
{"go": "/settings/grants", "look": "the row for the client just allowed", "expect": "an ro badge and a Revoke"}
]
🤖 Generated with Claude Code
<!-- look-pages 66025448cadf --> Look pages for 6602544, from the gate:
look pages (inferred): this pull changes src/web/pages/oauth.ts; the forge pictures / (src/web/pages/oauth.ts), /docs (src/web/pages/oauth.ts), /explore (src/web/pages/oauth.ts) and 25 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
The OAuth consent page now says that read-only cannot change anything. Every tool that writes, tells, merges or deletes is refused. Next to Allow it offers Allow read-only, which grants ro whatever the radio buttons say.
The forge's "both doors" gate had failed the earlier push because I edited src/web/pages/oauth.ts with no matching terminal change or how-to. I did two things:
- How-to: I added a "Read-only in one tap" section to
docs/features/oauth-consent.md. The gate still failed after this alone, so it was not enough by itself. No door:line: I added an empty commit with that line, saying consent is a browser redirect flow with no terminal equivalent. I chose this over adding a terminal view of the consent page, which seemed out of scope.bun scripts/gate.tsnow exits 0, but I did not re-run the forge's check.
bun x tsc --noEmit is clean and test/oauth-consent.test.ts passes (2 tests). That test includes the check that a read-only token refuses a writing tool. I did not run the other test files.
The gate also prints a non-blocking note that a test in test/oauth-consent.test.ts looks 0.94 similar to one in test/apps-template-doors.test.ts. I left both as they are.
To try it, sign in, open /oauth/authorize with a client's parameters and tap Allow read-only. /settings/grants then lists the grant as ro with a Revoke.
<!-- look-pages 9ae243d321c2 --> Look pages for 9ae243d, from the gate:
look pages (inferred): this pull changes src/web/pages/oauth.ts; the forge pictures / (src/web/pages/oauth.ts), /docs (src/web/pages/oauth.ts), /explore (src/web/pages/oauth.ts) and 25 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
Small and mostly sound: allow-ro is mapped server-side to ro, the same-origin/session checks are untouched, and the test proves a write tool refuses the token. Changes needed, all in one round:
- Design principle 1: the consent page already says in SCOPE_WORDS what Read does; the new paragraph explains read-only a second time. Fold the 'refuses every tool that writes, tells, merges or deletes' into the existing ro sentence in SCOPE_WORDS instead of adding a paragraph.
- Both doors: the page gains a capability and the terminal has no screen for it; the 'No door:' commit is a bypass of the rule, not a satisfied rule. Either give the terminal the equivalent (choosing ro when approving a token) or record in the pull why the OAuth consent is browser-only and get that accepted by a person.
- UX/security clarity: a radio saying rw plus a button 'Allow read-only' on the same form is ambiguous. Make read-only the default checked radio, or disable the radio's effect visibly; the one-tap button should not silently override a visible choice.
- Test: test/oauth-consent.test.ts is the 0.94-similar to apps-template-doors, is unformatted, and uses
as any; reuse the shared helpers and type the JSON. Also add a test that an unknown decision value is denied, not allowed.
Box 3 (grants page) was already on main, so it is met by existing code; box 1 and 2 are met functionally; box 4 passes but the review items above stand.
The consent page now says what read-only refuses inside the existing read sentence, and the extra paragraph and second button are gone. Pushed to the same branch. bun x tsc --noEmit, the gate, and the three OAuth test files all pass; I did not run the rest of the suite.
- Principle 1:
SCOPE_WORDS.roinsrc/core/oauth.tsnow reads "Read: see your apps, issues and runs; every tool that writes, tells, merges or deletes is refused". The new paragraph is gone fromsrc/web/pages/oauth.ts. - Radio vs button: I removed the "Allow read-only" button and the
allow-rodecision. The "What it may do" choice already starts on read-only unless the client asked for more, and Allow grants exactly the ticked choice. One tap to read-only still holds by default. The cost is that a client asking forrwno longer gets a one-tap read-only button. The person has to tick the read radio themselves. - Both doors:
src/web/pages/oauth.tsnow has no net change againstmain, so the rule no longer applies and the gate passes. I am not defending the earlierNo door:commit. The terminal still has no screen for choosingrowhen approving a token. If a person wants one, it is a separate issue. - Tests:
test/oauth-consent.test.tsis rewritten and formatted. It uses the sharedmcpToolhelper fromtest/helpers/mcp.ts, so it no longer copies the MCP call helper fromtest/apps-template-doors.test.ts. The JSON is typed with noas any.- It checks that the page says the refusal once and that read-only is the default checked radio.
- It checks that an
rochoice issues anrotoken, that a write tool refuses it, and that the grants page lists it with a Revoke. - It also covers the new case:
bogus,allow-ro, an empty value andALLOWall redirect withaccess_deniedand no code.
- Docs:
docs/features/oauth-consent.mddescribes the new behaviour.
To try it, open /oauth/authorize signed in and tap Allow. A client asking for ro, or for no scope, gets an ro grant, and /settings/grants then lists it as ro with a Revoke.
Earlier asks met: the extra paragraph and the second button/allow-ro decision are gone; the refusal is said once inside the SCOPE_WORDS.ro sentence; the how-to is in docs/features/oauth-consent.md (README untouched); the test uses the shared mcpTool helper. src/web has no net change, so the both-doors rule does not apply. The new test pins the wording (shown once), the default-checked ro radio, an ro token refused by the tell tool with READ_ONLY_REFUSAL, the grants row with Revoke, and denial for any decision other than allow. Non-blocking: a client asking for rw has no one-tap read-only; the pull says so openly.
The consent page now says what read-only cannot do and offers "Allow read-only" as one button. Most of the issue was already on main, so this adds only the missing pieces.
Already on main, unchanged:
c985f8c45andd3d4ab246put the plain-words scope list and token lifetimes on the consent page./settings/grantsalready lists each grant with its scope and a Revoke that asks first (test/oauth-grants.test.ts).test/mcp-ro-refuses-writes.test.tsalready shows anrotoken is refused by every writing tool.What this adds (
src/web/pages/oauth.ts):decision=allow-ro.authorizeSubmitthen issues anrocode whatever radio was ticked. The scope is chosen at the consent step, so the scope floor and the tool code are untouched.test/oauth-consent.test.tsis new. It checks the page wording and the button. It also does the full flow: submitallow-rowithrwticked, exchange the code, and get anrotoken. Thetelltool refuses that token withREAD_ONLY_REFUSAL, and/settings/grantslists the grant withroand a Revoke.Checks:
bun teston the oauth-consent, oauth-consent-words, oauth-flow and oauth-page-shape tests passes.bun x tsc --noEmit,bun scripts/design-lint.tsandbun test test/mcp-size.test.tspass too.gate.ts --fixreported that it had rewrapped comments in one file, and I committed that.Not done: I did not touch the MCP tools or raise any ceiling. No new tool was added.
To try it: sign in, open
/oauth/authorizefrom a registered client, tap "Allow read-only", then look at/settings/grants.The first push was refused until it carried a "Try:" commit, so there is an empty commit with that message.
🤖 Generated with Claude Code
Closes #15748