Skip to content

Commit

Permalink
✨ added feature policy with defaults
Browse files Browse the repository at this point in the history
🔧 X-Frame-Options = DENY, strict-transport-security += preload

Signed-off-by: Bruno Meilick <b@bnomei.com>
  • Loading branch information
bnomei committed Feb 16, 2020
1 parent 6fe7e84 commit caa74e4
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
1 change: 1 addition & 0 deletions classes/SecurityHeaders.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ public function sendHeaders(): bool
// from config
$headers = $this->option('headers');
foreach ($headers as $key => $value) {
$value = is_array($value) ? implode('; ', $value) : $value;
header($key . ': ' . $value);
}

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "bnomei/kirby3-security-headers",
"type": "kirby-plugin",
"version": "2.2.5",
"version": "2.3.0",
"license": "MIT",
"description": "Kirby 3 Plugin for easier Security Headers setup",
"authors": [
Expand Down
30 changes: 30 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,36 @@
"X-Content-Type-Options" => "nosniff",
"strict-transport-security" => "max-age=31536000; includeSubdomains; preload",
"Referrer-Policy" => "no-referrer-when-downgrade",
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Feature-Policy
"Feature-Policy" => [
"accelerometer 'none'",
"ambient-light-sensor 'none'",
"autoplay 'none'",
"battery 'none'",
"camera 'none'",
"display-capture 'none'",
"document-domain 'none'",
"encrypted-media 'none'",
"execution-while-not-rendered 'none'",
"execution-while-out-of-viewport 'none'",
"fullscreen 'none'",
"geolocation 'none'",
"gyroscope 'none'",
"layout-animations 'none'",
"legacy-image-formats 'none'",
"magnetometer 'none'",
"microphone 'none'",
"midi 'none'",
"navigation-override 'none'",
"oversized-images 'none'",
"payment 'none'",
"picture-in-picture 'none'",
"publickey-credentials 'none'",
"sync-xhr 'none'",
"usb 'none'",
"wake-lock 'none'",
"xr-spatial-tracking 'none'",
],
],
'loader' => function () {
// https://github.com/paragonie/csp-builder#example
Expand Down

0 comments on commit caa74e4

Please sign in to comment.