Improve Security with Subresource Integrity (SRI) for CDN Scripts

JavaScript Analyzer

What is this warning?

You're loading a script from a third-party source (like a CDN), but you're not verifying its contents. This is a security risk. If the CDN were ever compromised, malicious code could be served to your users. Subresource Integrity (SRI) is a security feature that prevents this from happening.

How to Fix This Issue

How to Fix It

The Problem

<script src="https://cdn.example.com/library.js"></script>

The Solution

Add an `integrity` attribute containing a hash of the script file. You can usually get this hash from the CDN provider.

<script src="https://cdn.example.com/library.js" integrity="sha384-some-hash-value" crossorigin="anonymous"></script>

Why This Works

The `integrity` attribute tells the browser to check if the downloaded file matches the expected hash. If it doesn't match, the browser will refuse to run the script, protecting your site from malicious code injection.

SEO Impact

This issue can affect your site's search engine rankings and user experience. Addressing it promptly helps ensure optimal performance and visibility in search results.

Automatic Detection

Black SEO Analyzer automatically checks for this warning during site analysis, along with hundreds of other technical SEO issues.

Ready to Unlock Your Site's Full SEO Potential?

Choose the license that fits your needs and start getting the deep, actionable insights you deserve.