Software supply chain security is the practice of knowing exactly which code runs on your site and in your product, including code you did not write. Most modern websites load dozens of third-party scripts.
Each one runs with the same access as your own code. That is why a single compromised script can steal payment data from every visitor, as several recent incidents show.
This guide explains how to audit third-party scripts and CDNs. You will learn how to build an inventory, pin scripts with hashes, check your vendors, and keep watching after deployment.
What is software supply chain security?
A software supply chain is every person, package, and service that contributes code to your product. It includes your own developers, open-source libraries, build tools, and the scripts your pages load from other companies.
An attack on that chain does not break through your firewall. It arrives through a trusted channel, already inside your defences, and your systems treat it as legitimate.
That is what makes these attacks so damaging. The malicious code often carries a valid signature, loads from a familiar domain, and runs with full access to your users’ browsers.
Security teams used to focus on their own code. Today the bigger risk often sits in code they never wrote and rarely review.
Why are third-party scripts your biggest blind spot?
A classic script tag has no sandbox. Code loaded from a vendor’s CDN executes in your page with the same access as your own bundle.
It can read form fields as customers type, capture keystrokes, read cookies, and send data to any server it chooses. The browser’s Same-Origin Policy limits data requests, not scripts.
Most teams cannot list every script their site loads. Analytics, chat widgets, A/B testing tools, payment SDKs, and tag managers all add code, often without the security team knowing.
Worse, third-party code can change at any time. A vendor can update its file without telling you, and your page will serve the new version to every visitor.
How do Magecart attacks actually work?
Magecart is an umbrella term for criminal groups that steal payment data directly from buyers’ browsers. The method is called web skimming, or formjacking.
Attackers place tampered JavaScript on a checkout or payment page. The script reads the card number, expiry date, and security code as the customer types, then sends the values to a server the attackers control.
The customer sees nothing wrong. The page looks normal, the payment seems to go through, and the theft is invisible until the card is used elsewhere.
The threat remains high in 2026. Security researchers record around 30 new skimmer signatures per day, according to Xictron’s 2026 guide to checkout skimming.
One skimming kit offered on the dark web accounted for 26% of all observed infections in 2025, according to analysis cited in the same guide. The business is industrial in scale.
What happens when a trusted script turns malicious?
The polyfill.io incident of June 2024 is the clearest warning. Polyfill.io was a CDN serving JavaScript polyfills to more than 100,000 websites.
In February 2024, the domain and its GitHub repository were acquired by a Chinese CDN company, Funnull. By June, malicious JavaScript was being served through cdn.polyfill.io.
The payload targeted mobile users, redirecting them to scam and sports-betting sites. Security researcher Sansec discovered the attack, and Cloudflare and Fastly confirmed it.
The lesson is simple, and System Hardening’s account of the polyfill.io incident draws the same conclusion: a script you trust today can serve different bytes tomorrow.
The URL stays the same, so nothing in your code changes, and yet every visitor gets the attacker’s code.
A more recent case made the point again. In October 2026, a performance-monitoring script loaded by a major trading site was swapped for one built to drain its users, as reported.
The incident, described in detail by SysOSX, put trading into cancel-only mode on 29 October 2026. Reporting put the amount taken at about $2.7 million, with refunds of $3.9 million once goodwill payments were included.
How do you build a script inventory?
You cannot protect what you cannot list. The first step of any audit is a complete inventory of every script that loads on your site.
Start with the pages that matter most: checkout, login, account, and any page where users enter sensitive data. Then expand to the whole site.
Do not rely on your source code alone. Tag managers, marketing tools, and vendors inject scripts at runtime, so your repository will not show them.
Load each page in a real browser and record everything that actually executes. Browser developer tools, a headless browser, or a dedicated inventory tool will all work.
For every script, record the URL, the vendor, the owner inside your company, and the business reason it exists. If no one can explain why a script is there, that is a finding, not a detail.
How does subresource integrity (SRI) work?
Subresource integrity is the browser’s built-in way to pin an external script to a known-good version. You add an integrity attribute to the script tag, containing a cryptographic hash of the file.
When the browser fetches the file, it computes the hash of the bytes it received. If the hash does not match, the browser refuses to execute the script.
The protection is real. In the polyfill.io case, SRI would have blocked the attack, because the malicious code had a different hash from the legitimate file.
Generating a hash is simple. A single command produces the SHA-384 digest you need, and the W3C specification behind SRI has been a published standard since 2016.
Use SRI on every static third-party script you can. It costs almost nothing, and it turns a silent compromise into a failed load that your monitoring can see.
What can SRI not protect?
SRI has a hard limit: it only works for scripts that do not change. Most third-party tags — analytics, tag managers, chat widgets — change too often to pin to a fixed hash.
Attackers know this, so they target the unpinned scripts. They also subvert scripts that load more code at runtime, staying inside your allow-list while fetching a second-stage payload.
A Content Security Policy helps here. It defines which origins may load scripts and where the browser may send data, using script-src and connect-src directives.
But a policy alone cannot see a trusted URL serving new bytes. That is why hash monitoring and browser-side observation matter as much as the policy itself.
Treat SRI as one layer, not a silver bullet. It stops the simplest and most common form of this attack, and it must sit alongside inventory, monitoring, and vendor checks.
How do you audit a CDN and a vendor?
A CDN is a company, and a vendor audit is a business process, not a technical one. Start by asking what happens when the vendor is breached, sold, or simply changes its file.
Check who owns the domain your scripts load from, and whether that ownership has changed. The polyfill.io attack began with a domain acquisition, not a hack.
Ask the vendor how it protects its own release pipeline. Does it sign releases, use multi-factor authentication for publishers, and notify customers of changes?
For open-source packages, the same logic applies. In August 2026, a compromised maintainer account spread a credential-stealing worm through the keyv caching library to more than 400 npm packages, Sygnia reported on the Shai-Hulud return.
The worm rode the victims’ own release workflows, so poisoned packages carried valid provenance. A passing signature check is not proof that a package is safe.
What does PCI DSS 6.4.3 require?
If you take card payments, this is no longer optional. PCI DSS requirements 6.4.3 and 11.6.1 became mandatory on 31 March 2025 under PCI DSS v4.0.1.
Requirement 6.4.3 has three parts. Every script on a payment page must be authorised, its integrity must be assured, and an inventory must be kept with a written justification for each script.
Requirement 11.6.1 adds continuous detection. You must deploy a mechanism that detects unauthorised changes to payment page scripts and security-impacting headers, and alerts on them.
Neither requirement demands script blocking. They demand inventory, justification, integrity verification, and change detection with alerting, as CentralCSP explains in its guide to 6.4.3.
Research cited in 2026 comparisons found that roughly 30% of third-party scripts change within two weeks of deployment. A one-time audit cannot keep up with that pace.
How do you monitor scripts after deployment?
An audit is a snapshot, and third-party code changes daily. Monitoring is what keeps the audit honest after the report is filed.
Hash every script body your pages load, and compare the hashes over time. This catches a trusted URL serving new code, which is the most common route in.
A list of allowed URLs cannot catch it, because the URL is identical before and after. You must fetch the files themselves and hash their contents.
Render pages in a real browser and watch what actually executes. This catches scripts injected by a tag manager, or code that only appears at runtime.
Set up alerts for CSP violations and SRI failures. A blocked script is evidence, and it should reach a person the same day, not sit in a log nobody reads.
What should your audit routine look like?
A good routine is short, regular, and owned by a named person. Quarterly is a minimum for most sites; monthly is better for checkout pages.
First, refresh the inventory from live pages, not from memory. Remove every script nobody can justify, starting with the checkout.
Second, re-verify the hashes of every pinned script, and check which scripts still cannot be pinned at all. Those need a compensating control, such as isolation or monitoring.
Third, review each vendor’s status: ownership changes, security notices, and any new sub-processors the vendor has added since your last review.
Fourth, check your CSP reports and SRI failure logs for anything unusual, and confirm that alerts actually reached someone.
Finally, test the incident plan. If a script turns malicious tonight, who decides to remove it, and how fast can that decision reach production?
Frequently asked questions
What is software supply chain security?
It is the practice of knowing and controlling every piece of code that runs in your product or on your site, including third-party scripts, CDNs, and open-source packages. The goal is to stop a compromised supplier from becoming your breach.
How does subresource integrity stop a Magecart attack?
SRI pins a script to a cryptographic hash of its known-good version. If an attacker changes the file on the CDN, the hash no longer matches, and the browser refuses to execute it. It works for static scripts, not for code that changes frequently.
Why is a script inventory the first step?
You cannot protect code you do not know exists. An inventory lists every script, its vendor, its owner, and its business justification. It is also what PCI DSS 6.4.3 requires for payment pages, and it makes every other control possible.
Should I self-host third-party scripts instead?
Self-hosting removes the vendor’s ability to change the code silently, and it lets you apply SRI easily. It also means you own the updates, so you must patch promptly. For stable libraries, self-hosting is often the safer choice.
How often should I audit third-party scripts?
Audit checkout and login pages at least monthly, and the rest of the site at least quarterly. Hash monitoring and CSP violation alerts should run continuously, because third-party code can change at any time without warning.
Further reading: our cybersecurity coverage tracks supply-chain incidents and defences, our technology section covers the tools behind them, and our latest news coverage reports major breaches as they happen.

