An advisory lands on a Tuesday morning. A popular npm package has been publishing malicious versions for a few hours, and somewhere in the building a director is asking whether the company is affected. The development team checks the lockfile and says no. That answer is only half of the picture, because a supply chain JavaScript attack does not have to touch your repository to reach your customers. It only has to reach the browser.

Most published guidance on this subject is written for developers: pin your dependencies, verify provenance, harden the build pipeline. That advice is sound, and it is also the wrong half of the problem for anyone who owns risk rather than code. Attackers, customers, card schemes and regulators all see the compromise from outside your perimeter first. This blog outlines seven checks you can run from that same vantage point, with no agent installed and no access to source code.

How Does a Supply Chain JavaScript Attack Reach Your Users?

A supply chain JavaScript attack is any incident where code you did not write, but which your pages load and trust, is altered to serve an attacker's purpose. There are three common entry points. The first is a compromised package pulled into a build, where a legitimate library gains a malicious version. The second is a hijacked third-party script served live from a vendor's content delivery network, where the file behind the URL changes but the URL does not. The third is a tag manager or analytics container that nobody owns any more, still firing on a forgotten site and still able to inject whatever its account holder decides.

The browser is the blast radius. Injected script runs with your domain's trust, inside your session, with full access to the Document Object Model. That means it can read form fields as they are typed, lift session tokens, rewrite payment flows, and post the results to a host of the attacker's choosing. Magecart-style skimming has operated this way for years: a handful of lines on a checkout page, quietly exfiltrating card details to a host whose name resembles a legitimate analytics provider.

Build-Time and Runtime Compromise Are Not the Same Problem

A build-time compromise changes your code. The September 2025 npm incident, in which a maintainer account was phished and widely used packages were briefly republished with wallet-draining code, is the clearest recent example of how a single account takeover reaches thousands of downstream sites. Dependency scanning and lockfile discipline do genuinely help here.

A runtime compromise changes nothing you own. The vendor's file is swapped behind the same URL, your repository stays clean, code review passes, static analysis passes, and your checkout page skims cards anyway. Publicly reported incidents involving trusted script providers, including malicious JavaScript linked to the experimentation platform Optimizely being served to visitors of major websites, show how the compromise can sit entirely outside the customer's estate. Only outside-in observation of the live page catches that class of attack, which is the reason the checks below start at the edge and work inwards.

Check 1: Which Domains and Subdomains Can Load Third-Party Script?

Start with the assets, not with the content management system. The riskiest JavaScript rarely sits on the flagship site, because the flagship site has owners, change control and a release process. It sits on the campaign microsite built by an agency three years ago, the regional domain inherited through an acquisition, and the staging host that was decommissioned in the CMS but still resolves and still fires a tag container.

Thorough external asset discovery finds these; an internal configuration database rarely does, because nobody ever told it they existed. Look specifically for shadow IT patterns: marketing-built landing pages on separate registrars, country sites spun up by regional teams outside central IT, and subdomains pointing at third-party page builders. Map what you find by geography and business unit, so that the ownership question has an answer before an incident rather than during one.

Check 2: What Scripts Are Your Live Pages Actually Loading?

Once the domains are known, enumerate the scripts each page template loads in a real browser session, not in theory. Typical mid-sized UK e-commerce templates pull somewhere in the region of fifteen to forty third-party scripts, and several of those load further scripts of their own. Those fourth-party chains are where approval breaks down, because the business signed a contract with one vendor and inherited five.

Record three things for each entry: the host, the full path, and whether the file is versioned or served from a mutable path such as /latest/. Give extra attention to checkout, login, account and enquiry form templates, since those are where skimming pays. Any script loading from a domain that nobody in the business can name an owner for should be treated as an open finding, not as background noise.

Check 3: Are Those Scripts Changing Behind the Same URL?

Point-in-time testing is close to useless against a runtime script swap. An annual penetration test and a quarterly review will both pass on the days either side of a compromise that lasted six hours. What catches it is continuous change detection on live page content and script hashes, with alerting tuned so that a vendor's routine minification does not bury a genuine injection.

Subresource Integrity and Content Security Policy are the practical controls here, and they deserve an honest assessment. Subresource Integrity pins a cryptographic hash to a script tag, so a modified file simply fails to load, which works beautifully for versioned files and badly for vendors who update daily. Content Security Policy restricts which hosts may serve script and where data may be sent, which limits exfiltration even when the injection succeeds. Both require maintenance, and both fail quietly when a vendor changes delivery without warning.

Alongside the controls, set a response path. Decide now who can pull a tag inside thirty minutes, who holds the tag manager credentials out of hours, and what the fallback is when the person with access is on leave.

Check 4: How Strong Are the Vendors Behind the Scripts?

Supplier risk assessment for script vendors can be done largely from public signals: certificate hygiene, exposed administrative panels, patch latency on internet-facing services, and accreditation claims that do not validate against the issuing body's register. The same external signals used to assess any vendor's security posture apply, with one adjustment in weighting.

Small vendors carry disproportionate risk. A chat bubble, a review widget or an A/B testing tag has full access to every page it loads on, including login and payment forms, yet it usually passes through a lighter procurement check than a core platform supplier because the annual spend is modest. Ask those vendors specific questions rather than sending a generic questionnaire: how are builds produced and signed, are dependencies pinned, who holds publishing rights to the CDN bucket, and do publishing accounts use phishing-resistant multi-factor authentication. The September 2025 npm case turned on a phished maintainer, so the answer to that last question matters more than most control frameworks suggest.

