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

fix: id_token at_hash matching issue OKTA-417486 #906

Closed

Conversation

shuowu
Copy link
Contributor

@shuowu shuowu commented Aug 19, 2021

This PR guarantees idToken (at_hash) can match with accessToken after token auto renew.

@codecov-commenter
Copy link

codecov-commenter commented Aug 24, 2021

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 91.93548% with 5 lines in your changes missing coverage. Please review.

Project coverage is 91.98%. Comparing base (2020332) to head (18044cf).
Report is 406 commits behind head on master.

Files with missing lines Patch % Lines
lib/TokenManager.ts 91.80% 5 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #906      +/-   ##
==========================================
+ Coverage   91.95%   91.98%   +0.03%     
==========================================
  Files         120      120              
  Lines        3392     3407      +15     
  Branches      701      700       -1     
==========================================
+ Hits         3119     3134      +15     
  Misses        273      273              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -229,107 +230,6 @@ describe('TokenManager (browser)', function() {
setupSync({}, true);
});

it('allows renewing an idToken, without renewing accessToken', function() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved to e2e

});
});

it('allows renewing an accessToken, without renewing idToken', function() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved to e2e

@@ -547,85 +448,6 @@ describe('TokenManager (browser)', function() {
});
});
});

it('automatically renews a token early when local clock offset is considered', function() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

covered in specs/tokenManager/core.ts

});
});

it('renews a token early when "expireEarlySeconds" option is considered', function() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

covered in specs/tokenManager/core.ts

});
});

it('does not return the token after tokens were cleared before renew promise was resolved', function() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed due to this test does not make sense. As long as the renew process starts, renewed tokens should be added to storage, original storage should not matter.

@@ -54,12 +54,12 @@ export const EVENT_ERROR = 'error';

interface TokenManagerState {
expireTimeouts: Record<string, unknown>;
renewPromise: Record<string, Promise<Token>>;
renewPromise: Promise<Token>;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This type is not exposed, should be ok to change.

@shuowu-okta shuowu-okta force-pushed the sw-fix-idToken-at_hash-matching-issue-OKTA-417486 branch from b52375b to 18044cf Compare August 25, 2021 13:59
eng-prod-CI-bot-okta pushed a commit that referenced this pull request Aug 25, 2021
- Checks idToken integrity during token auto renew process
- Enables emitting `renewed` event for `TokenManager.setTokens` method
- Exposes `crypto` util module

OKTA-417486
<<<Jenkins Check-In of Tested SHA: 18044cf for eng_productivity_ci_bot_okta@okta.com>>>
Artifact: okta-auth-js
Files changed count: 15
PR Link: "#906"
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.

4 participants