-
-
Notifications
You must be signed in to change notification settings - Fork 636
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CSP] enhancements to default policy #156
Labels
Milestone
Comments
Updated for clarifications! |
@Malvoz Can you make a PR? |
Malvoz
added a commit
to Malvoz/server-configs-apache
that referenced
this issue
Mar 18, 2019
LeoColomb
pushed a commit
to Malvoz/server-configs-apache
that referenced
this issue
Mar 23, 2019
LeoColomb
pushed a commit
to Malvoz/server-configs-apache
that referenced
this issue
Mar 23, 2019
LeoColomb
added a commit
that referenced
this issue
Mar 26, 2019
Fix #156 Co-authored-by: Léo Colombaro <git@colombaro.fr> Co-authored-by: <xhmikosr@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The current default:
Header set Content-Security-Policy "script-src 'self'; object-src 'self'"
means authors need to explicitly specify all types of directives that apply which may be a bit tedious to set up and maintain, e.g. (not considering crossorigin resources) a sites policy could eventually look something like:Instead I suggest setting
default-src 'self'
which acts like a fallback src to all fetch directives.With this approach, you would still need to include:
base-uri
document directive.form-action
andframe-ancestors
[suggested in #154] navigation directives.This is important because unlike fetch directives, the document- and navigation directives do not fallback to
default-src
, and allows all origins by default.New example default policy might look like:
[1] Note that setting
base-uri
to'self'
while not intending to use the<base>
element could break site functionality if an attacker manages to inject a<base href="https://my-site.com">
. Because the majority of sites do not use the base element, the value'none'
may be a better default.[2] Additionally, the
upgrade-insecure-requests
directive is recommended for secure context configurations to prevent mixed content.Finally, I think having an example of adding an external resource would be useful, such as allowing fonts from another origin.
font-src
is a fetch directive and falls back todefault-src
, however we still need to specify'self'
if we wish to add an external url such as google fonts:The text was updated successfully, but these errors were encountered: