git.iko.soy/typeable/oauth2-proxy
on master help sign in
Merge pull request #597 from oauth2-proxy/no-log-empty-redirect

Don't log invalid redirect if redirect is empty

commit5817028bb1d8c32c98f823b0c14e5f2c91f89ba4 authorJoel Speed <Joel.speed@hotmail.co.uk> dateFri 19 Jun 2020, 19:40 (6 years ago) parent713c392dc756b9
2 files changed+4
CHANGELOG.md+1 oauthproxy.go+3
CHANGELOG.md+1
@@ -56,6 +56,7 @@
5656## Changes since v5.1.1
5757
5858- [#620](https://github.com/oauth2-proxy/oauth2-proxy/pull/620) Add HealthCheck middleware (@JoelSpeed)
59+- [#597](https://github.com/oauth2-proxy/oauth2-proxy/pull/597) Don't log invalid redirect if redirect is empty (@JoelSpeed)
5960- [#604](https://github.com/oauth2-proxy/oauth2-proxy/pull/604) Add Keycloak local testing environment (@EvgeniGordeev)
6061- [#539](https://github.com/oauth2-proxy/oauth2-proxy/pull/539) Refactor encryption ciphers and add AES-GCM support (@NickMeves)
6162- [#601](https://github.com/oauth2-proxy/oauth2-proxy/pull/601) Ensure decrypted user/email are valid UTF8 (@JoelSpeed)
oauthproxy.go+3
@@ -598,6 +598,9 @@ func validOptionalPort(port string) bool {
598598// IsValidRedirect checks whether the redirect URL is whitelisted
599599func (p *OAuthProxy) IsValidRedirect(redirect string) bool {
600600 switch {
601+ case redirect == "":
602+ // The user didn't specify a redirect, should fallback to `/`
603+ return false
601604 case strings.HasPrefix(redirect, "/") && !strings.HasPrefix(redirect, "//") && !invalidRedirectRegex.MatchString(redirect):
602605 return true
603606 case strings.HasPrefix(redirect, "http://") || strings.HasPrefix(redirect, "https://"):