Change record status: 
Project: 
Introduced in branch: 
11.x
Introduced in version: 
11.1
Description: 

Content Security Policy is a browser feature that helps prevent XSS and other attacks by sending a header that informs the browser of trusted sources for page resources. In modern browsers, it replaces the X-Frame-Options header with the directive frame-ancestors.

Drupal >= 11.1.0 will set a default enforced policy on responses that includes any X-Frame-Options header converted to a corresponding frame-ancestors directive.

  Content-Security-Policy: script-src * 'unsafe-inline'; object-src 'none'; frame-ancestors 'self'

Any value other than X-Frame-Options: SAMEORIGIN will cause a deprecation warning to be emitted, and should instead be set on the Content-Security-Policy header by setting the services parameter http.response.content_security_policy, which is an array with two keys - report_only and enforced.

parameters:
  http.response.content_security_policy:
    report_only: "default-src 'self'; object-src 'none'; frame-ancestors 'none'; webrtc 'block'"
    enforced: "script-src * 'unsafe-inline'; object-src 'none'; frame-ancestors 'self'"

Drupal >= 12.0.0 will only use the service parameter value, and no longer translate any X-Frame-Ancestors header value.

For additional information on Content Security Policy, see:

Impacts: 
Site builders, administrators, editors