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

Token endpoint does not verify client secret #65

Open
ibtehajn opened this issue Aug 6, 2021 · 4 comments
Open

Token endpoint does not verify client secret #65

ibtehajn opened this issue Aug 6, 2021 · 4 comments

Comments

@ibtehajn
Copy link

ibtehajn commented Aug 6, 2021

The /token endpoint currently proxies all requests to GitHub's /login/oauth/access_token API. It forwards the code and state supplied by the requestor and augments the GitHub request with the GITHUB_CLIENT_SECRET -- the original requestor doesn't need to know the client secret at all!

That means I could get an access token if I can sniff someone's authorization code. This seems to be a security hole that at the very least deserves to be documented in bold letters. I believe this means that the security of the "authorization code flow" is effectively degraded to that of the "implicit flow".

Could this be fixed by removing the GITHUB_CLIENT_SECRET variable from the shim altogether and instead requiring that the service provider (i.e. Cognito) provides it?

@kevingilbert100
Copy link

+1

@TimothyJones
Copy link
Owner

Could this be fixed by removing the GITHUB_CLIENT_SECRET variable from the shim altogether and instead requiring that the service provider (i.e. Cognito) provides it?

This seems like a much better design, and I have no idea why I didn't do it that way in the first place. A PR that sorts this out would be very welcome.

Also, sorry I missed this when you first posted it, @ibtehajn!

@shorn
Copy link

shorn commented May 3, 2022

Alternate implementation based off of the wrapper that uses the client_secret to sign the JWT instead of a certificate: https://github.com/shorn/zinc/blob/main/aws-infra/lambda/doc/cognito-github.md

@TimothyJones
Copy link
Owner

This seems like a much better design, and I have no idea why I didn't do it that way in the first place. A PR that sorts this out would be very welcome.

I know this is an old issue, but I was updating the dependencies for this project, and I remembered why the shim has its own secret- it's because otherwise you can't make the ID token.

It's possible you could still proxy the github secret all the way though, since I don't think it's involved in the token generation. This would be a simple change.

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

No branches or pull requests

4 participants