-
Notifications
You must be signed in to change notification settings - Fork 154
feature: migration of openid-client from v4 to v6 #735
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
base: master
Are you sure you want to change the base?
Conversation
|
Claude finished @gyaneshgouraw-okta's task —— View job Code Review CompleteTasks
Overall Assessment❌ This PR has critical security issues that must be addressed before merging, particularly around global state management and authentication validation. Critical Issues:
Security Concerns:
Code Quality Issues:
Recommendations:
While the migration from v4 to v6 is architecturally sound and the backward compatibility approach is well-designed, the implementation has security and reliability issues that must be resolved before production use. |
lib/context.js
Outdated
|
|
||
| token = await JWT.LogoutToken.verify(logoutToken, keyInput, { | ||
| issuer: issuer.issuer, | ||
| issuer: tokenIssuer, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if this is correct.
tokenIssuer is fetched from the logoutToken and then used to verify the same logoutToken.
This seems like a security issue because JWT.LogoutToken.verify would always pass in this case as long as the token is signed by a trusted key.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right issuer should be coming from the oepnid config that will be trusted source of token.
| } | ||
| }, | ||
| ), | ||
| clockTolerance: Joi.number().optional().default(60), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This default value clockTolerance is no longer used.
Earlier we had this https://github.com/auth0/express-openid-connect/pull/735/files#diff-ca407d959d33ce92a7f7efee354a5ea5e6e61fcd797d32c04205e429a074ed54L115. Now it's removed. And we no longer use this default value.
Does that mean now clockTolerance falls back to 0 ? If the answer is Yes, it could be a breaking change a small clock difference between the app and the AS can result in validation failure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching this, now i have added the clocktolerence with JWT verification which used to so if our server responds late it can wait till the expiry time.
What do you think of this approach or should we fully remove the clockTolerence but it might impact to authenticaition.
| parBody.append( | ||
| 'client_assertion_type', | ||
| 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer', | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need client_id here ?
parBody.append('client_id', config.clientID);There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right client_id shouldnt need to send it in body
|
|
||
| try { | ||
| global[customFetch] = customFetchFn; | ||
| global.fetch = customFetchFn; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we mutating the global fetch here ?
What will happen when multiple get() calls are made at the same time ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohk will be changing this to direct reference to global fetch. Multiple calls could have created issues by interfering with each other due to same global variable.
lib/client.js
Outdated
| } | ||
|
|
||
| // Make the PAR request | ||
| const parResponse = await fetch( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we customFetch here ?
We aren't passing Auth0-Client telemetry and httpAgent data here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes customfetchFn should be used, fetch was by passing it. telemetry data added
lib/client.js
Outdated
| }; | ||
| }, | ||
|
|
||
| async introspect() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know what is this. What are we doing here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had added to check the telemetry data but now instead of this using mock server for testing.
| // If no new refresh token assume the current refresh token is valid. | ||
| refresh_token: newTokenSet.refresh_token || oldTokenSet.refresh_token, | ||
| token_type: newTokenSet.token_type, | ||
| expires_at: newTokenSet.expires_at, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What will happen if AS returns only expires_in (No expires_at). Then newTokenSet.expires_at would be undefined ?
Can you confirm if that's a possibility ? If that happens you'll end up setting a session without expiry. Also TokenSet.expired() here would return false.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea it return only expires_in, have added logic to convert into expires_at when token is created.
Description
This PR upgrades express-openid-connect to use openid-client v6.8.1 while maintaining zero breaking changes for end users. The migration includes comprehensive Node.js 18+ compatibility with Web API polyfills and enhanced CI reliability.
Changes
Backward Compatibility
New Feature & Enhancement