Skip to content

Conversation

rayluo
Copy link
Contributor

@rayluo rayluo commented Sep 30, 2025

TL;DR: This PR only adds a test case. It does not change any existing behavior of MSAL Python. It is safe to merge it in.

Context: Recently we got involved in a cross-team investigation for a high-profile incident. Result indicates that this code base does token caching right, nonetheless it was still time-consuming to self-audit and then validate the cache behavior for the scenario of "token response scope differing from token request scope". So, as a byproduct of this investigation, here comes this PR containing a dedicated test case to validate the following behaviors:

  1. When authorization server issues token with scopes different than the requested scope (which is allowed in OAuth2 specs), client shall cache token based on scopes in response.
  2. Subsequent requests with invalid scope shall miss cache.
  3. Subsequent requests with valid (i.e. cached) scope shall hit cache.

Once this test case is added and rerun all the time, we won't need to second guess ourselves in any future troubleshooting.

@rayluo rayluo requested a review from a team as a code owner September 30, 2025 06:44
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