Merge pull request from GHSA-qqxw-m5fj-f7gv
check for /\ redirects
This commit is contained in:
commit
a316f8a06f
|
|
@ -17,7 +17,7 @@
|
||||||
- DigitalOcean provider support added
|
- DigitalOcean provider support added
|
||||||
|
|
||||||
## Important Notes
|
## Important Notes
|
||||||
N/A
|
- (Security) Fix for open redirect vulnerability.. a bad actor using `/\` in redirect URIs can redirect a session to another domain
|
||||||
|
|
||||||
## Breaking Changes
|
## Breaking Changes
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -558,7 +558,7 @@ func validOptionalPort(port string) bool {
|
||||||
// IsValidRedirect checks whether the redirect URL is whitelisted
|
// IsValidRedirect checks whether the redirect URL is whitelisted
|
||||||
func (p *OAuthProxy) IsValidRedirect(redirect string) bool {
|
func (p *OAuthProxy) IsValidRedirect(redirect string) bool {
|
||||||
switch {
|
switch {
|
||||||
case strings.HasPrefix(redirect, "/") && !strings.HasPrefix(redirect, "//"):
|
case strings.HasPrefix(redirect, "/") && !strings.HasPrefix(redirect, "//") && !strings.HasPrefix(redirect, "/\\"):
|
||||||
return true
|
return true
|
||||||
case strings.HasPrefix(redirect, "http://") || strings.HasPrefix(redirect, "https://"):
|
case strings.HasPrefix(redirect, "http://") || strings.HasPrefix(redirect, "https://"):
|
||||||
redirectURL, err := url.Parse(redirect)
|
redirectURL, err := url.Parse(redirect)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue