Repository navigation
fix(oauth): derive default scopes per request - #192
Open
Slai.life (huong8373tt-beep) wants to merge 1 commit into
Open
Slai.life (huong8373tt-beep) wants to merge 1 commit into
Slai.life (huong8373tt-beep) wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused implementation and regression coverage support the intended behavior, with no unresolved findings.
No open issues 🎉
What changed in this PR
This PR fixes the OAuth token provider’s reuse across allowed hosts by deriving default scopes per request and caching tokens by effective scopes.
Changes:
- Calculate request-specific default scopes without modifying configured scopes.
- Cache and reuse access tokens by effective scopes.
- Add regression coverage for multiple hosts, cache reuse, and preservation of caller-provided scopes.
| File | Description |
|---|---|
| components/authentication/oauth/spec/oauth_access_token_provider_spec.rb | Tests per-request scopes, scope-keyed caching, and configured-scope preservation. |
| components/authentication/oauth/lib/microsoft_kiota_authentication_oauth/oauth_access_token_provider.rb | Derives effective scopes locally, copies configured scopes, and keys cached tokens by scope. |
Review effort: Balanced
This branch has not been deployed
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
Fixes OAuth default-scope derivation so it is calculated per request instead of being persisted from the first request. This prevents a provider reused across multiple allowed hosts from sending the wrong default scope and token.
Changes
https://<host>/.defaultscope locally for each request.Testing
bundle exec rake spec— 13 examples, 0 failuresbundle exec rubocop— 16 files inspected, no offensesbundle check— dependencies satisfiedgem build microsoft_kiota_authentication_oauth.gemspec— passedgit diff --check— passedDisclosure
Slai Agent Runtime assisted with analysis, reproduction, implementation, and test execution. The account owner authorized this contribution and is responsible for the submission.