Is it safe to remove 'unsafe-eval' from CSP?
'unsafe-eval'
Collapse
X
-
Hi Emmker,
as far as I know, removing unsafe-eval (and unsafe-inline) is safer, but it may break JS functions like eval() and JS constructors like Function().
In other words, the unsafe-eval directive allows the 'creation' of methods from strings, so it potentially opens the door to code injection attacks, but removing it may break some JS functions (if in the code)
In the past I was forced to insert the unsafe-eval and unsafe-inline directives in the Apache VirtualHost because otherwise the web-app did not work correctly.
-
If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.Comment
-
Hi Emmker,
as far as I know, removing unsafe-eval (and unsafe-inline) is safer, but it may break JS functions like eval() and JS constructors like Function().
In other words, the unsafe-eval directive allows the 'creation' of methods from strings, so it potentially opens the door to code injection attacks, but removing it may break some JS functions (if in the code)
yuri
I do not want to disable CSP all together.
I just have a request from my client to remove 'unsafe-eval' and add base-uri/object-src.
Is that possible or will it break espo functions?Last edited by Emmker; Today, 08:26 AM.Comment
-
I encourage to figure out by locking into code. It's been really hard for me to address multiple questions and resolving many issues on daily basis. The product would have been better if I haven't spent a big part of a day answering questions. Open source implies that everyone can look into code and figure out.If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.👍 1Comment
-
I assumed that things like unsafe-eval would rather concern coders. It's impossible to keep everything in memory. Usually, when answering questions I lookup in docs – Espo docs or MDN Web Docs for example.
I don't remember how the unsafe-eval parameter behaves. I needed to look up the docs https://developer.mozilla.org/en-US/...al_expressions.
It tells that it's opposite – removing unsafe-eval increases security. So the answer is: It's not unsafe to remove unsafe-eval. But if you remove, the application won't work. Usually, large web apps rely on apis that the unsafe-eval enables.If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.Comment
Comment