jgonzales394

CSP helmet setup

Nov 14th, 2020
1,414
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const scriptSources = ["'self'", "'unsafe-inline'", "'unsafe-eval'"];
  2. const styleSources = ["'self'", "'unsafe-inline'"];
  3. const connectSources = ["'self'"];
  4.  
  5. app.use(
  6.   helmet.contentSecurityPolicy({
  7.     directives: {
  8.       defaultSrc: ["'self'"],
  9.       scriptSrc: scriptSources,
  10.       scriptSrcElem: scriptSources,
  11.       styleSrc: styleSources,
  12.       connectSrc: connectSources
  13.     },
  14.   })
  15. );
Advertisement
Add Comment
Please, Sign In to add comment