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,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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue