-
-
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
Fix redirect_uri validation with query params #1528
Conversation
According to OAuth 2.0 protocol redirect_uri shouldn't contain any extra query params. We should consider exact query params list match when comparing redirect_uris
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.
Hey @pluff , thanks for the PR 🤝 !
I checked the document and think that you're right so 🟢 light
Concern. This should have never been incorporated into a patch-level release (5.5.2 -> 5.5.3). This is a breaking change, even if it is more of a direct interpretation of the spec. |
@pluff @nbulaj omniauth-oauth2 sends the full callback URL (with query params) as the Thoughts? In other words, this PR breaks integration with omniauth-oauth2. |
To be fair, It may very well be the case that this is a long standing issue with omniauth-oauth2: |
Is this still allowing the |
Above one sounds reasonable 🤔 ☝️ |
@nbulaj doesn't seem to work, I produced a failing spec. I can work on it. |
Yeah I checked original RFC and found a lot of spec for the |
Seems like I misinterpreted the spec about the However, this implementation is also not very accurate as per this excerpt from the spec: The authorization server SHOULD require the client to provide the With this change, this is no longer possible! |
Released 5.5.4 with reverted changes |
@nbulaj thanks a lot for the prompt action, let's look into this more closely once you (we) have the time. |
@pluff had to revert the PR because of different rules for redirect URI comparison across the docs. We should look at the original RFC more closely and attentively. Sorry for that 😞 |
Seems to be more of an issue on the client side: It feels a bit like egg/chicken situation, the more I read the spec the more I'm getting confused TBH. |
Yeah, the same thoughts. One of the ideas is to check OAuth implementation in other frameworks/languages to check main trend-offs for redirect URI validation. General RFC allows even pattern matching, but we still don't support it. So.. we have to "fight" with it :) |
After some thought, it seems to be that there are 2 distinct cases which we probably need to treat differently. First case, during the authorization request ( Second case, during the code-token exchange request ( The thing is that we're using the same logic I also figured out that the Afterwards, I will try to look into introducing the logic (and possible configuration option) for the distinction between these 2 cases so that we're more abiding to the spec. |
Summary
According to OAuth 2.0 protocol redirect_uri
shouldn't contain any extra query params.
We should consider exact query params list match
when comparing redirect_uris
More on topic: https://tools.ietf.org/id/draft-ietf-oauth-security-topics-18.html#name-protecting-redirect-based-f
Fixes #1527