getPathname()); if (substr($p, -4) !== '.php' || preg_match('#/(tests|tools|backups|uploads|plugins)/#', $p)) continue; $src = (string) file_get_contents($p); $weakXfo = preg_match_all('/header\(\s*[\'"]X-Frame-Options:\s*([A-Za-z-]+)/i', $src, $m1) && array_filter($m1[1], fn($v) => strtoupper($v) !== 'DENY'); $weakCsp = preg_match_all('/frame-ancestors\s+([^;\'"]+|\'[a-z-]+\')/i', $src, $m2) && array_filter($m2[1], fn($v) => trim($v) !== "'none'"); if ($weakXfo || $weakCsp) $loosened[] = substr($p, strlen($root) + 1); } $check(!$loosened, 'Keine Seite lockert den Rahmenschutz: ' . implode(', ', $loosened)); if ($failures) { fwrite(STDERR, "Fehlgeschlagen:\n - " . implode("\n - ", $failures) . "\n"); exit(1); } echo "Rahmenschutz (iframe) bestanden.\n";