Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EPMRPP-86851 || Implement SRI for scripts #3610

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
"@babel/preset-env": "7.16.8",
"@babel/preset-react": "7.16.7",
"@pmmmwh/react-refresh-webpack-plugin": "0.5.10",
"@sowtame/webpack-subresource-integrity": "2.0.0",
"@types/jest": "24.9.0",
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.7",
"axios-mock-adapter": "1.17.0",
Expand Down
12 changes: 7 additions & 5 deletions app/webpack/prod.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CompressionPlugin = require('compression-webpack-plugin');
// const { SubresourceIntegrityPlugin } = require('webpack-subresource-integrity');
const { SubresourceIntegrityPlugin } = require('@sowtame/webpack-subresource-integrity');
const TerserPlugin = require('terser-webpack-plugin');
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');

module.exports = {
mode: 'production',
output: {
// crossOriginLoading: 'anonymous',
crossOriginLoading: 'anonymous',
},
module: {
rules: [
Expand Down Expand Up @@ -69,10 +70,11 @@ module.exports = {
minRatio: 0.8,
}),
// TODO: wait until https://github.com/waysact/webpack-subresource-integrity/issues/176 will be resolved
// new SubresourceIntegrityPlugin({
// hashFuncNames: ['sha256', 'sha384'],
// hashLoading: 'lazy',
// }),
// TODO we are forced to use it because of webpack-subresource-integrity has not introduced the fix yet
new SubresourceIntegrityPlugin({
hashFuncNames: ['sha256', 'sha384'],
hashLoading: 'lazy',
}),
],
optimization: {
minimize: true,
Expand Down
Loading