-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
fix: Respond with Redirect URL for already handled requests #2473
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.
Was it necessary to change everything from WasUsed
to WasHandled
? Other than that it looks good to me :)
@Benehiko I just made it more consistent as both WasUsed and WasHandled were mentioned in the code. I believe that request cannot really be used, it can be handled tho. :) |
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.
Really appreciate the contribution :)
I'll approve this, but will require further feedback from @aeneasr
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.
Awesome, thank you! I've added a more descriptive comment. Can you please apply that comment to all the definitions of WasHandled
?
Alternatively to this approach, we could do:
h.r.Writer().WriteError(w, r, x.ErrConflict.WithReason("Consent request has been used already").WithDetail("redirect_to", r.ReturnURL))
and write a custom swagger error object for this (so not genericError
but e.g. requestWasHandledError
.
What do you think? Is the 429 to counter intuitive? In my view, this is an error and should be treated as an error. If the dev does not check for this, the flow will end up in an irrecoverable error for the user.
Alternatively we could also let hydra redirect the user to the RequestURL if we encounter a used login / consent request?
@aeneasr I think replying with |
@aeneasr Updated PR to keep |
|
True, it is a breaking change - but given that we fix the behavior which was basically completely broken before it is ok. We'll document it :) |
Will make it 410 then! Thanks |
Awesome @svrakitin ! |
…ry#2473) Closes ory#1569 BREAKING CHANGE: This patch makes it so that already handled consent/login/logout requests respond with 410 Gone instead of 409 Conflict. Additionally, a URL is included that the user should be redirected to! Co-authored-by: hackerman <3372410+aeneasr@users.noreply.github.com>
Hi @svrakitin , Just upgraded my Hydra instance to benefit from your PR (thanks). I noticed with my Go client I'm able to get the But when doing It brings to me some questions:
Thank you, |
Hey @sneko, I think it makes sense to revisit status codes for accept endpoints as well. For now as a workaround you can get login request first. You can either submit a PR to fix that or I will find some time later this month. |
@svrakitin just noticed that: Some users started the flow into a specific browser, and then, due to confirmation through email... they went to another browser. And even if they had a code challenge not used, I wonder what could make the difference so Hydra is complaining? Let's see my code:
and
For me it's not coming from the missing |
@sneko Could it be some race condition when you have multiple requests for the same challenge? It can be users refreshing/reusing the email confirmation page if you accept the challenge automatically there. |
@svrakitin after investigating it's on our side. An error came after the return of Hydra so the user didn't get the redirectTo URL. Sorry about that! Thanks for the help 👍 :) |
Related issue
Closes #1569
Proposed changes
410 Gone
instead of409 Conflict
for already handled requestsredirect_to
when getting Login/Consent/Logout requests which have already been handled.WasUsed
withWasHandled
everywhere.Checklist
vulnerability. If this pull request addresses a security. vulnerability, I
confirm that I got green light (please contact
security@ory.sh) from the maintainers to push
the changes.
works.