Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix for token cache search #717

Merged
merged 2 commits into from
Jul 3, 2024
Merged

Bugfix for token cache search #717

merged 2 commits into from
Jul 3, 2024

Conversation

rayluo
Copy link
Collaborator

@rayluo rayluo commented Jul 1, 2024

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 @vthiebaut10 , this PR will fix Azure/azure-cli#29006

@rayluo rayluo marked this pull request as ready for review July 3, 2024 17:27
@rayluo rayluo requested a review from a team as a code owner July 3, 2024 17:27
@rayluo rayluo merged commit c1fedad into dev Jul 3, 2024
12 checks passed
@rayluo rayluo deleted the bugfix-token-cache-search branch July 3, 2024 17:30
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