Open duydang2311 opened 2 weeks ago
Possible remediations that spring to mind:
nonce
to render
(e.g. render(App, props, { nonce })
), though that won't work for prerendered pageshead
instead of inline if a certain option is provided, and return a hashes
array from render
alongside head
and body
Hello,
Another alternative would be to use unsafe-hashes, since all inserted codes have the same content : this.__e=event
=> This works :
csp: {
mode: "auto",
directives: {
"script-src": ["self", "unsafe-eval", "unsafe-hashes", "sha256-7dQwUgLau1NFCCGjfn9FsYptB6ZtWxJin6VohGIu20I="],
},
},
Describe the bug
Wrapping an
img
as a Svelte component results inonload="this.__e=event" onerror="this.__e=event"
generated in HTML output. It causes CSP issue related to inline execution.Below is my
csp
configuration and the error message.Reproduction
https://github.com/duydang2311/kit-img-csp-reproduction
Logs
System Info
Severity
annoyance
Additional Information
No response