External scripts use Subresource Integrity hashes
Why it matters
When your app loads scripts from a CDN without Subresource Integrity hashes, you're trusting that the CDN will always serve exactly the file you expect. CDN compromises happen — an attacker who gains write access to a CDN bucket, a package registry, or a DNS record can replace jquery.min.js with a version that exfiltrates every form field on your page. OWASP A08 (Software and Data Integrity Failures) covers this supply chain vector directly. SLSA Level 2 requires artifact integrity verification. CWE-829 (Inclusion of Functionality from Untrusted Control Sphere) and CWE-494 (Download of Code Without Integrity Check) both map to external scripts without SRI.
Severity rationale
Info because SRI primarily protects against CDN-level compromise, a low-frequency attack that requires third-party infrastructure control to exploit.
Remediation
Add integrity and crossorigin attributes to every external <script> and <link rel="stylesheet"> tag. Generate the hash from the exact file version you're pinning.
<script
src="https://cdn.example.com/lib.min.js"
integrity="sha384-oqVuAfXRKap7fdgcCY5uykM6+R9GqQ8K/uxy9rx7HNQlGYl1kPzQho1wx4JwY8w"
crossorigin="anonymous">
</script>
Generate hashes at https://www.srihash.org/ or via shasum -a 384 lib.min.js | xxd -r -p | base64. The long-term fix is to bundle external dependencies rather than loading them from CDNs — then SRI is moot because the asset is yours.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Security Headers & Basics Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- cwe · CWE-353 — Missing Support for Integrity Check
- cwe · CWE-494 — Download of Code Without Integrity Check
- cwe · CWE-829 — Inclusion of Functionality from Untrusted Control Sphere
- owasp:2021 · A08 — Software and Data Integrity Failures
- slsa:1.0 · L2 — Source and build integrity
- soc2:2017 · CC6.8 — Prevention and detection of unauthorized or malicious software
Taxons
History
- 2026-04-17·v1.0.0·Initial import from security-headers·automated
- 2026-07-06·v1.0.1·Add SOC 2 TSC mapping (CC6.8) from the verified compliance crosswalk register (docs/compliance/).·by soc2-mapping-enrichment-ship-2