Skip to content

Security: AlgorithmicMind/codeshield

SECURITY.md

Security Policy

Supported Versions

Security fixes are applied to the latest minor release on the main branch.

Version Supported
0.2.x (latest) ✅
< 0.2.0 ❌ (upgrade to >=0.2.0)

Security Model & Threat Boundaries

CodeShield provides application-layer defense-in-depth for executing LLM-generated Python snippets (analytics, data transformation, scripting, and agent tool calls):

  • Fail-closed Static AST Gate: blocks syntax errors, overly broad exception handlers, dangerous builtins (eval, exec, compile, __import__, reflection helpers), aliased or variable-rebound calls, restricted modules (subprocess, ctypes, importlib, pickle, socket, shutil, builtins, etc.), dangerous os/sys APIs, and reflection dunder attributes (__subclasses__, __builtins__, __globals__, etc.).
  • Minimal Environment Allowlist: subprocesses never inherit the full host os.environ (protecting GEMINI_API_KEY, cloud credentials, and database secrets). Extra variables must be passed explicitly via CodeExecutionRequest(env=...) or SubprocessRunner(env_allowlist=...), while interpreter-hijacking variables (LD_PRELOAD, PYTHONPATH, PYTHONSTARTUP, etc.) are blocked.
  • Workspace & Path Hardening: child processes execute with cwd locked to the ephemeral sandbox directory, temporary directories redirected inside the workspace, strict validation against path traversal in file/venv names, and strict PEP 508 validation on package specifiers (blocking pip flags, VCS URLs, and local paths).
  • Resource & Process-Tree Guardrails: bounded stdout/stderr capture (max_output_bytes) prevents memory exhaustion, stdin=DEVNULL prevents interactive hangs, host workspace paths are redacted from stderr/tool errors, and timeouts terminate the entire process tree.

Important boundary: Python virtualenvs and static AST inspection are not a substitute for kernel-level OS isolation. If your deployment runs untrusted or adversarial multi-tenant code, run CodeShield inside an OS-level sandbox such as Docker (with --network=none, --read-only, dropped capabilities, and memory/CPU limits), gVisor, Kata Containers, or Firecracker microVMs.

Reporting a Vulnerability

Please do not open a public GitHub issue for suspected security vulnerabilities.

Instead, report vulnerabilities privately via GitHub Security Advisories:

Include a concise description of the issue, affected version, reproduction steps, and potential impact. We aim to acknowledge reports within 72 hours and coordinate a fix before public disclosure.

There aren't any published security advisories