Skip to content

Conversation

@AnujRNair
Copy link
Contributor

Summary

This change removes the devAllowUnsafe setting (which was a bit cryptic as to what it did) and instead introduces more fine grain control over when hashes and nonces are allowed to be included in a policy.

You can now set this by changing settings in additionalOptions or in cspPlugin as follows:

 hashEnabled: { 'script-src': true, 'style-src': true }, nonceEnabled: { 'script-src': true, 'style-src': true } 

These can be enabled disabled globally for all HtmlWebpackPlugin instances, or on an individual level for deeper customization

Requirements (place an x in each [ ])

@codecov
Copy link

codecov bot commented Jan 3, 2019

Codecov Report

Merging #29 into master-v3 will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@ Coverage Diff @@ ## master-v3 #29 +/- ## ========================================= Coverage 93.8% 93.8% ========================================= Files 2 2 Lines 113 113 Branches 21 21 ========================================= Hits 106 106 Misses 6 6 Partials 1 1
Impacted Files Coverage Δ
plugin.js 92.3% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b6d8fca...65d6c69. Read the comment docs.

@AnujRNair AnujRNair merged commit 86e1d2d into master-v3 Jan 3, 2019
@AnujRNair AnujRNair deleted the an-fine-control-hash-nonce branch January 3, 2019 21:29
AnujRNair added a commit that referenced this pull request Jan 30, 2019
* Allow different policies on individual HtmlWebpackPlugin instances (#26) * renaming disableCspPlugin to cspPlugin.enabled to be more inline with the main enabled setting * Adding the option to allow individual policies on a specific html webpack plugin instance * Updating README to reflect the new changes * Adding nonce attrs to external scripts where their host hasnt been defined in the CSP already (#27) * Adding nonce attrs to external scripts where their host hasnt been defined in the CSP already * Making sure that nonces are included when strict-dynamic is set, even if the domain has been whitelisted. Also validating static sources * If plugin is disabled, we should not modify the html at all (#28) * If plugin is disabled, we should not modify the html at all * Updating readme to reflect new recommendation of not including a blank meta tag - it will be added for us * 3.0.0-beta.1 * Fine Grain control for hashes and nonces (#29) * Changing devAllowUnsafe to be more fine-grain by allowing the dev to decide when to allow hashes and nonces * Updating readme to reflect new options * 3.0.0-beta.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants