'unsafe-eval'

A CSP keyword that allows code to be built from strings at runtime with eval() and similar functions.

It re-enables string-to-code execution that injected data can abuse.

In more detail

Code that builds functions from strings, such as new Function(), is also blocked without it. String-to-code functions are a common XSS path, so strict policies leave this keyword out.

Related terms

Taught in

References