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

Is there a plan to support custom redirect_uri matching rules. #820

Open
5 tasks done
gitsang opened this issue Aug 21, 2024 · 5 comments
Open
5 tasks done

Is there a plan to support custom redirect_uri matching rules. #820

gitsang opened this issue Aug 21, 2024 · 5 comments
Labels
feat New feature or request.

Comments

@gitsang
Copy link

gitsang commented Aug 21, 2024

Preflight checklist

Ory Network Project

No response

Describe your problem

Should we providing the functionality of custom matching patterns for redirect_uri?

Describe your ideal solution

I certainly understand that using a complete match for security reasons is reasonable, but there are also some third-party systems that may have compatibility issues.

In OAuth Documents, using exact redirect URI matching is just Advise.

Anyway, at least I think providing the functionality of custom matching patterns is following the specifications.

Workarounds or alternatives

This is the alternatives solution for supporting pattern match directly.

Version

0.45

Additional Context

No response

@gitsang gitsang added the feat New feature or request. label Aug 21, 2024
@james-d-elliott
Copy link
Contributor

james-d-elliott commented Aug 21, 2024

It's not accurate to describe it as just advice. It's a strict requirement of both OAuth 2.0 and OpenID Connect 1.0.

In addition almost 100% of the Best Current Practice document is formally part of the OAuth 2.1 draft if it's not already part of OAuth 2.0 (in which case the Best Current Practice document serves as an ADR / rationale for the requirements at least in some cases).

Typically clients which require this, or providers that allow this, are objectively not compliant with the spec. Is that a reason to not implement it? Not really sure.

@gitsang
Copy link
Author

gitsang commented Aug 22, 2024

It's not accurate to describe it as just advice. It's a strict requirement of both OAuth 2.0 and OpenID Connect 1.0.

In addition almost 100% of the Best Current Practice document is formally part of the OAuth 2.1 draft if it's not already part of OAuth 2.0 (in which case the Best Current Practice document serves as an ADR / rationale for the requirements at least in some cases).

Typically clients which require this, or providers that allow this, are objectively not compliant with the spec. Is that a reason to not implement it? Not really sure.

Thank you for your reply. However, there are still some third-party systems that do not compliant with the spec. And Unfortunately, due to historical reasons or business requirements, sometimes we have to make concessions for compatibility.

Is it worth sacrificing security and violating standards in exchange for compatibility? Or can we simply treat it as an insecure option (such as naming it 'InsecureRedirectUriMatching' or 'NonComplianceRedirectUriMatching')?

@vivshankar
Copy link
Contributor

vivshankar commented Aug 22, 2024

FWIW - We wrap Fosite to provide a RedirectURIMatchingStrategy for exactly this reason of being able to interoperate. There are some practical considerations around certain applications that have a large number of redirect URIs because of an RP designed to be an intermediary. An example of this is Artifactory, IIRC. Do I like this? No. Do I have to live with it? Yes :-)

From a product standpoint, we offer the option to choose the matching strategy but default to the prescribed approach of exact matching.

If there is interest and @aeneasr sees this as something that we can potentially add, I will be happy to contribute this.

@james-d-elliott
Copy link
Contributor

Yeah no worries this makes sense. I think some examples of precisely the situations and URI's that may need specialized matching may be helpful.

I would also argue that absent a specific example the matching strategy (if implemented) should generally speaking only be utilized in this context to match the path of the URI, and the origin should be matched explicitly against the list of registered redirect URIs. Pattern matching (especially with regex) the origin due to its nature has a considerable security impact that doesn't exist with RFC3986 simple string comparison.

@gitsang
Copy link
Author

gitsang commented Aug 27, 2024

In my scenario, most of the incompatible situations are caused by old internal systems and some outsourced services. A typical scenario is that some services will attach parameters in the redirect_uri instead of placing them under the "state" parameter. For example:

https://server.example.com/yauth/api/v1/oauth/authorize?
    response_type=code&
    client_id=424911365001&
    scope=openid&
    redirect_uri=https://app.example.com/callback?token=ey......&
    state=xxxxxxxx&
    nonce=0394852-3190485-2490358

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat New feature or request.
Projects
None yet
Development

No branches or pull requests

3 participants