Unknown and invented packages
Explain why an agent may suggest a package that does not exist or is a malicious look-alike, which attackers register on purpose. Check name, publisher, popularity and need before approving an install.
Builds on: Outdated knowledge and invented APIs
A package name that sounds just right
You ask the agent to make your Python script read tables from PDF files. It replies that it will add a library and proposes a command:
⚙ Run: `pip install pdf-table-extractor`
[Approve? yes / no / always]
The name describes exactly what you need, and the agent sounds sure. You have never heard of it. Should you approve, and what could go wrong if you do?
Invented names that attackers claim
The agent can invent a package name the same way it invents a function: it produces the most plausible-sounding text. The same invented names tend to come up again and again for similar requests. Attackers find them by asking AI tools common questions themselves, then publish harmful packages under those names (**slopsquatting**). Others publish misspellings of popular packages (**typosquatting**). Installing can run the package's setup code right away, with your user's access, before your script ever uses it.
Four checks before approving an install
Say no first, then check on the registry website yourself (`pypi.org`, `npmjs.com`). Don't ask the agent to vouch for it.
1. **Need**: do Python's built-in modules or an existing dependency already do this?
2. **Name**: exact spelling, letter by letter.
3. **Publisher**: known maintainer, linked source code, long release history.
4. **Popularity**: real downloads and users, not just days old.
Any doubt: decline and redirect.
Checking the PDF package
You choose **no**. You open `requirements.txt` and see `pdfplumber` is already listed, so the need is covered. You also check the registry: `pdf-table-extractor` isn't there. That doesn't make the name safe. Anyone could publish it tomorrow, and **existing wouldn't make it trustworthy either.** You tell the agent to use what the project already has and not to add packages without asking.
Declining and redirecting
An excerpt from the session. You decline, check the registry in your own terminal, then give a precise instruction. `pip index versions` asks PyPI which versions of a name exist. pip marks this command as experimental, so it may print a warning first.
⚙ Run: pip install pdf-table-extractor
[Approve? yes / no / always] no
$ pip index versions pdf-table-extractor
ERROR: No matching distribution found
for pdf-table-extractor
▸ You: pdf-table-extractor isn't on PyPI.
Use pdfplumber, already in
requirements.txt. Don't install any new
package without asking me first.
Treat every new package name as a claim
An agent's package name is a guess. Attackers publish real, harmful packages under common guesses and misspellings. Before approving any install, check need, exact name, publisher and popularity yourself on the registry.
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.