Subresource Integrity (SRI)

How an integrity hash on third-party scripts and stylesheets stops a compromised CDN from changing the code your visitors run.

What AuditX checks

The scan reads the HTML your server sends (not what scripts add later) and looks at every script and stylesheet loaded from another domain, including addresses that start with // and so load over the same scheme as the page. A file from your own domain or its www twin is not counted. For each one it checks whether the tag has an integrity attribute. If all have one the check passes, if any lack one it warns, and if the page loads no third-party files it is informational. The warning names the hosts the files without a hash come from, with the most files first, up to three. A host on that list may be your own CDN on another domain, such as a static files domain; there the hash still guards against a changed file, and your build tool may be able to add it for you. A short list of services that change their files on purpose, such as Google Fonts, Google Tag Manager, Stripe and reCAPTCHA, is left out because a fixed hash would break them. A file without an integrity attribute whose address names no version number, such as a vendor loader like widget.js or gpt.js, is also left out and named in the message, because the vendor can update it in place and a fixed hash would then break your site. A file on a public library CDN, such as jsDelivr, unpkg, cdnjs or code.jquery.com, always counts, because there you can pin a version and add its hash. The scan checks that the attribute is present, not that the hash is correct.

Why it matters

When you load a script from a CDN or a vendor, you run whatever that address serves, today and tomorrow. If their server is hacked, your visitors run the attacker's code on your pages.

An integrity hash pins the exact file you tested. The browser refuses to run it if even one byte has changed.

How to fix it

  1. For each third-party script or stylesheet that loads one fixed version, such as a versioned jQuery or Bootstrap file from a CDN, add an integrity attribute with the file's hash, and add crossorigin="anonymous".
  2. Many CDNs show the full tag with the hash on the library page. Otherwise generate it with the srihash.org tool or with openssl.
  3. Do not add a hash to files that change under the same address, like analytics or payment scripts. The browser would block them after their next update. Self-host a copy if you want to pin them.
<script src="https://cdn.example.com/lib/1.2.3/lib.min.js"
        integrity="sha384-BASE64HASHOFTHEFILE"
        crossorigin="anonymous"></script>

Does your site pass this check? A free scan runs it with every other check and shows the result in about a minute.

Scan my site

Sources

Related checks

Last reviewed 2026-11-13.