-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Validate a session using the access token in the OIDC provider #1933
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
|
I will do more testing and update the |
|
I was under the impression that the whole point of a refresh token was to refresh the ID Token, which provider are you using out of interest? |
It is valid, according to the specification, to only refresh the access token and not the ID Token.
We use oauth2-proxy with multiple customer and several IdPs. We found this problem so far only with Ping Identity. |
|
@gysel gysel could you help with docker image of binary built from your fix branch hosted on docker hub? |
|
@r-kotagudem I would not use binaries built by random strangers on the internet ;) You can easily build your own images, the Docker command to do so is in the Makefile (https://github.com/oauth2-proxy/oauth2-proxy/blob/master/Makefile#L55). |
thanks, my system had some docker related environment issues. and wanted to test with your changes. |
|
This pull request has been inactive for 60 days. If the pull request is still relevant please comment to re-activate the pull request. If no action is taken within 7 days, the pull request will be marked closed. |
|
this is still relevant to us |
|
Can we get this merged? |
a4b1856 to
ce03d76
Compare
|
This is ready to be merged IMHO. Please let me know in case I should do any other changes. |
|
This pull request has been inactive for 60 days. If the pull request is still relevant please comment to re-activate the pull request. If no action is taken within 7 days, the pull request will be marked closed. |
|
still relevant |
CHANGELOG.md
Outdated
| - [#1988](https://github.com/oauth2-proxy/oauth2-proxy/pull/1988) Ensure sign-in page background is uniform throughout the page | ||
| - [#2013](https://github.com/oauth2-proxy/oauth2-proxy/pull/2013) Upgrade alpine to version 3.17.2 and library dependencies (@miguelborges99) | ||
| - [#2047](https://github.com/oauth2-proxy/oauth2-proxy/pull/2047) CVE-2022-41717: DoS in Go net/http may lead to DoS (@miguelborges99) | ||
| - [#2047](https://github.com/oauth2-proxy/oauth2-proxy/pull/1933) Validate a session using the access token in the OIDC provider (@gysel) |
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.
please do a rebase of your branch with the master and move this to the latest changes since section
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.
done
| err := p.checkNonce(s) | ||
| if err != nil { | ||
| logger.Errorf("nonce verification failed: %v", err) | ||
| 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.
i personally would prefer the direct return
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 a direct return but then code climate complained about too many returns. (see 64dd780) Should I change it back?
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.
A yes you are right code climate is quite strict at the moment. Leave it as is for now!
According to the OIDC specification the refresh tokens are used to refresh the access tokens. Furthermore, as described in section Therefore, the solution in this PR seems like kind of a workaround to me. Should the refresh empty the |
|
@gysel do you by any chance still have a record or know which error you got after the refresh during the token validation? |
I added the error message here: #1640 (comment) I just verified it again, we only use the
Good question... I think I'd rather have an expired |
5c894c3 to
92a8814
Compare
Error: So the issue occurs when the |
In this particular case the |
|
This pull request has been inactive for 60 days. If the pull request is still relevant please comment to re-activate the pull request. If no action is taken within 7 days, the pull request will be marked closed. |
|
This pull request has been inactive for 60 days. If the pull request is still relevant please comment to re-activate the pull request. If no action is taken within 7 days, the pull request will be marked closed. |
|
This pull request has been inactive for 60 days. If the pull request is still relevant please comment to re-activate the pull request. If no action is taken within 7 days, the pull request will be marked closed. |
|
Bump |
|
This pull request has been inactive for 60 days. If the pull request is still relevant please comment to re-activate the pull request. If no action is taken within 7 days, the pull request will be marked closed. |
|
Still relevant for us too |
|
Reminder to myself to finally get this merged and done once for all. |
JoelSpeed
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.
Out of interest, do we have a link to the appropriate place in the OIDC spec that allows IDPs to not return a new ID Token? I believe it's there but would be useful to link to in a code comment I think
| if !validateToken(ctx, p, s.AccessToken, makeOIDCHeader(s.AccessToken)) { | ||
| logger.Errorf("access token is invalid") | ||
| return false | ||
| } | ||
| return true |
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 the log here? Or should we just return?
| if !validateToken(ctx, p, s.AccessToken, makeOIDCHeader(s.AccessToken)) { | |
| logger.Errorf("access token is invalid") | |
| return false | |
| } | |
| return true | |
| return validateToken(ctx, p, s.AccessToken, makeOIDCHeader(s.AccessToken)) |
@JoelSpeed I would love to see this fixed, but I am not confident enough with GO unfortunately :/ |
|
Is this still being worked? My company is being blocked by this issue and would love to see this merged. Happy to assist in any way |
…IDC provider Signed-off-by: Jan Larwig <jan@larwig.com>
5f06a29 to
5d9c175
Compare
|
Hi all, really sorry this was open for years. To be honest I just lost track of it over and over again. As @JoelSpeed and me are only working on the project voluntarily and don't have any allotted time from our employers it is hard to keep things on track. With OAuth2 Proxy joining the CNCF, we try to get an initiative started to get the project more streamlined and more people on board to triage and review issues and PRs. For now this PR is finally merged. |
|
Hey @tuunit, Many thanks for wrapping up this change. I tested this now and found two issues:
I opened #3267 with a proposed fix. |
Some Identity Providers do not issue an updated ID Token when call the refresh endpoint.
This causes problems with the OIDC provider as it uses the ID Token to validate a session after a refresh.
I propose to validate the access token instead when
--validate-urlis set.Description
Another solution would be to validate the ID token only during the initial session creation and skip the validation after the refresh. This seems to be the case with versions < v7.2.0.
Motivation and Context
Fixes #1640
How Has This Been Tested?
I use a similar version of this patch in production for several weeks now.
I will perform more tests on our side in the coming days.
Checklist: