diff --git a/src/Header.php b/src/Header.php index 5fada875a1..f026fb03f6 100644 --- a/src/Header.php +++ b/src/Header.php @@ -22,9 +22,9 @@ use Psr\Clock\ClockInterface; use function array_merge; use function htmlspecialchars; +use function implode; use function ini_get; use function json_encode; -use function sprintf; use const JSON_HEX_TAG; @@ -332,7 +332,49 @@ class Header /** @return array */ public function getHttpHeaders(ClockInterface|null $clock = null): array { - $headers = []; + $headers = [ + 'Referrer-Policy' => 'same-origin', + + 'Content-Security-Policy' => $this->getCspHeader(), + + /** + * Re-enable possible disabled XSS filters. + * + * @see https://developer.mozilla.org/docs/Web/HTTP/Headers/X-XSS-Protection + */ + 'X-XSS-Protection' => '1; mode=block', + + /** + * "nosniff", prevents Internet Explorer and Google Chrome from MIME-sniffing + * a response away from the declared content-type. + * + * @see https://developer.mozilla.org/docs/Web/HTTP/Headers/X-Content-Type-Options + */ + 'X-Content-Type-Options' => 'nosniff', + + /** + * Adobe cross-domain-policies. + * + * @see https://www.sentrium.co.uk/labs/application-security-101-http-headers + */ + 'X-Permitted-Cross-Domain-Policies' => 'none', + + /** + * Robots meta tag. + * + * @see https://developers.google.com/search/docs/crawling-indexing/robots-meta-tag + */ + 'X-Robots-Tag' => 'noindex, nofollow', + + /** + * The HTTP Permissions-Policy header provides a mechanism to allow and deny + * the use of browser features in a document + * or within any