feat: make it secure

This commit is contained in:
tiddlygit-test 2021-03-21 17:32:16 +08:00
parent 94fe3a417b
commit 6df3ca5739
4 changed files with 6 additions and 2 deletions

View file

@ -5,6 +5,8 @@ const CspHtmlWebpackPlugin = require('csp-html-webpack-plugin');
const CircularDependencyPlugin = require('circular-dependency-plugin');
const CopyPlugin = require('copy-webpack-plugin');
const isDevelopment = process.env.NODE_ENV === 'development';
exports.main = [
// we only need one instance of TsChecker, it will check main and renderer all together
// new ForkTsCheckerWebpackPlugin(),
@ -34,7 +36,7 @@ exports.renderer = [
{
'base-uri': ["'self'"],
'object-src': ["'none'"],
'script-src': ["'self' 'unsafe-eval'"],
'script-src': [`'self' ${isDevelopment ? "'unsafe-eval'" : ''}`],
'style-src': ["'self' 'unsafe-inline'"],
'frame-src': ["'none'"],
'worker-src': ["'none'"],