check all CSP headers for iframe disallowing

This commit is contained in:
Joe Lothan 2026-05-20 00:32:56 -04:00
parent a8177a1583
commit c9ea462e97

View file

@ -117,9 +117,11 @@ func CheckIframeAllowed(headers http.Header) bool {
return false
}
csp := strings.ToLower(headers.Get("Content-Security-Policy"))
if strings.Contains(csp, "frame-ancestors") && !strings.Contains(csp, "frame-ancestors *") {
return false
for _, csp := range headers.Values("Content-Security-Policy") {
csp = strings.ToLower(csp)
if strings.Contains(csp, "frame-ancestors") && !strings.Contains(csp, "frame-ancestors *") {
return false
}
}
return true