demo · v141
SRI: hash vs signature
Three real publisher events — bug-fix update, attacker-tampered byte, compromised origin — checked against both hash-based SRI and signature-based SRI. The verdict table shows where each mechanism wins, fails, and where the choice matters.
Pick the publisher event, see how each mechanism reacts:
hash-based SRI sha256-…
…
signature-based SRI ed25519-…
…
the integrity attribute
// Hash-based (existing) — pin to exact bytes
<script integrity="sha384-O2HSRT3sxxxxx" src="…"></script>
// Signature-based (new in 141) — pin to publisher public key
<script integrity="ed25519-MCowBQYDK2VwAyEAxxxx" src="…"></script>
// Both can coexist — accept either
<script integrity="sha384-O2HSRT3sxxxxx ed25519-MCowBQYDK2VwAyEAxxxx" src="…"></script>
why this angle
The two mechanisms protect against different threats. Hash-based SRI is a perfect content tamper detector but breaks the moment the publisher ships a legitimate update — many sites end up dropping SRI entirely because the maintenance cost is too high. Signature-based SRI lets legitimate updates through while still catching content tampering, but it relies on the publisher's signing key remaining secret. The matrix here makes the tradeoff explicit and helps readers pick which (or both) to use for a given dependency.