+ 7
Why eval() is evil?
I just saw a youtube content about the eval() function and read some stuffs about eval() in google. I can see eval() is pretty useful to use evaluate strings to js code. But they say that using eval() is "evil" and dangerous and I don't get it why.
7 Answers
+ 8
Eval is considered risky and harmful. It is slow, and can contain malicious code like infinite loops, XSS(cross site scripting) attacks etc.
It should be never used or only in very specific secured applications.
Personally I disable it in Content-Security-Policy(CSP) so it is not possible to use it.
https://en.wikipedia.org/wiki/Content_Security_Policy
+ 4
https://www.sololearn.com/post/97586/?ref=app
https://code.sololearn.com/WKKkpq0efxai/?ref=app
+ 4
https://nedbatchelder.com/blog/201206/eval_really_is_dangerous.html
+ 2
Michal Straka Mirielleš¶ [Inactive] thank youuu uwu. maybe i should disable that
+ 2
Mirielleš¶ [Inactive] oh. i thought it can be disabled. But thanks again uwu