1. Home
  2. Articles
  3. Guide

Guide

AI coding assistants and your software supply chain

AI coding tools suggest packages, install them and run them on machines full of credentials, and the tools are software that can be compromised themselves. Here are the new risks, the incidents behind them, and the settings that stop most of them.

Short answer: AI coding assistants add three supply chain risks: they recommend packages that don’t exist, which attackers then publish; they install and run dependencies on developer machines that hold cloud and GitHub credentials; and the assistants themselves can be compromised. Check that every new dependency is real and established, install from a lockfile with install scripts off, make new releases wait a few days, pin GitHub Actions to commit SHAs, and keep long-lived credentials off developer machines.

01 · Context

What AI changes about the supply chain

Supply chain attacks aren’t new: attackers compromise a package, an action or a tool that many teams trust, and every team that installs it runs their code. AI coding assistants make this worse in three ways:

  • They add dependencies people never chose. A suggested import or npm install can name a package nobody on the team has heard of, or one that doesn’t exist yet.
  • They run installs themselves. Agents install packages and run scripts on developer laptops, where GitHub tokens, npm tokens and cloud credentials live.
  • They are dependencies too. An assistant or extension is software from a supplier, updated often and trusted with a lot.
02 · Invented packages

Packages that don’t exist (slopsquatting)

Researchers from the University of Texas at San Antonio, Virginia Tech and the University of Oklahoma tested 16 code-generating models and found that 19.7% of the packages they recommended didn’t exist: about 205,000 made-up package names. Open-source models invented packages more often (21.7% on average) than commercial ones (5.2%).

The made-up names are predictable. When prompts that had produced an invented package were run again ten times, 43% of the invented names came back every time, and 58% came back more than once. An attacker can collect those names, publish real packages under them, and wait for an assistant to recommend them. Seth Larson of the Python Software Foundation named this slopsquatting.

Before any new dependency is merged, someone (or a check in the pipeline) should confirm that it exists, has a history, is used by others and links to a real source repository.

03 · Worms

Worms that steal developer credentials

In September 2025 CISA warned of Shai-Hulud, a self-replicating worm in the npm ecosystem that compromised more than 500 packages. Once installed, it searched the machine for GitHub personal access tokens and AWS, Google Cloud and Azure keys, sent them to the attacker, published them to a public GitHub repository, then used the developer’s own npm access to inject itself into their other packages and publish new versions. OX Security later reported it had returned, with more than 320 affected packages.

An install script runs the moment a package is installed. When an agent runs npm install on a laptop with live tokens, the package’s code runs with everything that laptop can reach.

04 · CI

Compromised GitHub Actions

In March 2025 attackers changed the code of tj-actions/changed-files, a GitHub Action used by more than 23,000 repositories, so that it exposed CI secrets in workflow logs. Public repositories with public logs were exposed most. Researchers traced it to an earlier compromise of reviewdog/action-setup. The fix was version 46.0.1.

Workflows that referenced the action by a version tag ran whatever that tag pointed to. A full commit SHA can’t be moved to different code, which is why pinning actions to SHAs is the standard defence. Check workflow files an assistant writes for tags before you merge them.

05 · Tools

When the AI tool is the attack

In July 2025, version 1.84 of the Amazon Q Developer extension for VS Code shipped with an injected prompt telling the agent to delete local files and use the machine’s AWS profiles to delete cloud resources, with tool approvals switched off. AWS removed it two days later in version 1.85 and said no production services or customers were affected. It showed that an AI assistant’s update channel is part of your supply chain, and that what the assistant can reach decides the damage. What to let an AI agent do in your AWS account covers that side.

06 · Controls

Controls that stop most of it

1. Check every new dependency

Add a pipeline check that fails a pull request when it adds a dependency that is new to the repository, until a person confirms it. It should check that the package exists on the registry, how old it is, how widely it is used and whether it links to a source repository. Tell your assistants the rule too, in your repository’s agent instructions file, but treat that as a reminder: the check is the control.

2. Install from a lockfile, with scripts off

Commit the lockfile and install exactly what it says in CI (npm ci, pnpm install --frozen-lockfile). Turn off install scripts by default, and allow them only for the few packages that need them.

3. Make new releases wait

Package managers can now refuse versions younger than a set age, which gives the community time to find and remove a malicious release before it reaches you. The University of Cambridge’s DevOps guidebook uses a three-day wait:

.npmrc (npm 11 or later)
ignore-scripts=true
min-release-age=3
.yarnrc.yml (Yarn 4)
enableScripts: false
npmMinimalAgeGate: 3d

pnpm has the same controls as ignoreScripts and minimumReleaseAge. When a security fix can’t wait, allow that one version explicitly.

4. Pin GitHub Actions to commit SHAs

.github/workflows/build.yml
permissions:
  contents: read          # least privilege by default; widen per job

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      # full commit SHA, with the version as a comment for humans and Dependabot
      - uses: actions/checkout@<full-40-character-sha> # v4.x.y
      - uses: actions/setup-node@<full-40-character-sha> # v4.x.y

Let Dependabot keep the SHAs up to date, and use GitHub’s setting to allow only the actions you approve. Use OIDC instead of stored cloud keys, as in Deploying to AWS from GitHub Actions without access keys, so a leaked log has nothing long-lived to steal.

5. Keep credentials off laptops

  • Developers sign in to AWS through IAM Identity Center for short sessions. No access keys in ~/.aws/credentials.
  • Use phishing-resistant MFA on GitHub and npm accounts, as CISA recommends.
  • Run coding agents in a dev container that holds only what the task needs, and keep their command approvals on.

6. Detect what gets through

Turn on GitHub secret scanning, Dependabot alerts and branch protection. Review the GitHub Apps, OAuth apps and webhooks connected to your organisation, and remove the ones nobody uses.

07 · Response

If a package you use is compromised

  1. Search every lockfile (package-lock.json, yarn.lock, pnpm-lock.yaml), including nested dependencies, and any cached copies in your artifact repository.
  2. Pin to a known-good version published before the compromise.
  3. Rotate every credential that could have been on an affected machine or runner: GitHub, npm, cloud keys.
  4. Check CloudTrail and GitHub audit logs for use of those credentials since the compromise.
  5. In Australia, report incidents to ASD at cyber.gov.au.
08 · FAQ

Common questions

What is slopsquatting?

Publishing a malicious package under a name that AI coding assistants invent. Because assistants repeat the same made-up names, attackers can register them in advance and wait for developers or agents to install them.

How often do AI models invent package names?

In a study of 16 code-generating models, 19.7% of recommended packages didn’t exist. Open-source models averaged 21.7% and commercial models 5.2%.

Should I stop letting AI assistants add dependencies?

No, but don’t let a new dependency merge unchecked. A pipeline check that confirms the package exists, has a history and links to real source code catches invented and look-alike packages, whoever added them.

Why pin GitHub Actions to a commit SHA instead of a version tag?

A tag can be moved to different code, as happened with tj-actions/changed-files in March 2025. A full commit SHA always refers to the same code.

Does a minimum release age slow down security fixes?

Slightly, which is why you allow exceptions. A wait of a few days gives others time to find and remove a malicious release before you install it, and you can allow a specific urgent fix by hand.

09 · Sources

Sources

See also What to let an AI agent do in your AWS account, AI code governance and AWS security and DevSecOps.

Next step

Want your pipeline checked for these gaps?

On a 30-minute call we’ll look at how dependencies and AI tools reach your code today, and what to tighten first.