Skip to content

Commit

Permalink
Make Content-Security-Policy disallow 'object-src' by default
Browse files Browse the repository at this point in the history
Closes #190
  • Loading branch information
LeoColomb committed Jun 24, 2021
1 parent ff080bb commit f993710
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions h5bp/security/content-security-policy.conf
Expand Up @@ -41,10 +41,17 @@
# The `frame-ancestors` directive helps avoid "Clickjacking" attacks and
# is similar to the `X-Frame-Options` header.
#
# Browsers that support the CSP header will ignore `X-Frame-Options` if
# Browsers that support the CSP header should ignore `X-Frame-Options` if
# `frame-ancestors` is also specified.
#
# (5) Forces the browser to treat all the resources that are served over HTTP
# (5) Elements controlled by `object-src` are perhaps coincidentally
# considered legacy HTML elements and are not receiving new standardized
# features (such as the security attributes `sandbox` or `allow` for
# `<iframe>`).
# Therefore it is recommended to restrict this fetch-directive (e.g.,
# explicitly set `object-src 'none'` if possible).
#
# (6) Forces the browser to treat all the resources that are served over HTTP
# as if they were loaded securely over HTTPS by setting the
# `upgrade-insecure-requests` directive.
#
Expand All @@ -53,7 +60,7 @@
# loaded over HTTPS you must include the `Strict-Transport-Security`
# header.
#
# (6) The `Content-Security-Policy` header is included in all responses
# (7) The `Content-Security-Policy` header is included in all responses
# that are able to execute scripting. This includes the commonly used
# file types: HTML, XML and PDF documents. Although Javascript files
# can not execute script in a "browsing context", they are still included
Expand All @@ -75,6 +82,6 @@
# https://content-security-policy.com/

<IfModule mod_headers.c>
# (1) (2) (3) (4) (5) (6)
Header always set Content-Security-Policy "default-src 'self'; base-uri 'none'; form-action 'self'; frame-ancestors 'none'; upgrade-insecure-requests" "expr=%{CONTENT_TYPE} =~ m#text\/(html|javascript)|application\/pdf|xml#i"
# (1) (2) (3) (4) (5) (6) (7)
Header always set Content-Security-Policy "default-src 'self'; base-uri 'none'; form-action 'self'; frame-ancestors 'none'; object-src 'none'; upgrade-insecure-requests" "expr=%{CONTENT_TYPE} =~ m#text\/(html|javascript)|application\/pdf|xml#i"
</IfModule>

0 comments on commit f993710

Please sign in to comment.