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

OAuth module missing special handling for loopback redirect URI #21285

Closed
hickford opened this issue Sep 28, 2022 · 0 comments · Fixed by #21293 or #21373
Closed

OAuth module missing special handling for loopback redirect URI #21285

hickford opened this issue Sep 28, 2022 · 0 comments · Fixed by #21293 or #21373
Labels

Comments

@hickford
Copy link
Contributor

hickford commented Sep 28, 2022

OAuth RFC https://datatracker.ietf.org/doc/html/rfc8252#section-7.3 describes special handling for loopback redirect URIs, in particular that the port need not match.

The authorization server MUST allow any port to be specified at the
time of the request for loopback IP redirect URIs
, to accommodate
clients that obtain an available ephemeral port from the operating
system at the time of the request.

This is vital for local apps, but the behaviour is missing in Gitea.
Relevant code

func (app *OAuth2Application) ContainsRedirectURI(redirectURI string) bool {
return util.IsStringInSlice(redirectURI, app.RedirectURIs, true)
}

GitHub implements this behaviour https://docs.github.com/en/developers/apps/building-oauth-apps/authorizing-oauth-apps#localhost-redirect-urls

The redirect_uri does not need to match the port specified in the callback url for the app.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
1 participant