How to fix: External script loaded without Subresource Integrity
A script or stylesheet is loaded from an external origin without a Subresource Integrity (SRI) hash. Note: SRI is impractical for continuously-updated third-party vendor scripts (analytics, ads, payment SDKs), which is why the overwhelming majority of production sites, including large, security-conscious ones, don't use it for those; it's most actionable for pinned, versioned static library includes.
Why it matters
Without SRI, if the CDN or third-party host serving the resource is compromised, attackers can replace the file with malicious code that executes in every visitor's browser, a supply chain attack.
SRI allows browsers to verify that a fetched resource has not been tampered with by checking a cryptographic hash.
How to fix it
- 1Generate hash: openssl dgst -sha384 -binary file.js | openssl base64 -A
- 2Add integrity="sha384-HASH" and crossorigin="anonymous" to the element
- 3Lock CDN URLs to specific versioned filenames
Code examples
Script with SRI
<script
src="https://cdn.example.com/lib.min.js"
integrity="sha384-COMPUTED_HASH"
crossorigin="anonymous"
></script>References
Detected automatically by VulnRadar. The check id is sri-missing, stable across every scan so you can filter or diff on it.
More headers checks
Questions
- How severe is External script loaded without Subresource Integrity?
- VulnRadar rates this low severity in the headers category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
- Does VulnRadar check for this automatically?
- Yes. It runs as part of every scan under the check id sri-missing, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does External script loaded without Subresource Integrity map to?
- It maps to CWE-353. In the OWASP Top 10 it falls under A08:2021.
Missing a check?
The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.