Skip to content

fix(oauth): distinguish required and discovered scopes - #1879

Open
aryasaatvik wants to merge 1 commit into
UsefulSoftwareCo:mainfrom
aryasaatvik:fix/oauth-required-discovered-scopes
Open

fix(oauth): distinguish required and discovered scopes#1879
aryasaatvik wants to merge 1 commit into
UsefulSoftwareCo:mainfrom
aryasaatvik:fix/oauth-required-discovered-scopes

Conversation

@aryasaatvik

Copy link
Copy Markdown
Contributor

Summary

Distinguish scopes required by integration or client policy from capabilities discovered through OAuth metadata. This prevents a valid partial grant from being reported as missing every supported capability the authorization server advertised.

Scope source Requested Required for the missing-scope verdict
Declared integration or client policy Yes Yes
Discovered scopes_supported Yes No
Token response Records the actual grant Compared with required scopes

This follows RFC 9728 section 7.2: scopes_supported describes supported values, not a directive that every value must be granted. Legacy in-flight OAuth sessions retain their previous requested-scope fallback.

Validation

  • bunx vitest run src/oauth-scope-union.test.ts src/oauth-flow.test.ts
  • bun run typecheck
  • bunx oxlint -c ../../../.oxlintrc.jsonc src/oauth-service.ts src/oauth-scope-union.test.ts --deny-warnings
  • bunx vitest run (861 passed)

Persist required scopes separately from dynamically advertised capabilities so partial grants only warn when explicit integration or client policy is unsatisfied.
@aryasaatvik
aryasaatvik marked this pull request as ready for review August 30, 2026 09:27
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