build: upgrade workers OAuth provider to 0.8.0 - #160
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Upgrade
@cloudflare/workers-oauth-providerfrom^0.6.0to^0.8.0and adopt its new exactgrantIdcallback context.When Cloudflare rejects a stored upstream refresh token with
invalid_grant, the server now revokes only the downstream grant currently being refreshed:This replaces the previous paginated sweep over every grant for the same
(userId, clientId)pair. It is simpler, avoids unnecessary KV reads, and cannot revoke a different concurrent grant for the same client.Relevant upstream changes
Security and correctness hardening
token_type_hint.Cache-Control: no-storeandPragma: no-cacheto token, credential, registration, and OAuth error responses.API additions used here
TokenExchangeCallbackOptions.grantIdidentifies the authoritative grant record being refreshed and is stable for that grant's lifetime.OAuthHelpers.revokeGrant(grantId, userId).Other new optional features—Enterprise-Managed Authorization and the dynamic-client-registration policy callback—remain disabled.
Upstream releases:
Compatibility review
OAuthProvider,getOAuthApi,AuthRequest,OAuthError, andOAuthHelpersexports used by this repository remain available.parseAuthRequest()andcompleteAuthorization()retain their contracts.Test changes
invalid_grantrevokes the exact callbackgrantId.listUserGrants()is never called.handleTokenExchangeCallbackpath.invalid_grant.Validation
npm run check: 261 tests across 16 filesnpm audit --omit=devreports no vulnerability against@cloudflare/workers-oauth-provider.