Detector registry

Subresource Integrity: Pinning the Scripts You Load From CDNs

Do your CDN scripts carry an integrity hash? How LaunchTrust checks versioned CDN scripts for SRI, why polyfill.io matters and how to add it.

Updated 10 Nov 2026subresource integrity cdnSignals, not a verdict

Loading a library from a public CDN means trusting that the file never changes. Subresource Integrity (SRI) turns that trust into a check: you add the file's hash to the <script> tag, and the browser refuses to run a file that does not match. The 2024 polyfill.io incident showed why this matters: the domain changed hands and began serving malicious code to the sites that still loaded it.

What LaunchTrust checks

LaunchTrust reads the script tags on your public page that load from other hosts (<script src>, and href on an SVG <script>), resolving each address the way a browser does (including a <base href>). It checks versioned files on public CDNs that serve fixed files: cdnjs.cloudflare.com, cdn.jsdelivr.net, unpkg.com, code.jquery.com, BootstrapCDN, ajax.googleapis.com, ajax.aspnetcdn.com and cdn.datatables.net. Only exact versions (such as 3.7.1, in the path or in a file name like jquery-3.7.1.min.js) are checked, because a floating version such as @3 or @3.7 changes under the hash.

  • Not detected (medium): a script loads from polyfill.io or cdn.polyfill.io, the domain that served malicious code in the 2024 supply-chain attack. This counts as a gap.
  • Not detected (low): one or more versioned public-CDN scripts load without a valid integrity hash (missing, or not a well-formed sha256, sha384 or sha512 value). This is listed in the report but not counted as a gap.
  • Detected: every versioned public-CDN script carries a valid integrity hash.
  • Unable to determine: the page loads no versioned public-CDN scripts, so there was nothing to check, or its Content-Security-Policy is too complex for LaunchTrust to evaluate.

Only scripts a browser runs are checked; JSON and other data blocks are ignored, and so are a <script> inside MathML and a nomodule script, which current browsers never run. A script the page's own Content-Security-Policy blocks is ignored too, because it never loads; hash sources in the policy allow a script only when every hash in its integrity attribute is listed. Vendor scripts that are designed to update in place, such as analytics or payment tags, cannot use a fixed hash and are not part of this check.

Why it matters

  • A CDN is a single point of failure. If the CDN or the file is compromised, the changed code runs on your site with your visitors' data.
  • SRI makes that failure visible and harmless. A modified file fails the hash check and is not executed.
  • Abandoned script domains get reused. A domain you stopped thinking about can change owners, as polyfill.io did.

A concrete example

Reported as not detected (low):

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>

Reported as detected once sha384-… is replaced with the file's real hash (cdnjs and jsDelivr show it next to each file):

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"
  integrity="sha384-…" crossorigin="anonymous"></script>

How to address it

  1. Remove any polyfill.io script. Modern browsers rarely need it; self-host the few polyfills you still use.
  2. Copy the SRI hash from the CDN. cdnjs and jsDelivr show a ready-made integrity value for each file, or compute one with openssl dgst -sha384 -binary file.js | openssl base64 -A.
  3. Add crossorigin="anonymous" next to integrity so the browser can check the file.
  4. Pin exact versions in the URL, so the hash and the file stay in step.

Monthly check and monitoring scope

List your app for free and LaunchTrust runs all 38 website detectors on its public website once a month, then emails you how many gaps it found. Which gaps they are, the evidence and how to close them come with paid monitoring or a one-time Launch Audit.

Paid monitoring runs all 40 detectors (38 for websites and 2 for App Store and Google Play listings) and shows each finding with its evidence. Each monitored web app is re-scanned about every 24 hours (with ±6 hours of jitter); email alerts and an optional JSON webhook POST report new gaps.

FAQ

Why is my analytics tag not flagged? Vendor tags such as analytics, chat or payment scripts change in place by design, so a fixed hash would break them. This check covers versioned library files on public CDNs.

What happens if the CDN updates the file? For an exact version, it should not. If the file does change, the browser refuses it, which is the point: you then update the hash on purpose.

Is self-hosting better than SRI? Self-hosting removes the third party entirely and is a good option. SRI is the way to keep using a public CDN with a check on what it serves.

Compliance aid, not legal advice. LaunchTrust reports signals, not a verdict or certification.