Skip to content

Bugfix for token cache search - #717

Merged
Ray Luo (rayluo) merged 2 commits into
devfrom
bugfix-token-cache-search
Jul 3, 2024
Merged

Bugfix for token cache search#717
Ray Luo (rayluo) merged 2 commits into
devfrom
bugfix-token-cache-search

Conversation

@rayluo

@rayluo Ray Luo (rayluo) commented Jul 1, 2024

Copy link
Copy Markdown
Contributor

The self._get_access_token() uses token key to find a token in O(1) time complexity. However, previously we forgot to also use self._is_matching() to double check the other criteria such as scopes and - in this bugfix's case - the key_id claim. This PR refactors the implementation to call self._is_matching() in both the O(1) code path and the traditional O(N) code path.

This shall fix a recent bug report of false-positive cache hit for Ssh Certificate acquisition.

Install this by python -m pip install --force-reinstall "git+https://github.com/AzureAD/microsoft-authentication-library-for-python.git@bugfix-token-cache-search". Merged to dev now.

Thanks for the testing done by Vivian Thiebaut (@vthiebaut10) , this PR will fix Azure/azure-cli#29006

@rayluo
Ray Luo (rayluo) marked this pull request as ready for review July 3, 2024 17:27
@rayluo
Ray Luo (rayluo) requested a review from a team as a code owner July 3, 2024 17:27
@rayluo
Ray Luo (rayluo) merged commit c1fedad into dev Jul 3, 2024
@rayluo
Ray Luo (rayluo) deleted the bugfix-token-cache-search branch July 3, 2024 17:30
Comment thread msal/token_cache.py
Comment thread msal/token_cache.py
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.

az ssh arc connection issue using Service Principal

2 participants