server: lowercase hostname for Host header check (#5851)

This commit is contained in:
frob 2024-12-10 22:43:22 +01:00 committed by GitHub
parent dd42acf737
commit 757eeacc1b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1071,11 +1071,13 @@ func isLocalIP(ip netip.Addr) bool {
}
func allowedHost(host string) bool {
host = strings.ToLower(host)
if host == "" || host == "localhost" {
return true
}
if hostname, err := os.Hostname(); err == nil && host == hostname {
if hostname, err := os.Hostname(); err == nil && host == strings.ToLower(hostname) {
return true
}