-
Notifications
You must be signed in to change notification settings - Fork 6
Description
Hello. I found your csp-nonce-worker while doing research for my own Cloudflare Worker. I prefer to use nonces for CSP, but have had a hard time getting them to work with static site generated (SSG) front ends.
I wanted to ask if there's a way to keep the nonce default value secret. Your README example shows a default nonce string for the stylesheet:
<link rel="stylesheet" href="/styles.css" nonce="DhcnhD3khTMePgXw" />This article by Scott Helme from 2017 demonstrates adding nonces with Nginx header rewrites. At the bottom of the article he specifically calls attention to the default value needing to be kept a secret.
Update 16 Jan 2017:
A few people on Twitter have pointed out that I wasn't clear enough about the fact that the nonce substitution value has to be kept a secret. If an attacker finds out this value they can use it to inject into their own script tag and Nginx would rewrite a valid nonce into it for them. This value must be kept secret.
I'm asking because I would like to implement your Worker, but haven't found a way to inject the default nonce string in a way that keeps it out of templates as a hard-coded value.