-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
AuthCodeGrant doesn't reply with invalid_grant on bad "code" request paramter, but with invalid_request #1430
Comments
fix: |
Thanks for this PR. I understand why you raised it but I think the code should remain as is. At present, we throw a LogicException if we have an issue decrypting the code. This could be because the code provided is invalid, but it could also be for a whole host of other reasons such as a missing encryption key on the server, an integrity check violation, type issues etc. The section of code you highlighted just captures that decryption failed. If decryption is successful, we then validate the auth code in the If implementations are correct, we shouldn't ever really come across this error anyway. I think I'm therefore inclined to leave the code as is as we cannot say for definite that a bad auth code caused this error. |
Quay for example sends a "badcode" code to establish server availability and expects "invalid_grant" to proceed using that OAuth2 / OIDC server. a code like "badcode" is not a hex encoded binary data and therefore fails in which makes it hard to distinguish between client data error and server ("wrong key") issue. It is a violation of the RFC though and as you claim to be "a standards compliant implementation", maybe keep the issue open? |
I've had a stab at fixing this on reflection. There probably is something we can do to improve the situation. It isn't perfect as there is a case where the authcode might be valid but the key/password might have changed but we can't distinguish between these cases. In this event, I've opted to respond with |
would appreciate any feedback you have prior to merging. Thanks! |
it solves my problem, it takes care of server side key issues, would be happy to see this merged. thank you |
https://www.rfc-editor.org/rfc/rfc6749#section-5.2
says:
invalid_grant
The provided authorization grant (e.g., authorization
code[...]) is
invalid, expired, revoked, does not match the redirection
URI used in the authorization request, or was issued to
another client.
but
oauth2-server/src/Grant/AuthCodeGrant.php
Line 126 in 2ed9e5f
throws a "invalid_request" instead. That is not RFC conform
The text was updated successfully, but these errors were encountered: