Bezpieczeństwo

security/csp-meta-ignored

frame-ancestors, report-uri, sandbox and X-Frame-Options are sent as HTTP headers; in a meta tag they do nothing.

umiarkowanastatycznefe-security

Dlaczego

Browsers ignore these settings when they come from a <meta> tag, so the page looks protected in the source but can still be framed by any site (clickjacking) and violations are never reported.

Poprawka

Send Content-Security-Policy (with frame-ancestors 'none' or 'self') and, for old browsers, X-Frame-Options: DENY as response headers from the server or the host's headers file. A meta CSP is fine for the directives it supports (script-src, default-src, object-src, base-uri), placed early in <head>.

Przykłady

# _headers
/*
  Content-Security-Policy: default-src 'self'; frame-ancestors 'none'; object-src 'none'; base-uri 'none'
  X-Frame-Options: DENY

Źródła

Fakty

Identyfikator
security/csp-meta-ignored
Waga
umiarkowana
Sprawdzanie
statyczne sprawdzane w kodzie źródłowym przez audit
Dotyczy plików
html vue svelte astro jsx
Uczy jej skill
fe-security Front-end security
Od wersji
0.1.0

Plik reguły na GitHubie

Przeczytaj w terminalu

npx github:dawidolko/frontend-skills explain security/csp-meta-ignored