Vetting a dependency the agent added
For each new package, check that it is needed, that it exists under exactly that name (guarding against hallucinated or typosquatted names), and that it is maintained, pinned and licensed acceptably. Review what it does to the lockfile and the transitive dependency tree.
Builds on: Invented APIs, flags, config keys and packages
Green tests, one new package
You asked the agent to accept ISO dates in an API payload. The diff touches two files: one new line in `package.json` and 300 new lines in `package-lock.json`. The summary says: "Added `is-iso-date-strict` for robust validation." Tests are green. Do you approve? A new package is code you will run, ship and update for years, and neither you nor the agent has checked who wrote it.
Why agents reach for packages
To the agent, a package name is just a plausible string. Names like `is-iso-date-strict` sound right whether or not they exist, and it cannot see today's registry unless it looks. Adding a package is also the quickest way to make an error vanish. A vanished error looks like success, but it does not prove the code is right. Attackers register names that agents often invent, and one-letter lookalikes of popular ones. Later cost: foreign code run at install, abandoned code nobody patches, license trouble, a bloated dependency tree.
Six checks for every new package
1. **Needed?** Does the standard library or an existing dependency already do this?
2. **Exact name:** open the registry page. Compare it letter by letter with the project you meant. Check the repo link, publisher, first release and downloads.
3. **Maintained:** recent releases, more than one maintainer, issues answered.
4. **Pinned:** exact or bounded version, lockfile updated and committed.
5. **License** fits your project.
6. **Tree:** what else the lockfile pulled in, and any install scripts.
A lookalike for something you didn't need
Summary: "Added `python-dateutils` to parse ISO dates." Check 1: the project runs Python 3.12. There, `datetime.fromisoformat` accepts most ISO 8601 strings, including a trailing `Z`, so probably no package is needed. Check 2: the well-known library is `python-dateutil`, with no final s. The agent's name is a lookalike that someone else may own. BETTER: use the standard library. If a library is truly needed, pin `python-dateutil==2.9.0.post0` and commit the lock.
Reading the lockfile, not just the manifest
In package.json, `"*"` lets the next update pull any version, published by whoever controls the name then. The lockfile (excerpt below) shows more:
- version `0.0.3`: barely released
- `hasInstallScript: true`: it runs code during `npm install` on every laptop and CI runner
- `UNLICENSED`: no right to use it
- it declares its own dependency `dateparse-x` as `"*"`, so any version is accepted there too
Check with `$ npm view is-iso-date-strict time maintainers repository` and `$ npm ls --all`.
// TypeScript
--- a/package.json
+++ b/package.json
"dependencies": {
+ "is-iso-date-strict": "*",
"zod": "3.23.8"
--- a/package-lock.json
+++ b/package-lock.json
+ "node_modules/is-iso-date-strict": {
+ "version": "0.0.3",
+ "license": "UNLICENSED",
+ "hasInstallScript": true,
+ "dependencies": { "dateparse-x": "*" }
A dependency is code under review
Treat every package the agent adds as code you are approving. Check that it is needed, that the exact name is the project you meant, and that it is maintained, pinned and licensed. Then read what the lockfile pulled in with it. "It installed and tests pass" proves only that *something* with that name exists.
On Bytewise this lesson comes in small steps with a check at the end, and the app brings it back right before you would forget it.