Fix redirect_uri validation with query params#1528
Fix redirect_uri validation with query params#1528nbulaj merged 1 commit intodoorkeeper-gem:mainfrom
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
|
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