Helmet CSP not working correctly?

自闭症网瘾萝莉.ら 提交于 2020-12-07 03:41:59

问题


Using Vue SPA distributed by Express.

this is my helmet code in express

app.use(helmet.contentSecurityPolicy({
  directives: {
   defaultSrc: ["'self'"],
   styleSrc: ["'self'","'unsafe-inline'" ,'unpkg.com', 'cdn.jsdelivr.net', 
   'fonts.googleapis.com', 'use.fontawesome.com'],
   scriptSrc: ["'self'","'unsafe-inline'",'js.stripe.com'],
   frameSrc: ["'self'",'js.stripe.com'],
   fontSrc:["'self'",'fonts.googleapis.com','fonts.gstatic.com','use.fontawesome.com','cdn. joinhoney.com']
 }
}));

Doing this produces no errors in the browser console but my page loads blank , am I missing something ?

Here is the stuff i'm trying to import in my index.html

<script src="https://js.stripe.com/v3/"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/animate.css@3.5.2/animate.min.css">
<link href="https://unpkg.com/vuetify/dist/vuetify.min.css" rel="stylesheet">
<link href='https://fonts.googleapis.com/css?family=Roboto:300,400,500,700%7CMaterial+Icons' rel="stylesheet">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.13/css/all.css" integrity="sha384-DNOHZ68U8hZfKXOrtjWvjxusGo9WQnrNx2sqG0tfsghAvtVlRW3tvkXWZh58N9jp" crossorigin="anonymous">

回答1:


Solved my issue by adding "'unsafe-eval'" to my scriptSrc



来源:https://stackoverflow.com/questions/51469937/helmet-csp-not-working-correctly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!