QA
Intermediate LevelWeb Security & Cyber Defense

How do modern browsers enforce CSP frame-ancestors over legacy X-Frame-Options headers?

❓ Interview Prompt: Compare `X-Frame-Options` (`DENY`, `SAMEORIGIN`) vs CSP `frame-ancestors` (`'self'`, specific origins, `'none'`).

Comparing frame embedding restrictions:

•
'X-Frame-Options' (Legacy): Only supports 'DENY' or 'SAMEORIGIN'. Cannot specify multiple allowed framing parent domains.
•
CSP 'frame-ancestors' (Modern Standard): Provides fine-grained control: 'frame-ancestors 'self' https://trusted-partner.com'. Supersedes 'X-Frame-Options' in all modern browsers!

Code Implementation Example

http
HTTP/1.1 200 OK
Content-Security-Policy: frame-ancestors 'self' https://dashboard.partner.com;
💡CSP frame-ancestors header granting specific parent domain framing permissions.
🎯 Interview Key Takeaway

Use CSP frame-ancestors to explicitly control which parent origins can embed your web application in iframes.

#Clickjacking#CSP#frame-ancestors#Intermediate
Back to all Web Security & Cyber Defense Questions→

More Web Security & Cyber Defense Interview Questions

Beginner LevelSecurity & Web Security

Explain OWASP Top 10 vulnerabilities (XSS, CSRF, SQL Injection) and their defenses.

Beginner LevelSecurity & Web Security

What are the 3 types of XSS (Stored, Reflected, DOM-based) and how do they differ?

Beginner LevelSecurity & Web Security

How do Parameterized Queries (Prepared Statements) prevent SQL Injection attacks?