Contract terms are worth attention too. Useful clauses include a defined notification window, access to change logs, and an explicit right to remove the tag at short notice without breaching the agreement. The NCSC guidance on supply chain security is a reasonable reference point when building those requirements into procurement.

Check 5: What Do Dark Web and Telegram Signals Say First?

Compromised package names, injected domains and batches of freshly skimmed card data frequently surface in criminal forums and Telegram channels before a vendor advisory is published. That ordering is not accidental: the people monetising the access have no reason to wait for a disclosure process. Monitoring those spaces gives a practical head start, and our research into the buyers operating in Telegram channels selling stolen data covers how those markets are structured.

Stealer logs are the quiet upstream cause of many package takeovers. A maintainer's session cookie or registry token harvested from an infected home machine costs very little and bypasses the login process entirely, which is why developer and maintainer credential exposure deserves the same monitoring attention usually reserved for executive accounts. Check your own engineers' exposure, including personal addresses used on code hosting platforms.

Watch, too, for your own domain appearing in exfiltration endpoints, test dumps or seller samples. This is where human analyst context earns its keep, because automated feeds struggle to distinguish the resale of a four-year-old database from evidence of a live compromise, and the two demand entirely different responses.

Check 6: Who Has Registered a Lookalike of Your CDN?

The exfiltration host in a skimming campaign is almost always a lookalike domain, chosen to survive a glance at a network log. Names imitating well-known analytics providers, font services and content delivery networks are standard practice, often with a hyphen inserted or a single character altered. Monitoring new registrations that resemble your brand, your suppliers and the CDN names already present in your script inventory shortens the attack's lifespan even when the compromised vendor is unreachable.

Reverse image search on checkout page assets is a useful companion technique, since cloned payment pages reuse logos and stylesheets. Collect evidence properly, with timestamps, screenshots and WHOIS records, then pursue registrar and hosting takedown. Takedown rarely fixes the root cause, but it does break the collection pipeline.

Check 7: What Did the Script Take Before You Removed It?

Removing a malicious tag ends the collection. It does not rotate the session tokens, API keys or credentials that the script already harvested, and it does not tell you how many customers typed a card number into a compromised form. Post-incident exposure review covers both: rotate anything the script could reach, then monitor for the harvested data appearing for sale.

Scale is what breaks triage at this stage. The same injected script across forty subdomains produces forty near-identical findings, and teams drown in ticket volume while the actual remediation stalls. Group those findings into one project with one owner, and track the subdomains as a checklist underneath it. Deduplication matters more than raw detection count.

Where personal data is involved, the clock is already running. UK GDPR Article 33 requires notification to the Information Commissioner's Office within 72 hours of becoming aware of a personal data breach, and the ICO publishes its own guidance on what counts as awareness and what must be reported. Detection speed is so a commercial and regulatory matter, not only a technical one.

How Do You Turn the Seven Checks Into a Routine?

A workable cadence looks like this. Discovery and change detection run continuously, because both the asset estate and the script files move without warning. The third-party script inventory gets a human review monthly, focused on new entries and anything loading from an unowned host. Supplier reassessment runs quarterly, weighted towards the small widget vendors that sit on every page.

Keep the scanning boundary defensible. Verify ownership of the domains you test, stay within passive and non-intrusive methods for anything you do not own, and document that boundary so the activity stands up to scrutiny. Proportionate checking is also more sustainable, because it does not generate arguments with legal teams every quarter.

When the board asks whether you were affected by the latest npm or tag manager incident, good evidence is a dated script inventory per template, a change history showing what loaded and when, and a record of which assets were checked and which were out of scope. That is a far stronger answer than an opinion from the development team. If the answer today would be a guess, an external view of your own attack surface is the place to start, and the aim is one prioritised view of what changed, not another dashboard nobody opens.

Frequently Asked Questions

What is a supply chain JavaScript attack in plain terms?

It is an attack where code loaded by your website, but written and hosted by someone else, is altered to do something harmful. The malicious code runs inside your visitors' browsers with your site's level of trust, which allows it to read forms, steal session tokens and capture payment details. Your own code does not need to change for this to happen.

How do I tell if a third-party script on my site has been compromised?

Compare what your live pages load now against a known-good baseline, watching for new hosts, new outbound connections and changes to script file hashes behind unchanged URLs. Pay particular attention to checkout and login templates. Internal code review will not help with a runtime compromise, because nothing in your repository has changed.

Can Subresource Integrity or CSP stop a supply chain JavaScript attack?

Both reduce the risk considerably. Subresource Integrity blocks a script whose contents no longer match a pinned hash, and Content Security Policy restricts which hosts may serve script or receive data. Neither is complete, since Subresource Integrity is impractical for files that vendors update frequently and a permissive policy can still allow exfiltration to an approved host.

Why do dark web and Telegram channels often flag compromised packages first?

Criminal marketplaces move on commercial time rather than disclosure time, so compromised package names, injected domains and fresh card batches are discussed and traded while the vendor is still investigating. That gap, sometimes hours and sometimes days, is the window monitoring is designed to exploit. Analyst judgement is needed to separate genuine new compromise from the resale of older data.

Who is responsible when a vendor's script leaks our customers' data?

Under UK GDPR, the organisation determining the purposes of the processing is normally the controller and carries the reporting duty, even where the failure occurred at a supplier acting as processor. Contractual terms shape liability between the parties, but they do not transfer the obligation to notify the ICO and, where the risk is high, affected individuals. Legal advice should be taken on the specifics of any incident.