← Blog

Software Supply Chain Security When an Agent Picks the Dependency

Marco Masut

Software supply chain security is the set of controls that protect everything that ends up in a piece of software: the libraries it depends on, the tools that build it, the people and systems that can change it, and the records that show where each piece came from. Until recently a developer chose each dependency, so a person could be asked why it was there. When a coding agent writes the change, the agent often chooses the package too, inside a session that closes when the task ends. The inventory of what shipped, an SBOM, is still necessary, but it records the result and not the decision. Four things close the gap: a rule on which sources an agent may pull from, a check at the moment a dependency is added, a record of who approved it, and evidence the client can ask for at delivery. The sections below show where the risk sits and which controls belong in the loop.

Why does supply chain risk change when an agent writes the code?

Because the choice of dependency moves from a person to a tool that decides fast, in volume and without the habit of asking a colleague. Three things shift at once.

First, the number of decisions. An agent adding a feature may add several packages in one session, and a reviewer reading the diff sees a manifest line, not the reasoning behind it. Second, the quality of the choice. Language models can name a package that does not exist. A study presented at USENIX Security 2025 (Spracklen et al., "We Have a Package for You!") generated 576,000 code samples in Python and JavaScript with 16 models and found that the average share of hallucinated packages was at least 5.2% for commercial models and 21.7% for open-source models. A name that does not exist can be registered by an attacker, which is the point of the attack known as slopsquatting. Third, the visibility. The session that picked the package leaves no trace unless the process makes it leave one.

None of this makes agents unusable. It means the control has to look at the decision, not only at the finished build.

Where do agents add dependencies nobody reviewed?

In a few predictable places. The table lists them with the control that fits each.

| Where it happens | What goes wrong | Control that fits | | --- | --- | --- | | Manifest edit during a feature | A package added for a small convenience, never discussed | Block merge if the manifest or lockfile changes without a recorded approval | | Name suggested by the model | Package does not exist, or exists because someone registered it | Allow only names found in an approved registry or internal mirror | | Install script or build step | Code runs on the build machine before anyone reads it | Run installs in an isolated environment with no secrets | | Transitive dependency | A package pulls in dozens more | Pin versions with a lockfile and review the diff of the resolved tree | | Tool or plugin the agent uses | The agent itself becomes part of the chain | List tools and their versions among the delivered evidence |

The common thread is that each row is a decision taken inside a session. A review after the fact sees the outcome. A control inside the loop sees the moment of choice.

What does an inventory show, and what can it not show?

An inventory such as an SBOM lists components, versions and, in good cases, hashes and licences. It answers whether a known vulnerable package is in the build. CycloneDX and SPDX are the two common formats, and I explain what they cover in SBOM for AI-generated code. Build provenance, as defined by SLSA, adds a second answer: which builder produced the artifact from which inputs.

Neither answers the questions a security lead asks after an incident: who allowed this package, what was the agent told to do, who read the change before release, and was the check that passed run by someone other than the author. Those answers live outside the artifact. If they are not recorded at the time, they cannot be rebuilt later.

Which controls belong in the loop, not after it?

Controls that run while the work happens, and leave a record, beat controls that run once before release. A short list that fits most teams, aligned with the practices in NIST's Secure Software Development Framework, SP 800-218:

  • an allowlist of registries and, for sensitive work, an internal mirror, so the agent cannot reach arbitrary sources;
  • a check at the moment a dependency is added: does the name exist, how old is it, who maintains it, does it match an approved licence;
  • a lockfile committed with the change, so the resolved versions are part of the diff;
  • a rule that the check is run by a process separate from the one that wrote the change, as discussed in separation of duties when an agent writes and tests;
  • a named person who signs the plan before work starts and the delivery at the end, because an approval nobody can name is not an approval.

The wider process view, with each control placed on the delivery flow, is in secure SDLC with agents in the loop. The point here is narrower: the dependency decision must leave evidence at the moment it is taken.

What should you ask a supplier to prove?

If a supplier delivers software built with agents, ask for artifacts, not assurances. Questions that can be answered with a document or a re-runnable check:

  • Which AI tools and versions touched the code, and which registries could they pull from?
  • How is a new dependency approved, and where is that approval recorded?
  • Can you show the dependency changes of the last milestone with who approved each?
  • Which checks ran on the delivery, who ran them, and can we run them again?
  • Does the delivery include the lockfile, the inventory and the agent's own technical choices?

The full question set for suppliers is in vendor risk assessment questions for AI-assisted suppliers. Detent, the end-to-end delivery system (detent-ai.com), keeps this kind of record by design: a named person signs the plan and the final delivery, and the agent's choices, dependencies included, are attached to the signature. For the wider picture see AI software development, and for how tools compare on what they leave behind, the benchmark.