dependency gate
A check in CI or a pre-commit hook that decides every new dependency: blocked if it is missing from the registry or looks like a typosquat, reviewed if unapproved, pinned if approved.
In more detail
It turns package hallucination and typosquatting from a review-time hope into an automatic rule. Run it on every pull request, so code written by people and by assistants faces the same rule.
Related terms
- package hallucination — A coding model recommending a dependency that does not exist, which an attacker can then register with malicious code.
- typosquatting — Registering a name that differs from a popular one by a small typing mistake, such as a lookalike domain or package name, to catch people who mistype it.
- PyPI — The Python Package Index at pypi.org, the public online catalogue from which pip downloads third-party packages.
Taught in
- Working With AI Coding Assistants — AI Engineering: LLM Apps, RAG & Agents
References
- PyPI JSON API
- Spracklen et al., We Have a Package for You! A Comprehensive Analysis of Package Hallucinations by Code Generating LLMs (USENIX Security 2025)