The Wayback Machine - https://web.archive.org/web/20220507124222/https://github.com/go-gitea/gitea/pull/19627
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

Allow oauth2 application redirect_uris to contain wildcards #19627

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Copy link

@glmdev glmdev commented May 6, 2022

Currently, Gitea matches the redirect URI for oauth2 authorize requests against a static list of valid URIs. This causes problems for applications like Gitea-based comments engine Vssue that set the redirect URI to the current page to ensure the user gets redirected to the correct post.

This change introduces a setting called ENABLE_REDIRECT_URI_WILDCARD which, when enabled, causes Gitea to check a redirect URI against the list of allowed URIs using wildcard matching.

Example: http://localhost:4000/blog/post.html is valid if the URI is http://localhost:4000/blog/*

The implementation works by transforming the pattern into a regular expression (e.g. http://localhost:4000/blog/.*) and matching the redirect URI against that expression.

This new setting is disabled by default, which preserves the existing behavior. Closes #9514.

models/auth/oauth2.go Outdated Show resolved Hide resolved
modules/setting/setting.go Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants