You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Adding option for the dev to choose whether to allow unsafe eval/inline in their csp policy or not. Defaults to false for backwards compatibility
* Updating README to reflect the new devAllowUnsafe option
Copy file name to clipboardExpand all lines: README.md
+7-4Lines changed: 7 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -39,10 +39,11 @@ Finally, add the following tag to your HTML template where you would like to add
39
39
This `CspHtmlWebpackPlugin` accepts 2 params with the following structure:
40
40
*`{object}` Policy (optional) - a flat object which defines your CSP policy. Valid keys and values can be found on the [MDN CSP](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy) page. Values can either be a string or an array of strings.
41
41
*`{object}` Additional Options (optional) - a flat object with the optional configuration options:
42
-
*`{string}`hashingMethod - accepts 'sha256', 'sha384', 'sha512' - your node version must also accept this hashing method.
42
+
*`{boolean}`devAllowUnsafe - if you as the developer want to allow `unsafe-inline`/`unsafe-eval` and _not_ include hashes for inline scripts. If any hashes are included in the policy, modern browsers ignore the `unsafe-inline` rule.
43
43
*`{boolean|Function}` enabled - if false, or the function returns false, the empty CSP tag will be stripped from the html output. The `htmlPluginData` is passed into the function as it's first param.
44
+
*`{string}` hashingMethod - accepts 'sha256', 'sha384', 'sha512' - your node version must also accept this hashing method.
44
45
45
-
_Note: CSP usually runs on all files processed from HTML Webpack plugin, to disable it for a particular instance, set `disableCspPlugin` to `true(boolean)` in [HTML Webpack Plugins Options](https://github.com/jantimon/html-webpack-plugin#options)_
46
+
_Note: CSP runs on all files created by HTMLWebpackPlugin. You can disable it for a particular instance by setting `disableCspPlugin` to `true` in the HTMLWebpackPlugin options
46
47
47
48
#### Default Policy:
48
49
@@ -59,8 +60,9 @@ _Note: CSP usually runs on all files processed from HTML Webpack plugin, to disa
0 commit comments