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

Trigger metadata refresh for token decryption errors #3149

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

pmaytak
Copy link
Contributor

@pmaytak pmaytak commented Feb 25, 2025

Fixes #3148

This pull request includes several changes to improve the handling of token decryption errors and enhance the test cases for token validation. The most important changes include modifications to the IsRecoverableException and IsRecoverableExceptionType methods, updates to the test cases for token decryption, and the addition of new test cases to handle retry logic for token decryption.

Enhancements to token decryption error handling:

Updates to test cases for token decryption:

Addition of new test cases:

@pmaytak pmaytak requested a review from a team as a code owner February 25, 2025 06:31
Copy link

Summary

Summary
Generated on: 2/25/2025 - 6:44:35 AM
Coverage date: 2/25/2025 - 6:34:27 AM - 2/25/2025 - 6:44:11 AM
Parser: MultiReport (60x Cobertura)
Assemblies: 1
Classes: 7
Files: 2
Line coverage: 80.3% (620 of 772)
Covered lines: 620
Uncovered lines: 152
Coverable lines: 772
Total lines: 483
Branch coverage: 67.8% (228 of 336)
Covered branches: 228
Total branches: 336
Method coverage: Feature is only available for sponsors

Coverage

Microsoft.IdentityModel.JsonWebTokens - 80.3%
Name Line Branch
Microsoft.IdentityModel.JsonWebTokens 80.3% 67.8%
Microsoft.IdentityModel.JsonWebTokens.JwtTokenUtilities 100%
System.Text.RegularExpressions.Generated 80.3% 67.8%
System.Text.RegularExpressions.Generated 80.3% 67.8%
System.Text.RegularExpressions.Generated.<RegexGenerator_g>F12A1AEDDDFE32BA
DF4DBFF323AF1BCB48B9F9721B7CD3E05F5E034CF225E3DF8__CreateJweRegex_1
79.2% 68%
System.Text.RegularExpressions.Generated.<RegexGenerator_g>F12A1AEDDDFE32BA
DF4DBFF323AF1BCB48B9F9721B7CD3E05F5E034CF225E3DF8__CreateJwsRegex_0
81.4% 67.6%
System.Text.RegularExpressions.Generated.<RegexGenerator_g>F334844C618E00D3
CEC5D3FE0D00CF0141BBEE98635313BB2CB8D3921464CE05A__CreateJweRegex_1
79.2% 68%
System.Text.RegularExpressions.Generated.<RegexGenerator_g>F334844C618E00D3
CEC5D3FE0D00CF0141BBEE98635313BB2CB8D3921464CE05A__CreateJwsRegex_0
81.4% 67.6%

Copy link
Collaborator

@jennyf19 jennyf19 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-setting my review, I need a bit more time to look at this.

@jennyf19 jennyf19 self-requested a review February 26, 2025 01:42
@@ -252,7 +252,8 @@ internal static bool IsRecoverableException(Exception exception)
{
return exception is SecurityTokenInvalidSignatureException
|| exception is SecurityTokenInvalidIssuerException
|| exception is SecurityTokenSignatureKeyNotFoundException;
|| exception is SecurityTokenSignatureKeyNotFoundException
|| exception is SecurityTokenDecryptionFailedException;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that this is sufficient. We should signal metadata refresh only if encryption keys are part of metadata.

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.

[Feature Request] Trigger metadata refresh for token decryption failures
3 participants