Page integrity
Subresource Integrity (SRI)
Subresource Integrity adds a hash to each script or stylesheet your page loads from a public CDN, so the browser refuses the file if anyone changes it.
Why it matters
A script from a CDN runs with full access to your page: it can read what visitors type and change what they see. If the CDN or the file is ever tampered with, every site loading it runs the changed code. An integrity hash makes the browser block any file that doesn't match.
What Scanetra looks for
- Script and stylesheet tags that load from public CDNs such as cdnjs, jsDelivr, unpkg or code.jquery.com without an integrity attribute.
- Scripts and stylesheets from other sites, such as analytics or chat widgets (a note, because those change too often to hash).
It reads only your homepage's public response. How a scan works
How to fix it
Add the hash
cdnjs and jsDelivr show a ready-made tag with the hash for each file. Or generate one with srihash.org. Always add crossorigin too:
<script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"
integrity="sha384-…"
crossorigin="anonymous"></script>Make the hash yourself
For a file you've downloaded:
openssl dgst -sha384 -binary bootstrap.bundle.min.js | openssl base64 -APin the version
Only hash files with a fixed version in the address, such as bootstrap@5.3.3. A file at a moving address such as @latest changes, and the browser would then block it.
Or host it yourself
Serving the file from your own site, for example through your build tool, removes the dependency on the CDN.
Replace example.com with your own domain, and test changes on a staging copy first where you can.
Check that it worked
Each CDN tag in the page source has an integrity attribute, and the page still works with no integrity errors in the browser console. Then scan again.
Check your own site
A free scan tells you whether your site passes this check, and the 24 others.