feat: add nonce for inline scripts (#1772)

This commit is contained in:
Marvin Hagemeister
2023-09-14 09:39:53 +02:00
committed by GitHub
parent e67a8dc106
commit 6d9afd62ab
6 changed files with 101 additions and 64 deletions
+7
View File
@@ -151,6 +151,13 @@ options.vnode = (vnode) => {
};
options.__b = (vnode: VNode<Record<string, unknown>>) => {
// Add CSP nonce to inline script tags
if (typeof vnode.type === "string" && vnode.type === "script") {
if (!vnode.props.nonce) {
vnode.props.nonce = current!.getNonce();
}
}
if (
current && current.renderingUserTemplate
) {