-
-
Notifications
You must be signed in to change notification settings - Fork 418
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
Add oidc pkce support #183
base: master
Are you sure you want to change the base?
Conversation
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 approved by accident...
+1 i'm waiting for it |
@SuperSandro2000 ping |
I can't say if the code is good or not. |
@SuperSandro2000 and what do you suggest?) |
You were right not to accept that code, well done @SuperSandro2000, good instinct. I got distracted by this and decided to do a review, firstly of the PKCE implementation and then of the broader attack mitigations PKCE is meant to solve. PKCE implementationThe repo (likewise the copy of verifier.go embedded here) fails to use cryptographic random data for the Consider incorporating/reviewing that PR, generally using I would advise reading the RFC thoroughly as this person has done, it's quite short and has a number of useful suggestions that give you an idea for how this code should be reviewed.
Authorisation Code InjectionI have some more suggestions regarding IETF OAuth 2.0 Security Current Best Practice (2018) section 2.1.1:
In summary
|
Also I haven't read the rest of the codebase enough to know for sure, but this PR doesn't make it obvious that the PKCE code_verifier is actually stored anywhere. Sure it might pass a test, but how does the pkceVerifier have the same value across |
@thomseddon Hey! Why not add this PR in code ? it should be better to use pkce code |
@cormacrelf thank you for the details. pushed changes, it will use nonce always, and crypto package instead of the math |
Still needs to be using cookies for storing both the code verifier and the nonce. At the moment this will fail if more than one user tries to log in at the same time. Because it is storing these values on the OIDC struct in memory. |
Some IDMs now require PKCE (KanIDM). Looking forward to this implementation |
@cormacrelf hi! Pushed changes, now it saves data into cookie |
Worth noting that Go has build-in PKCE support meanwhile |
where? Couldn't find it |
Is there anything else I can do to push this PR? |
See https://cs.opensource.google/go/x/oauth2/+/refs/tags/v0.23.0:pkce.go;l=26 |
@andig , thank you! unfortunately, it was added only for the v2 while this package uses v1 of the oauth library, as soon as we make a major update we can remove my code and start using the oauth's pkce |
I may get this wrong, but: Oauth2 is not a v2 of the package. If the PKCE function you need are compliant with the Oauth2 standard (which I can‘t evaluate), then you should be able from Go perspective to use the PKCE functions of the oauth2 package. |
ebcef09
to
040bd00
Compare
@SuperSandro2000 hi! Pushed changes, could you please check? it's more secure now |
In the pull request I've added support for the Proof Key for Code Exchange by OAuth Public Clients
Closes #182