git.iko.soy/typeable/oauth2-proxy
on master help sign in
Add logging in case of invalid redirects (#471)

* Add logging in case of invalid redirects * update changelog Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>

commit3f7837b9559684064f0c82d1edea8bfca4b62957 authorPhil Taprogge <phil.taprogge@snyk.io> dateThu 2 Apr 2020, 09:51 (7 years ago) parenteb31850
2 files changed+4
CHANGELOG.md+1 oauthproxy.go+3
CHANGELOG.md+1
@@ -19,6 +19,7 @@
1919 - Release images moved to `quay.io/oauth2-proxy/oauth2-proxy`
2020 - Binaries renamed from `oauth2_proxy` to `oauth2-proxy`
2121- [#432](https://github.com/oauth2-proxy/oauth2-proxy/pull/432) Update ruby dependencies for documentation (@theobarberbany)
22+- [#471](https://github.com/oauth2-proxy/oauth2-proxy/pull/471) Add logging in case of invalid redirects (@gargath)
2223
2324# v5.1.0
2425
oauthproxy.go+3
@@ -576,6 +576,7 @@ func (p *OAuthProxy) IsValidRedirect(redirect string) bool {
576576 case strings.HasPrefix(redirect, "http://") || strings.HasPrefix(redirect, "https://"):
577577 redirectURL, err := url.Parse(redirect)
578578 if err != nil {
579+ logger.Printf("Rejecting invalid redirect %q: scheme unsupported or missing", redirect)
579580 return false
580581 }
581582 redirectHostname := redirectURL.Hostname()
@@ -600,8 +601,10 @@ func (p *OAuthProxy) IsValidRedirect(redirect string) bool {
600601 }
601602 }
602603
604+ logger.Printf("Rejecting invalid redirect %q: domain / port not in whitelist", redirect)
603605 return false
604606 default:
607+ logger.Printf("Rejecting invalid redirect %q: not an absolute or relative URL", redirect)
605608 return false
606609 }
607610}