Skip to content

fix: remove broken OAuth scopes and enforce max scope limit - #13

Merged
mattzcarey merged 3 commits into
mainfrom
feat/scopes
Feb 16, 2026
Merged

fix: remove broken OAuth scopes and enforce max scope limit#13
mattzcarey merged 3 commits into
mainfrom
feat/scopes

Conversation

@mattzcarey

Copy link
Copy Markdown
Contributor

Summary

  • Removes 3 OAuth scopes that are rejected by Cloudflare's OAuth server (billing:read, billing:write, notebook-managed:read)
  • Adds a MAX_SCOPES constant (76) — the hard limit enforced by Cloudflare's OAuth provider
  • Enforces the limit server-side in the OAuth handler (truncates to 76 if exceeded)
  • Enforces the limit client-side in the consent UI (disables unchecked scopes at the cap, shows a counter)
  • Adds test coverage for template scope counts vs the limit
  • Includes the Playwright test script (scripts/test-oauth-scopes.py) used for the investigation

Investigation

Browser automation testing with Playwright confirmed:

  • 76 scopes work, 77 fail with a generic "Something went wrong!" from Cloudflare's OAuth server
  • The 3 removed scopes fail even when tested individually (base scopes + 1)
  • All remaining 78 scopes work individually; the limit is purely on count per request

Full details in #12.

Test plan

  • All 69 existing tests pass (npm test)
  • New MAX_SCOPES test validates templates stay within the limit
  • Manual: verify consent UI disables checkboxes when 76 scopes are selected
  • Manual: verify OAuth flow works with workers-full and dns-full templates

Automated browser testing revealed that Cloudflare's OAuth server fails
with "Something went wrong!" when more than 76 scopes are requested.

Three scopes are individually broken and rejected by the OAuth server:
- billing:read
- billing:write
- notebook-managed:read

Changes:
- Remove the 3 broken scopes from ALL_SCOPES and REGISTERED_SCOPES
- Add MAX_SCOPES constant (76) and enforce it server-side in oauth-handler
- Add client-side scope limit enforcement in consent UI (disables
  unchecked scopes and shows counter when limit is reached)
- Add test to verify all templates stay within the limit
- Include Playwright test script used for the investigation

Closes #12
@mattzcarey
mattzcarey merged commit 935683a into main Feb 16, 2026
1 check passed
@mattzcarey
mattzcarey deleted the feat/scopes branch February 16, 2026 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant