apache / apache/grails-core

Interal URLs cannot be used as oauth provider

Open
#15,931 1 comment 0 reactions 0 assignees View on GitHub
relates-to:spring-security
Dominant language
Groovy
Stars
2.9k
Forks
975
Avg merge
1d 22h
Merged PRs (30d)
92

Description

The default instance of `UrlValidator` prevents us to use intranet domain names, which are not compliant to url validator. For example dev.somewhere.local is invalid because of local is not valid TLD.

```groovy
class SpringSecurityOAuth2Controller {
...
def authenticate() {
String providerName = params.provider
if (StringUtils.isBlank(providerName)) {
throw new OAuth2Exception("No provider defined")
}
log.debug "authenticate ${providerName}"
String url = springSecurityOauth2BaseService.getAuthorizationUrl(providerName)
log.debug "redirect url from s2oauthservice=${url}"

//You cannot use internal/local urls because of this line
if (!UrlValidator.instance.isValid(url)) {
flash.message = "Authorization url for provider '${providerName}' is invalid."
redirect(controller: 'login', action: 'index')
}
redirect(url: url)
}
...
```
It is possible/reasonable to omit the validation or make it configurable e.g. by injecting the validator?

Contributor guide

Open the contributing guide

Research direction

Start in SpringSecurityOAuth2Controller.authenticate, focusing on the UrlValidator.instance check shown in the issue. Review how the OAuth2 authorization URL is obtained, then clarify whether validation should be omitted or made configurable; done means the agreed behavior supports the stated internal URL use without rejecting valid provider URLs.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy
Domain
authentication
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.