Skip to content

Commit

Permalink
clickjacking prevention via X-Frame-Options and Content-Security-Poli…
Browse files Browse the repository at this point in the history
…cy headers
  • Loading branch information
ollyg committed Oct 6, 2021
1 parent 726e8c6 commit 381f412
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions Build.PL
Expand Up @@ -71,6 +71,7 @@ Module::Build->new(
'Plack::Handler::Twiggy' => '0',
'Plack::Middleware::Debug' => '0',
'Plack::Middleware::Expires' => '0.03',
'Plack::Middleware::Headers' => '0',
'Plack::Middleware::ReverseProxy' => '0.15',
'Pod::Usage' => 0,
'Regexp::Common' => 2017060201,
Expand Down
6 changes: 6 additions & 0 deletions bin/netdisco-web-fg
Expand Up @@ -31,6 +31,12 @@ BEGIN {

set plack_middlewares => [
['Plack::Middleware::ReverseProxy'],
[ Headers => (
set => ['X-Frame-Options' => setting('HTTP-Header-X-Frame-Options')],
)],
[ Headers => (
set => ['Content-Security-Policy' => setting('HTTP-Header-Content-Security-Policy')],
)],
[ Expires => (
content_type => [qr{^application/javascript}, qr{^text/css}, qr{image}, qr{font}],
expires => 'access plus 1 day',
Expand Down
3 changes: 3 additions & 0 deletions share/config.yml
Expand Up @@ -533,3 +533,6 @@ template: 'netdisco_template_toolkit'
route_cache: true
appname: 'Netdisco'
behind_proxy: false
HTTP-Header-X-Frame-Options: 'DENY'
HTTP-Header-Content-Security-Policy: 'none'

0 comments on commit 381f412

Please sign in to comment.