Script integrity is a security control that verifies a loaded JavaScript file is exactly the version a site expects, without unauthorized changes. It helps detect tampering in transit, on a CDN, or at a vendor’s hosting endpoint before malicious code runs in the browser.
This matters because externally loaded scripts often sit on the trust boundary of a website. If an attacker alters a shared marketing widget, analytics tag, or notification script, every site that fetches it can execute attacker-controlled code in user sessions. Defenses include content security policy, Subresource Integrity hashes, signed or pinned assets, and monitoring for unexpected script changes. In practice, script integrity is a key safeguard against supply-chain attacks where one upstream modification can affect many downstream sites at once.


