Skip to content

Commit

Permalink
Acknowledge that removing eval() can be hard: Link to trusted types
Browse files Browse the repository at this point in the history
  • Loading branch information
wbamberg committed Oct 22, 2024
1 parent 3bf64a2 commit 268b66b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion files/en-us/web/http/csp/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ Like inline JavaScript, if a CSP contains either a `default-src` or a `script-sr
setTimeout("console.log('hello from setTimeout')", 1);
```

The `unsafe-eval` keyword can be used to override this behavior, and as with `unsafe-inline`, and for the same reasons: **developers should avoid `unsafe-eval`**.
The `unsafe-eval` keyword can be used to override this behavior, and as with `unsafe-inline`, and for the same reasons: **developers should avoid `unsafe-eval`**. Sometimes it can be difficult to remove usages of `eval()`: in these situations, the [Trusted Types API](/en-US/docs/Web/API/Trusted_Types_API) can make it safer, by ensuring that the input meets a defined policy.

Unlike `unsafe-inline`, the `unsafe-eval` keyword does still work in a directive that contains nonce or hash expressions.

Expand Down

0 comments on commit 268b66b

Please sign in to comment.