Skip to content

Instantly share code, notes, and snippets.

@cfm
cfm / worker.js
Last active July 1, 2023 01:19 — forked from richie5um/worker.js
Cloudflare Worker script to apply a dynamic Content-Security-Policy header for each fetch request
// Cloudflare Worker script to apply a dynamic Content-Security-Policy header
// for each fetch request by:
//
// 1. generating a per-request nonce;
//
// 2. injecting it into the "nonce" attribute on all SCRIPT and STYLE elements;
// and
//
// 3. adding a Content-Security-Policy allowing that nonce in the "script-src"
// and "style-src" attributes.
@cfm
cfm / .treehouse
Last active July 17, 2019 19:21 — forked from ErikGartner/.treehouse
dtree-blockchain
1.3.1