The library your page loads from a CDN is not the same file it was yesterday, and the page runs it without noticing. If a scan told you that integrity is missing, this article covers what SRI does and how to add it.
The short answer: pin the scripts and styles you load from elsewhere to a hash of their contents. That is SRI. If the hash does not match, the browser refuses the file.
External files are borrowed goods
Picture a parcel arriving from a shop. You check the model number against your order before using it. If it does not match, you send it back. You confirm the contents first, then use them.
Scripts and styles loaded from outside are the same. The file is not yours; it sits on someone else's server, and your page borrows it to run.
While you borrow it, nothing guarantees the contents stay the same. That is why you check at the moment it arrives.
What SRI is
SRI (Subresource Integrity, a way to check an external file against a hash) makes the browser do that check.
You write a hash (a short string computed from the contents; change one character and you get a different value) into the HTML in advance. After downloading the file, the browser computes the value itself and compares.
If they differ, the load fails. The script does not run, and the stylesheet is not applied.
Why it matters to you
When you load a file from someone else's server, you trust that server completely.
The origin could be compromised, or the domain could be taken over. Either can happen. Without SRI, the changed code runs with your page's permissions.
With SRI, the changed file is refused. Visitors see a broken feature, which is better than an attack that runs.
Files change without an attack
Takeover and compromise are attack stories. But attacks are not the only reason an external file changes. The origin ships a new release of a library, or a CDN swaps what it serves. Both happen in normal operation.
A URL like @latest fetches the newest file every time. A function is renamed, arguments change order, a deprecated feature is removed. You did not change a line, and a button stops working.
These changes often do not announce themselves. A warning appears in the console and the page still renders, so the site ships looking slightly off. The hard part is suspecting the external file at all.
SRI stops this unintended update too. If the hash does not match, the new version is not loaded. The failure takes the clear shape of a feature that does not work, which is easier to trace than behaviour that quietly changed.
Being blocked is still a problem. So use a fixed version and choose when to update. SRI is the brake that keeps an update from happening without you.
How to add it
There are three steps.
- Use a URL with a fixed version (no
@latest, no version-less URL) - Generate the hash for that file
- Add
integrityandcrossorigin
The first step matters. With a moving version, the hash stops matching on every update and your feature dies.
You can generate the hash yourself. Download the file and run this command.
openssl dgst -sha384 -binary lib.min.js | openssl base64 -A
Take the output, put sha384- in front, and that is the value for integrity. Add two attributes together: integrity with that value, and crossorigin set to anonymous.
Do not skip crossorigin. Reading an external file to check it requires permission from the origin (CORS).
You can use sha256, sha384 or sha512. sha384 is the common choice. You can also list several hashes separated by spaces, which helps while you move between versions.
The official documentation is here.
- MDN's Subresource Integrity documentation (English)
- MDN's documentation for the integrity attribute (English)
Where it creeps into AI-built apps
You can end up with external files without writing any of the code.
- Chat, analytics, payment or map widgets loaded from a CDN
- URLs from templates and sample code left in place
- Loads pinned to
@latestinstead of a version
AI-generated HTML tends to favour "it works". A missing integrity is invisible on screen.
How vuln shows it
In the results from vuln (a free check that only needs the public URL), SRI appears as one row, V08.
- V08 sri (category: content, importance 1)
If an external script or stylesheet has no integrity, it needs attention (severity low).
It looks at tags in the top page's HTML only. It reads <script src> and <link rel="stylesheet">, and skips anything on your own origin.
Common analytics, payment and bot-protection origins usually do not offer SRI, so they are excluded. Google Analytics, Stripe and Cloudflare Turnstile are examples.
Their official pages are here.
- Google Analytics official page (English)
- Stripe official page (English)
- Cloudflare Turnstile official page (English)
The result lists up to ten URLs plus the total count. If the HTML cannot be fetched, V08 becomes "not checked".
Measured on this site
On 25 November 2026 we fetched https://ismyappok.com/ja, /en and /ja/articles/mixed-content with curl -sL and counted occurrences of <script src= and rel="stylesheet". All three pages came back at 0.
This site loads no external CSS or JavaScript; what it needs is written directly into the HTML. There is nothing to check, so V08 passes.
The flip side: add one external file and V08 reacts. A pass today can change when you add a widget tomorrow.
How to fix it
First, list what you load from outside. Open your browser's developer tools, filter the Network tab to JS and CSS, and look at the Domain column. Anything not on your own domain is a target.
If the origin documents a fixed-version URL and its hash, use those values for integrity and crossorigin.
If it does not, download the file and generate the hash yourself. Be aware that the next time the origin updates the file, your site stops working. Check for a fixed-version URL first.
Tags whose contents change often, like analytics, cannot be pinned. Leave them as they are and note why; that is the realistic choice.
Check display and behaviour on staging before you publish. SRI failure shows up as a file that cannot be loaded, so layouts break and buttons stop responding.
Adding it is not the end
SRI protects one thing: that the file you loaded did not change on the way.
- It does not cover scripts written directly into the HTML (that is CSP's job)
- It does not cover tags JavaScript inserts later, unless you set the attribute yourself
- It does not protect pages inside an iframe
- If the HTML itself is rewritten, the hash is rewritten with it
- It does not tell you a new version exists (you decide when to update)
V08 only reads tags in the top page. Links to other pages, and anything loaded later, are out of scope. A pass means "nothing found in that range".
Summary
External files are borrowed goods. Pin a hash and check it on arrival. That alone keeps the damage to a broken feature when an origin changes.
Start by counting the external JS and CSS in developer tools. If the count is zero, there is no work from this article today.
Each check is explained here.
Related articles:
When you have made the changes, run a check with vuln. You can also review display and links before launch with audit (no login).
We wrote this article after checking our own site. It contains no results from scanning third-party sites. The numbers describe how the implementation works; measured values are only those stated with a date and method in the text.