demo ยท v135

Detect a swapped CDN bundle

The original SRI required the page to know the exact hash of every imported subresource — great for pinned versions, useless when the CDN auto-updates. Signature-based integrity flips the trust model: the script signs the response with a long-lived key, the page declares only the public key in integrity, and any tampering (a malicious CDN release, a compromised origin) breaks the signature. Watch the verifier fail when the response body is mutated by one byte.

WebCrypto Ed25519: ?

page

<script
  src="https://cdn.example/app.js"
  integrity="ed25519-{pubkey}">
</script>

cdn response

HTTP/1.1 200
Integrity-Signature: ed25519=...
Content-Type: text/javascript

console.log("hello");

attacker swap

// Mutates one byte:
console.log("h3llo");
// Signature now doesn't match.

see also