The cost of a dependency you did not choose

A coding agent can add a date formatting library to a repository in four seconds. There is no discussion, because the change arrives complete, the tests pass, and the library is a reasonable one.
That package is now in the build. It is in the lockfile, the licence report, the vulnerability scan, the container image, and in the set of things a new engineer has to understand before they can safely change how a date is displayed. Someone on the team will be responsible for it in five years.
Reveneau writes all of its code with AI, and every change has to pass an eval suite written from the specification before it is released. Dependencies are harder to notice than a fault in the code, and they last longer than the code that introduced them.
Is AI-generated code safe to use in a business application?
It can be, when every change passes checks before release that cover two things: the code itself, and the packages the code adds to your build. The code itself is covered in the real cost of shipping unverified code, with Veracode's figures and a study of AI-written files on GitHub. This section is about the packages.
Code models name packages that do not exist. Joseph Spracklen and five co-authors tested 16 models on Python and JavaScript in a paper for the 2025 USENIX Security Symposium (arXiv 2406.10279, version 3 of 2 March 2025, read 23 November 2026). Across 576,000 code samples, "the average percentage of hallucinated packages is at least 5.2% for commercial models and 21.7% for open-source models". The models made up 205,474 different package names.
The same names come back. The authors ran 500 prompts that had produced a made-up name again, 10 times each, and "43% of hallucinated packages were repeated in all 10 queries". That repetition is what an attacker needs. Someone publishes a package under the made-up name on a public registry such as PyPI or npm, with harmful code inside, and the next person whose AI tool suggests that name installs it. The OpenSSF guide for AI code assistants (Security-Focused Guide for AI Code Assistant Instructions, dated 2025-08-01, read 23 November 2026) calls this attack "slopsquatting" and gives a one-line instruction: "Do not add dependencies that may be malicious or hallucinated."
Five checks cover a package that an AI tool added. Each one runs before the change is merged:
| Check | What it catches |
|---|---|
| The name exists in the official registry and is the package you meant | A made-up name, or a harmful package published under it |
| Who publishes it and when its first version came out | A package with no release history. One published under a made-up name starts with none |
| A scan for known vulnerabilities | Published security flaws in the package and in the packages it brings in |
| The licence | Terms that do not fit how you distribute the product |
| One sentence on why it exists and what it replaces | A second package doing a job the build already does |
The OpenSSF guide also tells teams to run dependency checks in the build pipeline, so that problems are found before release. These checks run on every change, however the code was written. The checks for the code itself are in how to do a security review before launch. Reveneau takes responsibility for the whole project, through production and after release.
1. The small effort that used to protect you is gone
Adding a package by hand was never hard. It was, however, embarrassing.
You had to search for it, read the readme, decide the name was right, type it, and then mention it in the pull request description where a colleague might ask why. That whole sequence took a few minutes and carried a small social cost. The cost was useful. It stopped the additions that were only convenient, because convenience is a weak answer when someone might ask you out loud.
An agent has no such hesitation. It has read a large amount of code in which the standard solution to a given problem is a particular package, so it uses that package as automatically as a human writes a for loop. The choice can be defended. The problem is that it was never presented as a choice.
Plan on any repository where agents write code collecting dependencies faster than the same team would add them by hand, and set up the review described below before the first agent change is merged.
2. What a dependency costs over five years
Installing it costs nothing. The costs come in the years after.
The upgrade cost. With every package, you have to follow somebody else's release schedule. They release a major version, they deprecate a function you rely on, they change a default. None of these events are your decision, and all of them happen on their schedule. Ten packages, each needing attention twice a year, is twenty upgrades a year that appear in no plan.
The security risk. A package deep in the dependency tree runs with the same permissions as the code you wrote yourself. Nobody read it. Nobody is going to read it. Your scanner will tell you about known vulnerabilities in it, which is useful and covers only the ones that have been found and published. A package whose name a model made up is a separate risk, covered in the section above.
The compliance risk. In any regulated environment, every dependency is something an auditor can ask about: what licence, what data does it touch, where does it send telemetry. A package added without discussion during a two-week work cycle becomes a question in a diligence process eighteen months later, and the person answering it will not be the person who added it. If the product handles regulated data, the argument in compliance is a specification problem applies here directly: the obligation exists whether or not anyone wrote it down.
The cost of removing it. Removing a dependency is harder than adding one, because once your code calls the library from many places, the library's approach to the problem has become your code's approach.
3. Two packages that do the same job
What an agent cannot know is what is already in your build. Ask for date handling in one change and a validation helper in another, and you can end up with two libraries that do overlapping jobs, each added by a reasonable decision made a month apart. Each one works. Together they are a maintenance problem and a source of confusion for the next engineer, who now has to learn an unwritten rule about which one is used where.
Watch for the same thing with HTTP clients, with schema validators, and with large utility libraries, where a package with two hundred functions gets added so that one of them can be used once.
Transitive dependencies make this harder to see. One direct addition can bring in many packages nobody named. Your manifest gains one line, and your build gains every package that line depends on.
The fix: make the team review the dependency list
Treat the manifest and the lockfile as design decisions that happen to be stored in a file, and review them the way you review code.
Compare the dependency list on every change, with a check in continuous integration that fails when a new top-level entry appears without an explanation. A report someone reads later has no effect. This is the same principle as running evals in the pipeline, described in evals in CI for coding agents: the check has to block the change.
Check the name. Confirm the new entry is the package you meant, published in the official registry by the publisher you expect. This is the check that stops a made-up name from reaching the build.
Require one sentence. Why does this exist, and what does it replace. That is the whole requirement. If nobody can write the sentence, the package should not be in the build. It catches the duplicates at once, because writing "we need a date library" while a date library is already installed is the moment the problem becomes visible.
Review transitive additions separately. They arrived without anyone choosing them, so they need the one place in the process where a person looks at the whole dependency tree.
Keep the package behind your own thin layer where the cost of removing it matters. One file that wraps it, and the rest of your code calls your file. Then replacing it later changes one file. This is the small version of the argument in avoiding vendor lock-in, and the deciding question is the same: how expensive is it to stop using it.
When adding the dependency is the right choice
Writing everything yourself is a mistake too.
If the problem is hard, well specified, and already solved under real scrutiny by people who specialise in it, take the package. Cryptography, timezone arithmetic, PDF parsing, protocol implementations, anything where a subtle error has consequences and where the failure gives no warning. Writing your own crypto to avoid upgrade work is a bad choice.
The case that is hard to decide is the small utility: a package you could reimplement in under a day, solving ten problems when you have one. There, thirty lines you own are better than a dependency you must track, upgrade, audit, and eventually replace.
Why the problem grows as AI writes more of the code
The 2025 DORA report, based on survey responses from nearly 5,000 technology professionals, found that AI adoption has a positive relationship with software delivery throughput and a negative relationship with software delivery stability, and summarised it as "AI doesn't fix a team; it amplifies what's already there" (read 23 November 2026). Dependency management is an example of that. A team that already reviewed its manifest will keep doing so at a higher volume. A team that never looked will now add unreviewed packages faster.
There is a security side too. Veracode's Spring 2026 update (published 24 March 2026, read 23 November 2026), covering over 150 models, reports syntax correctness "exceeding 95%" while "only 55% of generation tasks result in secure code". That study is about the code itself. The packages the code brings in need their own check, and the name check above is the first one.
Code gets rewritten. Dependencies stay, and the next team takes them over.
Related guide: Maintaining custom software.
Sources
- Joseph Spracklen, Raveen Wijewickrama, A H M Nazmus Sakib, Anindya Maiti, Bimal Viswanath and Murtuza Jadliwala, "We Have a Package for You! A Comprehensive Analysis of Package Hallucinations by Code Generating LLMs", 2025 USENIX Security Symposium, arXiv 2406.10279 version 3: 16 models and 576,000 code samples in Python and JavaScript; on average at least 5.2 percent made-up packages for commercial models and 21.7 percent for open-source models; 205,474 different made-up names; 43 percent repeated in all 10 re-runs of 500 prompts. Read 23 November 2026.
- OpenSSF, Security-Focused Guide for AI Code Assistant Instructions, 2025-08-01: "Do not add dependencies that may be malicious or hallucinated." Read 23 November 2026.
- 2025 DORA report announcement, Google Cloud: nearly 5,000 respondents; AI adoption has a positive relationship with throughput and a negative relationship with delivery stability, and amplifies a team's existing practices. Read 23 November 2026.
- Veracode, Spring 2026 GenAI Code Security update, 24 March 2026: over 150 models evaluated; syntax correctness exceeding 95 percent; "only 55% of generation tasks result in secure code". Read 23 November 2026.


