Skip to content

[workers-auth] Request user token scope for cf - #16557

Merged
petebacondarwin merged 1 commit into
cloudflare:mainfrom
Kmschr:kschroeder/AUTHN-905
Oct 30, 2026
Merged

petebacondarwin merged 1 commit into
cloudflare:mainfrom
Kmschr:kschroeder/AUTHN-905

Conversation

@Kmschr

@Kmschr Kmschr commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

cf OAuth login omits user-api-tokens.write, so user API token listing and management can fail with 403 responses. Include the scope in cf's registered catalog and default login scopes now that the OAuth client supports it.

The regression test checks the cf descriptor's login defaults and scope validation, and the catalog counts are updated. A patch changeset is included. Users with an existing OAuth session need to log in again and grant the sensitive scope.

Validation:

  • pnpm -w test:ci -F @cloudflare/workers-auth: 204 passed, 6 credential-store integration tests skipped.
  • pnpm check:type -F @cloudflare/workers-auth: passed.
  • Targeted oxfmt and type-aware oxlint checks: passed.

  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: this fixes the scopes requested by existing cf login flows; there are no new commands or configuration options.

A picture of a cute animal (not mandatory, but encouraged)


Devin Review

Include user-api-tokens.write in cf OAuth login defaults so users can
list and manage user tokens after granting the sensitive scope.
Existing grants require a fresh login.
@changeset-bot

changeset-bot Bot commented Oct 28, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: bf48bc7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@cloudflare/workers-auth Patch
@cloudflare/remote-bindings Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

Copy link
Copy Markdown
Contributor

Hi @Kmschr. Thanks for taking the time to contribute to Workers SDK.

This PR has been automatically closed because you are not currently a registered (vouched) collaborator for this repository.

AI tools now let our team generate proposed code changes quickly. Reviewing changes, checking that they solve the right problem, and maintaining code quality over time still take substantial care and effort. We therefore limit PRs to registered collaborators so we can focus that effort where it is most useful.

For the majority of external contributors, the most effective way to help is through issues: describing a problem or use case, providing a minimal reproduction, investigating its cause, or helping us verify a fix. Those contributions help us understand what needs to change and are very welcome.

We will take an initial look at this PR and decide whether it is something we want to invest time in reviewing and maintaining. We may reopen it if we decide to proceed, but we cannot guarantee that it will be reopened or receive a full review.

@github-actions github-actions Bot closed this Oct 28, 2026
@github-project-automation github-project-automation Bot moved this from Untriaged to Done in workers-sdk Oct 28, 2026
@workers-devprod
workers-devprod requested review from a team and petebacondarwin and removed request for a team October 28, 2026 20:56
@workers-devprod

workers-devprod commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

@devin-ai-integration devin-ai-integration 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.

Devin Review found 2 potential issues.

Devin Review

Comment thread .changeset/cf-user-token-scope.md Resolved
Comment thread packages/workers-auth/src/cf/scopes.ts Resolved
@github-project-automation github-project-automation Bot moved this from Done to Untriaged in workers-sdk Oct 28, 2026
@clanky-the-clanker

clanky-the-clanker Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

This pull request's reviews are posted as pull request reviews: see the review of bf48bc79.

@Kmschr Kmschr changed the title AUTHN-905: [workers-auth] Request user token scope for cf [workers-auth] Request user token scope for cf Oct 28, 2026
@pkg-pr-new

pkg-pr-new Bot commented Oct 28, 2026

Copy link
Copy Markdown
@cloudflare/autoconfig

npm i https://pkg.pr.new/@cloudflare/autoconfig@16557

@cloudflare/build-output-utils

npm i https://pkg.pr.new/@cloudflare/build-output-utils@16557

@cloudflare/codemods

npm i https://pkg.pr.new/@cloudflare/codemods@16557

@cloudflare/config

npm i https://pkg.pr.new/@cloudflare/config@16557

@cloudflare/containers-shared

npm i https://pkg.pr.new/@cloudflare/containers-shared@16557

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@16557

@cloudflare/deploy-helpers

npm i https://pkg.pr.new/@cloudflare/deploy-helpers@16557

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@16557

miniflare

npm i https://pkg.pr.new/miniflare@16557

@cloudflare/pages-functions

npm i https://pkg.pr.new/@cloudflare/pages-functions@16557

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@16557

@cloudflare/runtime-types

npm i https://pkg.pr.new/@cloudflare/runtime-types@16557

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@16557

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@16557

@cloudflare/vitest-plugin

npm i https://pkg.pr.new/@cloudflare/vitest-plugin@16557

@cloudflare/workers-auth

npm i https://pkg.pr.new/@cloudflare/workers-auth@16557

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@16557

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@16557

wrangler

npm i https://pkg.pr.new/wrangler@16557

commit: bf48bc7

@petebacondarwin

Copy link
Copy Markdown
Contributor

clanker review

@clanky-the-clanker clanky-the-clanker 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.

✅ Approved — This is a single-scope addition with a matching regression test and a patch changeset. No issues were found.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

🚀 Release: ✅ LGTM

Risk: Low. A patch changeset is included.


🔒 Security: ✅ LGTM

This change widens the default cf OAuth grant to include user API token management, which is the stated intent. The user has to consent to the new scope, and existing sessions need a fresh login before they get it. No exploitable issue was found.


📖 AGENTS.md: ✅ LGTM

The new test follows the repository's convention of taking expect from the test context.


📋 Code Quality: ✅ LGTM

user-api-tokens.write is added in sorted position. It flows into CF_REQUESTABLE_SCOPES, DefaultScopeKeys and validateScopeKeys. The test count updates (482 → 483, 476 → 477) match the single scope added.


⚡ Performance: ✅ LGTM

No performance concerns.


📝 Documentation: ✅ LGTM

The changeset describes the change and tells users with an existing session to log in again.


Reviewed commit: bf48bc79

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

Codeowners reviews satisfied

@petebacondarwin
petebacondarwin merged commit 30d9f72 into cloudflare:main Oct 30, 2026
171 of 178 checks passed
@github-project-automation github-project-automation Bot moved this from Untriaged to Done in workers-sdk Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants