Skip to main content

Guardrails that prevent AI agents from installing malicious or hallucinated dependencies.

Project description

🛡️ CodeGate

Supply-Chain Guardrails for AI Agents

License: MIT Python Virtualization Security

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 install at 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

  1. codegate run injects a guarded PATH for that process only
  2. pip install is intercepted by a transparent shim
  3. Known hallucinated or malicious packages are denied before execution
  4. Unknown packages are evaluated against explicit execution policies
  5. 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

codegate_cli-0.1.7.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

codegate_cli-0.1.7-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

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

Hashes for codegate_cli-0.1.7.tar.gz
Algorithm Hash digest
SHA256 a0174faf0864231c15b872dea282077f763759f6ca33426530f6a8c207ce6b88
MD5 cda3b5377821411d1fd177e7d87ffc2f
BLAKE2b-256 e58fc99d728bb6d7a4f3ddccce428a97fe853965444085e9557e6ef4f05cb891

See more details on using hashes here.

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

Hashes for codegate_cli-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 ec0e8328aa04718877c1267be903ccb402311d2343b15644a8cb822b999e6960
MD5 5be0725d574d3c30784728bb75c694da
BLAKE2b-256 c8dc4403ca8d589e50be61f383f771f30b210fbde1ae4a794b5e7f9a28f47ce2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page