I was developing a nodejs app and implemented some security, I used helmet like this
app.use(helmet())
Now the browser does not allow me to use third party libraries and inline script. You can check the screenshot.
I found a solution - see here:
app.use(helmet({ contentSecurityPolicy: false }))
Now everything is solved.
I want to know that why this happen how to use 3rd party libraries and inline scripts without the setting contentSecurityPolicy: false
in helmet.
I also found about we must include a manifest.json
file in public folder and mention all third party libraries in it. How to implement that? Thanks in advance
Helmet maintainer here.
This is happening because of something called Content Security Policy, which Helmet sets by default. To solve your problem, you will need to configure Helmet's CSP.
MDN has a good documentation about CSP which I would recommend reading for background. After that, take a look at Helmet's README to see how to configure its CSP component.
In summary: to solve your problem, you will need to tell Helmet to configure your CSP.