--- name: subresource-integrity description: "Use when reviewing templates, rendered HTML, or shared components related to Add Subresource Integrity to external scripts. Validate the final browser-facing markup, not just the source framework abstraction." metadata: category: html priority: high difficulty: intermediate estimatedTime: "15" source: frontendchecklist.io url: https://frontendchecklist.io/en/rules/html/subresource-integrity --- # Add Subresource Integrity to external scripts When you load JavaScript from a CDN, you're trusting that CDN completely — if it's compromised, attackers can serve malicious JavaScript to all your users. SRI adds a cryptographic hash to the tag; the browser refuses to execute the script if the hash doesn't match the downloaded content, protecting users even if the CDN is compromised or the URL is hijacked. ## Quick Reference - Add integrity="sha384-..." to