mirror of
https://github.com/steveiliop56/tinyauth.git
synced 2025-11-09 10:35:42 +00:00
fix: allow for all subdomains to be considered safe for redirection
This commit is contained in:
@@ -90,27 +90,19 @@ func IsRedirectSafe(redirectURL string, domain string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
parsedURL, err := url.Parse(redirectURL)
|
||||
parsed, err := url.Parse(redirectURL)
|
||||
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
if !parsedURL.IsAbs() {
|
||||
return false
|
||||
}
|
||||
hostname := parsed.Hostname()
|
||||
|
||||
host := parsedURL.Hostname()
|
||||
if host == domain {
|
||||
if strings.HasSuffix(hostname, domain) {
|
||||
return true
|
||||
}
|
||||
|
||||
cookieDomain, err := GetCookieDomain(redirectURL)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return cookieDomain == domain
|
||||
return hostname == domain
|
||||
}
|
||||
|
||||
func GetLogLevel(level string) zerolog.Level {
|
||||
|
||||
Reference in New Issue
Block a user