Skip to content

Commit fca1012

Browse files
committed
Added CspHtmlWebpackPlugin
1 parent f4063c7 commit fca1012

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

webapp/webpack.config.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const path = require('path');
22
const webpack = require('webpack');
33
const HtmlWebpackPlugin = require('html-webpack-plugin');
44
const CopyWebpackPlugin = require('copy-webpack-plugin');
5+
const CspHtmlWebpackPlugin = require('csp-html-webpack-plugin');
56
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
67
/*
78
*var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
@@ -147,6 +148,16 @@ module.exports = function (env) {
147148
*/
148149
chunks: [],
149150
}),
151+
new CspHtmlWebpackPlugin({
152+
'default-src': "'self'",
153+
'script-src': ["'self'", "'unsafe-inline'"],
154+
'style-src': ["'self'", "'unsafe-inline'"],
155+
'img-src': ["'self'", 'data:', 'blob:'],
156+
'frame-ancestors': ['*']
157+
}, {
158+
enabled: true,
159+
hashingMethod: 'sha256',
160+
}),
150161
new webpack.DefinePlugin({ 'process.env': { NODE_ENV: JSON.stringify(isProduction ? 'production' : 'development') } }),
151162
new MiniCssExtractPlugin({ filename: '[name].css' }),
152163
],

0 commit comments

Comments
 (0)