Skip to content

Commit

Permalink
Improve docs for how to modify the CSP (google#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
cramforce authored Oct 9, 2021
1 parent 676789e commit f66b940
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ npm run build

### Security

Generates a strong CSP for the base template.
Generates a strong [Content-Security-Policy (CSP)](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP) for the base template.

- Default-src is self.
- Disallows plugins.
Expand Down
1 change: 1 addition & 0 deletions _data/csp.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const CSP = {
// No plugins
["object-src", quote("none")],
// Script from same-origin and inline-hashes.
// If you need to add an external host for scripts you need to add an item like 'https://code.jquery.com/jquery-3.6.0.slim.min.js' to this list.
["script-src", SELF, /* Replaced by csp.js plugin */ "HASHES"],
// Inline CSS is allowed.
["style-src", quote("unsafe-inline")],
Expand Down
1 change: 1 addition & 0 deletions _includes/layouts/base.njk
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- See _data/csp.js for how to add to the CSP. -->
<meta http-equiv="Content-Security-Policy" content="{{ csp.regular | safe }}">
{% if isdevelopment %}
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
Expand Down

0 comments on commit f66b940

Please sign in to comment.