-
Notifications
You must be signed in to change notification settings - Fork 25
add nonce parameter to OIDC flow #1148
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
Conversation
Signed-off-by: Bob Callaway <[email protected]>
Signed-off-by: Bob Callaway <[email protected]>
loosebazooka
left a comment
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.
looks fine, gonna run some tests locally just to double check the web flow still works.
sigstore-java/src/test/java/dev/sigstore/oidc/client/WebOidcClientNonceTest.java
Show resolved
Hide resolved
|
ignore the example test failures. also please run |
|
yeah locally weboidc seems to pass with google and github accounts. |
Signed-off-by: Bob Callaway <[email protected]>
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 think this should work -- nonce is optional but should always be returned in the response if it is included in the request.
That said state is marked as recommended for the authorization code flow and seems to be for a similar purpose so this could use state instead. The result seems about the same but maybe that requires less work since AuthorizationCodeRequestUrl has a setState() constructor chain method (I can't quite see how that all works so could be wrong and it's not easier at all)
|
I'm going to be migrating off the google-http-client to either something pluggable, or just apache-http-client5, so will revisit this a bit. |
Summary:
This change hardens the OIDC authentication process by implementing a cryptographically secure nonce (number used once) in the WebOidcClient.
Key Changes:
Security Benefit:
This mechanism is a critical defense against Replay Attacks. By binding the ID token to the specific client request that initiated it, we ensure that an attacker cannot capture a valid ID token from a previous session and "replay" it to impersonate a user. If the nonces do not match, the token is immediately rejected.