-
-
Notifications
You must be signed in to change notification settings - Fork 364
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
Investigate missing redirect_uri
check when performing OIDC flows
#685
Comments
I had a brief look at this (wouldn't consider it to be an exhaustive look, just looked for references to GetRedirectURIs() and from there found the most likely sources). It appears what's occurring is if the clients have a single redirect URI and the redirect URI provided to the authorization endpoint has an empty or non-existent redirect URI the single configured redirect URI (in the client) is used. See (also note the duplicate comment haha): Lines 83 to 99 in 29de878
Also See (note the check of if redirect URI is nil): Lines 60 to 75 in 29de878
Maybe making the following changes would be viable:
|
Just found the only call to IsRedirectURIValid() is in WriteAuthorizeError. Seems strange? Ahhh I see why. Here's where it's actually used in fosite/authorize_request_handler.go Lines 180 to 193 in 29de878
|
Wouldn't it be simpler to handle this by just modifying Drop this at the bottom of that function after
This would satisfy the core spec that requires |
Considering it's not an OpenID Authorize Request without the func (f *Fosite) validateAuthorizeRedirectURI(_ *http.Request, request *AuthorizeRequest) error {
// Fetch redirect URI from request
rawRedirURI := request.Form.Get("redirect_uri")
if rawRedirURI == "" && request.GetRequestedScopes().Has("openid") {
return errorsx.WithStack(fosite.ErrInvalidRequest.WithHint("Redirect URI information is required."))
}
// Validate redirect uri
redirectURI, err := MatchRedirectURIWithClientRedirectURIs(rawRedirURI, request.Client)
if err != nil {
return err
} else if !IsValidRedirectURI(redirectURI) {
return errorsx.WithStack(ErrInvalidRequest.WithHintf("The redirect URI '%s' contains an illegal character (for example #) or is otherwise invalid.", redirectURI))
}
request.RedirectURI = redirectURI
return nil
} |
Fixes an issue where Authorize Requests which were intended for an OpenID Connect 1.0 client would incorrectly be allowed when missing the redirect URI when it's required by the specification. Closes ory#685 Closes ory#762 BREAKING CHANGES: Going forward, calls to `/oauth2/auth` which trigger OpenID Connect require the `redirect_uri` query parameter to be set.
Fixes an issue where Authorize Requests which were intended for an OpenID Connect 1.0 client would incorrectly be allowed when missing the redirect URI when it's required by the specification. Closes #685 Closes #762 BREAKING CHANGES: Going forward, calls to `/oauth2/auth` which trigger OpenID Connect require the `redirect_uri` query parameter to be set.
Preflight checklist
Describe the bug
Open ID Connect Core specification says:
It does however not appear as if we are checking for this condition, as OAuth2 has the redirect URI marked as optional.
Reproducing the bug
This should be first confirmed with an integration test case
Relevant log output
No response
Relevant configuration
No response
Version
On which operating system are you observing this issue?
No response
In which environment are you deploying?
No response
Additional Context
No response
The text was updated successfully, but these errors were encountered: