Skip to content

Commit

Permalink
implement nonce for refresh csp
Browse files Browse the repository at this point in the history
  • Loading branch information
ynwd committed Aug 18, 2024
1 parent b67cafd commit 22213f3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion http/server/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ es.onmessage = function(e) {
h("script", {
src: `/js/refresh.js`,
async: true,
nonce,
}),
);
}
Expand All @@ -129,7 +130,7 @@ es.onmessage = function(e) {
"content-type": "text/html",
"x-request-id": new Date().getTime().toString(),
"Content-Security-Policy":
`default-src 'self'; script-src 'self' 'nonce-${nonce}'; style-src 'self' 'unsafe-inline'; font-src 'self'; img-src 'self'; frame-src 'self'`,
`default-src 'self'; script-src 'self' 'nonce-${nonce}' 'strict-dynamic'; style-src 'self' 'unsafe-inline'; font-src 'self'; img-src 'self'; frame-src 'self'`,
});
const children = typeof p.component == "function"
? h(p.component as FunctionComponent, { data, nonce })
Expand Down

0 comments on commit 22213f3

Please sign in to comment.