slackhq / csp-html-webpack-plugin

A plugin which, when combined with HTMLWebpackPlugin, adds CSP tags to the HTML output.
MIT License
164 stars 40 forks source link

Fine Grain control for hashes and nonces #29

Closed AnujRNair closed 5 years ago

AnujRNair commented 5 years ago

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[bot] commented 5 years ago

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%> (ø) :arrow_up:

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.