Short answer: Cloudflare’s JavaScript Detections adds a small script to HTML pages, so the two HTML files of our web app never matched the fingerprints we had signed. Our check caught it, which is what signing is for. The fix was to check the files as plain bytes, which Cloudflare leaves alone. Our own website had a second fix all along: a single Cache-Control directive.
fwd’s web app, at app.usefwd.io, sends its code from the server on each visit, so every release is signed and your browser runs only releases that check out. This is how the first signed release failed its own check, and what I changed.
| November 13, 2026 (UTC) | What happened |
|---|---|
| 22:35 | The first signed release goes live. The deploy’s own checks pass. |
| After that | A check of every file from outside finds index.html and licences.html don’t match their signed fingerprints. |
| 22:39 | The fix: the checks read each file through a route that serves it as plain bytes, never as HTML. |
| 22:41 | The next signed release goes live, and every one of its files matches. |
What we sign
A web page’s code comes from the server each time you open it, so a changed file could, in principle, read what you type. To guard against that, each release of the web app is a list of every file it’s served from, 22 of them, with each file’s SHA-256. The list is signed with an ECDSA P-256 key kept on my own machines, never on the servers that host the page, and the public key is built into the app’s service worker.
The service worker downloads a new release only if its signature checks out, then checks every file against the list before it keeps any of them. Once a browser has used the web app, it serves the app only from a release it kept, and it takes a new one only if it’s signed and newer. At this point only my own account could add a browser; the web app launched for everyone three days later.
The first release failed its own check
The deploy script checked two things after the first signed release went live: that the server sent the signed list byte for byte, and that app.js matched its fingerprint. Both passed. Then I fetched every file from outside and compared each one with the list. The two HTML files, index.html and licences.html, didn’t.
The service worker would have refused that release for the same reason: it checked each file it downloaded against the list, and two of them could never match. Signing did its job. The thing that had changed our files was just closer to home than an attacker.
What Cloudflare adds to an HTML page
Our zone has Cloudflare’s JavaScript Detections turned on. It’s part of Cloudflare’s bot protection, and it’s always on with Bot Fight Mode; we have Bot Fight Mode off and JavaScript Detections on. Cloudflare’s documentation says that, turned on this way, it inserts a script tag in all HTML pages served on your website.[1] It isn’t added to requests that aren’t for HTML pages.[1]
What arrives is an inline <script> just before </body>. It creates a hidden 1-by-1 iframe, sets window.__CF$cv$params with the request’s Ray ID, and loads /cdn-cgi/challenge-platform/scripts/jsd/main.js. When I checked again for this post, it added 1,114 bytes to each of our two HTML files. Because the Ray ID is different on every request, the page’s SHA-256 is different every time you fetch it, so no fingerprint could ever match it.
We had seen this before, without connecting it to signing. The web app’s content policy allows only scripts from its own files, so the browser blocks the inline script, and that shows up as one console error. Cloudflare documents that error for sites with a content policy like ours.[1] The page itself works as it should.
The fix: check bytes that were never HTML
- A raw route: the web app’s Worker serves every file of a release a second time at
/__release/<path>, asapplication/octet-stream. Cloudflare doesn’t inject anything into a response that isn’t HTML, so these are the exact bytes we signed. - The service worker reads through it: it downloads each file from the raw route, checks it against the signed list, and keeps it with a content type it sets itself from the file’s name, along with the page’s security headers. It never takes either from the server.
- The deploy checks what browsers check: after every release, the deploy script now fetches every file through the raw route and compares it with the list. If one doesn’t match, it puts the previous version back and fails.
You can see both sides today: the copy at /__release/index.html matches its signed fingerprint, and the page at /index.html still carries Cloudflare’s script, so it doesn’t. Once your browser has kept a release, its pages come from that copy, without the script.
The switch we already had
Cloudflare also documents a simpler way: if a response has Cache-Control: no-transform, it doesn’t inject the JavaScript Detections script.[1][2] The same directive also turns off Cloudflare’s compression for that response.[2]
When I went back over this for the post, I found that our own website, usefwd.io, has sent no-transform on every HTML page for exactly this reason: a comment in its code says Cloudflare documents the directive as turning off the script. The web app’s Worker didn’t. At the time, I changed what the checks read rather than how the page is served, and didn’t think of the header we already used next door.
If you sign or hash pages behind Cloudflare
- Find out what your zone does to HTML. With JavaScript Detections on, HTML pages get a script; on ours it was different on every request. Fetch a page twice and compare.
- Pick a way around it: send
Cache-Control: no-transformon the pages you sign (which also turns off compression there), or check the files somewhere that isn’t served as HTML. - Check what your users’ browsers check, from outside. Our deploy checked two files and passed. Checking every file from outside is what found the problem, so that is what the deploy does now.
- Mind your content policy. With a strict policy and no nonce, the injected script is blocked and you’ll see a console error. If your policy uses a nonce, Cloudflare adds it to the scripts it injects.[1]
Signing doesn’t cover everything: the very first visit, and the service worker itself, still come from the server as it sends them. Why the fwd web app can’t be used to get into your account has those limits, and the security page has the details.
Related guides
- Why the fwd web app can’t be used to get into your account
- End-to-end encrypted ways to send files between your devices
Sources
Checked on November 18, 2026.
- JavaScript Detections. Cloudflare Docs.
- Origin Cache Control. Cloudflare Docs.
