Cloudflare Optional OAuth Scopes Make Consent Narrower, Not Automatically Safe
Cloudflare now lets users decline optional OAuth scopes for Wrangler and MCP clients, but required permissions, token handling, and tool behavior remain separate risks.
Cloudflare now lets people decline optional OAuth permissions when authorizing Wrangler or the Cloudflare API Model Context Protocol (MCP) server. The access token contains only the scopes they approved. That is a useful least-privilege control, especially when an agent client can invoke tools beyond the task in front of it.
It is not automatic least privilege. Cloudflare still selects the full requested set by default, required scopes cannot be turned off at consent, and the client must inspect the granted scopes instead of assuming that every request succeeded. The operational test is therefore simple: decline every permission the immediate task does not need, then prove that allowed work still succeeds and denied work stops cleanly until the user deliberately reauthorizes.
Optional scopes change the grant, not the client’s trustworthiness
Cloudflare’s August 22 changelog applies the new consent controls to Wrangler and the Cloudflare API MCP server. Its broader OAuth release explanation adds two details that matter to implementers.
First, required and optional labels are evaluated only among the scopes requested in that authorization flow. A client configured for four capabilities might request two for a narrow task; only those two appear and are classified for that grant. Second, the token response reflects the user’s actual selection. A client that requested four scopes but received two must operate with two, not treat the difference as an authorization-server error.
Those official pages establish the announced behavior, but they do not provide independent compatibility results for current Wrangler or MCP client combinations. The matrix below is therefore an acceptance test to run, not a claim that every existing client already handles a partial grant correctly.
There are three separate decisions:
| Decision | Who controls it | What to verify |
|---|---|---|
| Which scopes the client can request | Client owner, when configuring the OAuth client | The configured set contains no capability outside the product’s documented purpose |
| Which configured scopes are required | Client owner | Only the smallest capability set needed for the client to start and explain itself is mandatory |
| Which requested optional scopes enter this grant | Person authorizing the flow | The consent screen matches the current task, and the application records the returned scope set without recording the token |
The feature mainly improves the third decision and gives client owners a mechanism for the second. It cannot rescue a client that labels broad write access as required. Cloudflare’s client configuration guide says all selected scopes are required by default; the owner must explicitly mark a subset optional.
Wrangler exposes a related but distinct control. Its command documentation lets the operator request a chosen scope set at login, but uses all available scopes when no scope flags are provided. Requesting fewer scopes narrows what reaches consent. Deselecting an optional scope narrows what the authorization server grants. A least-privilege review should test both paths rather than treating the new consent screen as a substitute for a narrow request.
A declined scope tests the client as much as the authorization server
The difference between requested and granted scopes is expected under partial consent. The consequential question is whether the client derives its available tools from the returned grant or assumes that every requested permission was approved. A well-behaved client can keep its base function, hide the unavailable action, and make any later authority increase visible through reauthorization. A poorly behaved one can turn a user choice into a generic error, a partial side effect, or a silent attempt to regain broader access.
Client visibility does not settle that question. Cloudflare says private clients can be authorized only by members of the parent account. Public clients require publisher-domain verification, but Cloudflare’s authorization guide cautions that domain verification establishes control of the displayed domain—not that the application is safe.
Cloudflare says a declined scope that later becomes necessary requires reauthorization. That second consent event is the feature: it lets the user see that the task changed and decide whether the additional capability is justified.
Optional consent does not close the rest of the OAuth or agent boundary
A smaller token limits what that token can authorize. It does not prove that the authorization flow, token storage, client behavior, or downstream tools are safe.
- Required-scope overreach remains overreach. A user cannot deselect a required scope. If the client can perform its base function without a permission, classify that permission as optional or do not request it.
- The default remains broad. Cloudflare selects requested optional permissions by default. A person who clicks through without editing receives the full requested set, so a client must start with a narrow request rather than rely on every user to prune it.
- Authorization-flow security is separate. Cloudflare documents Authorization Code with PKCE for browser, mobile, desktop, and command-line public clients. The IETF’s current OAuth security best practice also requires PKCE for public clients and exact matching of registered redirect URIs. Optional scopes do not prevent authorization-code interception, redirect mistakes, or cross-site request forgery.
- Credential handling is separate. The bearer token still deserves the same protection at two scopes as at twenty. Wrangler’s current documentation offers operating-system keychain storage; logs, issue comments, worksheets, prompts, and model context should contain scope names and non-secret evidence, never tokens or refresh credentials.
- A safe grant can drive an unsafe tool. Optional scopes do not validate MCP tool arguments, bind an action to the user’s current intent, prevent a confused-deputy path, or add approval before a destructive call. Tool-level validation, account and resource boundaries, human confirmation, and recovery controls remain necessary.
- Scope names do not measure consequence by themselves. A single write scope can be more dangerous than ten read scopes. Review the resource, account, operation, data sensitivity, reversibility, and downstream side effects behind each name.
This is the same distinction behind the MCP roadmap analysis: documentation establishes an available mechanism, while the deployed client-server pair determines actual behavior. The Claude Skills API analysis applies the same rule to reusable agent bundles.
Cloudflare’s change turns partial OAuth consent into a usable control for Wrangler and MCP clients. The proof is not the new Edit Permissions button. It is the test run where a declined capability stays declined, useful work continues, and added authority cannot appear without another deliberate grant.
Sources
- Cloudflare changelog: Choose OAuth scopes for Wrangler and the Cloudflare API MCP server
- Cloudflare: From all-or-nothing to task-based OAuth consent
- Cloudflare OAuth client configuration documentation
- Cloudflare application authorization documentation
- Cloudflare Wrangler general commands documentation
- IETF RFC 9700: Best Current Practice for OAuth 2.0 Security