check all CSP headers for iframe disallowing
This commit is contained in:
parent
a8177a1583
commit
c9ea462e97
1 changed files with 5 additions and 3 deletions
|
|
@ -117,10 +117,12 @@ func CheckIframeAllowed(headers http.Header) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
csp := strings.ToLower(headers.Get("Content-Security-Policy"))
|
for _, csp := range headers.Values("Content-Security-Policy") {
|
||||||
|
csp = strings.ToLower(csp)
|
||||||
if strings.Contains(csp, "frame-ancestors") && !strings.Contains(csp, "frame-ancestors *") {
|
if strings.Contains(csp, "frame-ancestors") && !strings.Contains(csp, "frame-ancestors *") {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue