Glossary

What is SRI (Subresource Integrity)?

Also called: Subresource Integrity, integrity attribute

Many sites load script files from another company's server, such as cdnjs, jsDelivr or unpkg. SRI adds an integrity value to the script tag: a fingerprint of the exact file you chose. The browser checks the downloaded file against that fingerprint and refuses to run it if they differ.

Why it matters

If that other server is hacked or sold, a changed file would run on your pages and reach your visitors. In June 2024 the polyfill.io script service changed owner and served harmful code to sites that loaded it. SRI blocks a changed file. A host known to send harmful code has to be removed.

How Onbiom checks it

Onbiom's rule: we read the script tags of the homepage we already loaded. It fails when a script comes from a host named in public supply-chain attack warnings, such as polyfill.io. It also fails when a versioned file from a public script library (cdnjs, jsDelivr, unpkg, code.jquery.com or the Bootstrap CDN) has no integrity value.

It passes when every versioned library file has an integrity value. If your homepage loads no versioned library files, the check does not apply and is not counted. Tag managers, analytics and payment scripts change by design, so they cannot carry a fixed fingerprint and are not checked here.

In your report this appears as: Scripts from other companies are protected.

How to check it yourself

  1. Open your homepage, right-click and choose View page source.
  2. Search for <script src= and look at addresses on cdnjs, jsDelivr, unpkg or code.jquery.com that contain a version number.
  3. Check that each of those tags has integrity="sha384-..." (or sha256 or sha512) and crossorigin="anonymous".
curl -s https://example.com | grep -o '<script[^>]*src=[^>]*>'

Not sure about your own site? Paste your address and see in a minute which of these checks your site passes. Free, no account needed.

Check your site

How to fix it

Any website
Get the script tag from the library's own page with its copy button. cdnjs and the jQuery CDN include the integrity value in the tag they copy. Replace your tag with it, keep crossorigin="anonymous", and remove any script from polyfill.io or another host named in attack warnings.
WordPress and other builders
The theme or plugin that adds the script writes the tag. Ask its developer to add the integrity value, or switch to a plugin that loads the file from your own site.
Ask your web person
Add integrity and crossorigin="anonymous" to every versioned script from a public library, and update the value whenever you change the version.

Related terms

Sources and further reading

Last reviewed: