Skip to content

Commit

Permalink
fix nonce syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
mastercoms committed Jul 11, 2024
1 parent 16cc738 commit 13fad06
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion astro.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const astroCSPHashExporter: AstroIntegration = {
scriptSrcHashes,
);
// Not ideal, but protects against non-targeted attacks. We don't really have options for non-dynamic content.
const scriptSrcNonce = crypto.randomBytes(16).toString("base64");
const scriptSrcNonce = `'nonce-${crypto.randomBytes(16).toString("base64")}'`;
headersFile = headersFile.replace("{{SCRIPT_SRC_NONCE}}", scriptSrcNonce);
const styleSrcElementHashes = `'${sriHashes.inlineStyleHashes.join("' '")}'`;
headersFile = headersFile.replace(
Expand Down

0 comments on commit 13fad06

Please sign in to comment.