security: isolate host agents and sanitize subprocesses - #303
Conversation
c39ab40 to
476122c
Compare
Code reviewFound 1 issue:
forge/src/forge/integrations/agents/security.py Lines 49 to 55 in 5faf4ed 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
|
Addressed the existing review feedback in f71b3d2:
Independent review also found and fixed an MCP/built-in name collision: an allowlisted MCP tool named Validation: targeted Ruff checks pass; all 2,149 unit tests pass (one pre-existing AsyncMock warning). No additional blocking findings in the PR diff. |
eshulman2
left a comment
There was a problem hiding this comment.
Automated inline review. Overall this is a solid hardening pass (isolated host-agent root, exact tool/MCP allowlisting, sanitized subprocess env, symlink/traversal guards) and CI is green. One finding below is verified against the actual langchain/langgraph tool-merge code and should be fixed before merge since it undermines this PR's own stated goal (exact allowlisting instead of trusting names). The other two are lower-severity notes, not blockers.
eshulman2
left a comment
There was a problem hiding this comment.
Re-reviewed after the latest push. Commit ad58dec correctly fixes both prior findings: the MCP/safe-builtin-tool collision check (agent.py:404, now checks SAFE_BUILTIN_TOOLS | PROHIBITED_BUILTIN_TOOLS, with a new test) and the stale-skill pruning (security.py, committed skills now rebuilt exactly into a separate committed-skills dir each startup, with tests). Good fixes.
However, this same commit introduces a new regression by only updating the host-agent skill path and missing the container-agent one — see inline comment. Also note CI's Lint job is currently red on this commit (ruff format check on agent.py), which is a mechanical fix, not a design issue.
Summary
Security boundary
This phase intentionally leaves the top-level container environment, provider authentication, Google ADC mounts, Langfuse callbacks, tracing metadata, session correlation, and dynamic-skill behavior unchanged.
inherit_env=Falseis defense in depth: sufficiently capable code may still inspect container-level secrets through mechanisms such as/proc.Validation
uv run ruff check src/forge/integrations/agents src/forge/skills/resolver.py src/forge/main.py src/forge/orchestrator/worker.py src/forge/config.py src/forge/cli.py containers/entrypoint.py tests/unit/integrations/agentsgit diff --check origin/main...HEADDeployment docs
See
docs/security/agent-isolation.mdfor configuration, rootless Podman controls, hardened service-container settings, Kubernetes prerequisites, negative tests, canary rollout, incident response, and deferred gateway/proxy work.