Guardrails that prevent AI agents from installing malicious or hallucinated dependencies.
Project description
🛡️ CodeGate
Supply-Chain Guardrails for AI Agents
Guardrails that stop AI agents from installing malicious dependencies.
CodeGate prevents hallucinated and malicious dependencies from executing when AI agents run pip install.
It works at runtime, requires no agent integration, and is fully opt-in.
Quick demo (30 seconds)
pip install codegate-cli
codegate activate
codegate run -- pip install requests # ✅ allowed
codegate run -- pip install dotenv # ⛔ blocked
Output:
Blocked by CodeGate (known hallucination):
dotenv → use python-dotenv instead
Why this exists
Autonomous coding agents generate and execute code at runtime.
Unlike humans, LLMs frequently hallucinate dependency names or suggest unsafe packages.
Attackers register those names on PyPI (slopsquatting) to deliver malware.
If an agent runs pip install on a hallucinated name, your machine is compromised instantly.
CodeGate blocks those installs before they execute.
What CodeGate does
Does
- Intercepts
pip installat runtime - Blocks known hallucinations and slopsquatting attacks
- Optionally enforces a remote security policy
- Works with any AI agent or coding tool
Does NOT
- Hijack your system globally
- Run invisibly or auto-update
- Require blind trust
- Depend on agent behavior
How it works
codegate runinjects a guarded PATH for that process onlypip installis intercepted by a transparent shim- Known hallucinated or malicious packages are denied before execution
- Unknown packages are evaluated against explicit execution policies
- Allowed installs are delegated to the real
pip
No global hijacking. No hidden behavior.
Installation
pip install codegate-cli
Activate CodeGate (dev-friendly by default):
codegate activate
Usage (recommended)
codegate run -- pip install numpy
codegate run -- python my_agent.py
If the agent runs pip install, CodeGate is enforced.
Strict mode (CI / production)
codegate activate --strict
Strict mode fails closed:
if the security scanner is unreachable or denies a dependency, the installation is blocked.
Trust model
CodeGate is intentionally opt-in and inspectable.
- Shims are readable shell scripts
- Enforcement happens only when invoked
- No mandatory global PATH hijacking
- Fully open source
Firecracker & isolation (roadmap)
CodeGate is designed to support runtime isolation for unknown packages
(using Firecracker MicroVMs and network confinement).
This repository currently focuses on runtime interception and policy enforcement.
License
MIT License © 2025 CodeGate
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file codegate_cli-0.1.7.tar.gz.
File metadata
- Download URL: codegate_cli-0.1.7.tar.gz
- Upload date:
- Size: 11.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a0174faf0864231c15b872dea282077f763759f6ca33426530f6a8c207ce6b88
|
|
| MD5 |
cda3b5377821411d1fd177e7d87ffc2f
|
|
| BLAKE2b-256 |
e58fc99d728bb6d7a4f3ddccce428a97fe853965444085e9557e6ef4f05cb891
|
File details
Details for the file codegate_cli-0.1.7-py3-none-any.whl.
File metadata
- Download URL: codegate_cli-0.1.7-py3-none-any.whl
- Upload date:
- Size: 11.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec0e8328aa04718877c1267be903ccb402311d2343b15644a8cb822b999e6960
|
|
| MD5 |
5be0725d574d3c30784728bb75c694da
|
|
| BLAKE2b-256 |
c8dc4403ca8d589e50be61f383f771f30b210fbde1ae4a794b5e7f9a28f47ce2
|