mirror of
https://github.com/rennf93/roboco.git
synced 2026-08-03 07:23:24 +02:00
fix(bash-guard): block package-env mutations targeting /app (all providers)
An agent that ran `uv sync` / `pip install` against /app rebuilt the orchestrator's MCP-gateway venv (/app/.venv) — breaking its own gateway tools (every roboco-flow/-do/-git verb), stranding it, and getting its task reaped. Deny package-mutation verbs (uv sync/lock/add/remove, uv pip, pip install) whose target resolves to /app (cd /app, --project/--directory /app, /app/.venv, UV_PROJECT_ENVIRONMENT=/app). Placed outside the ROBOCO_GUARD_SKIP_GIT gate so it fires for every provider — the Claude PreToolUse hook and the grok exfil hook alike. Reads of /app and workspace installs are untouched.
This commit is contained in:
@@ -321,4 +321,21 @@ if echo "$low" | grep -qE '(^|[[:space:];&|])rm[[:space:]]+[^|;&]*-[[:alpha:]]*[
|
||||
fi
|
||||
fi
|
||||
|
||||
# --- package-environment mutations targeting /app (ALL providers) -------------
|
||||
# /app holds the orchestrator code and the MCP-gateway venv (/app/.venv). An
|
||||
# agent that `uv sync` / `pip install`s into /app rebuilds that venv and breaks
|
||||
# its OWN gateway tools (every roboco-flow / -do / -git verb) — stranding the
|
||||
# agent and getting its task reaped. Agents manage dependencies in their
|
||||
# workspace clone under /data/workspaces, never in /app. Two-step: a
|
||||
# package-mutation verb AND a target that resolves to /app's environment
|
||||
# (cd /app, --project/--directory /app, /app/.venv, UV_PROJECT_ENVIRONMENT=/app).
|
||||
# Reads of /app (cat/ls/grep) and workspace installs are untouched. Deliberately
|
||||
# NOT gated by ROBOCO_GUARD_SKIP_GIT, so it fires for every provider — the Claude
|
||||
# PreToolUse hook AND the grok exfil hook (and future provider hooks).
|
||||
if echo "$low" | grep -qE '(^|[[:space:];&|])(uv[[:space:]]+(sync|lock|add|remove)|uv[[:space:]]+pip[[:space:]]+(install|uninstall)|pip3?[[:space:]]+(install|uninstall))' && \
|
||||
echo "$low" | grep -qE '(/app/\.venv|--project[[:space:]=]+"?/app([^a-z]|$)|--directory[[:space:]=]+"?/app([^a-z]|$)|uv_project_environment="?/app([^a-z]|$)|(^|[[:space:];&|])cd[[:space:]]+"?/app([^a-z]|$))'; then
|
||||
echo "Denied: installing or syncing packages into /app rebuilds the orchestrator / MCP-gateway venv (/app/.venv) and breaks your own gateway tools. Manage dependencies in your workspace clone under /data/workspaces, never /app. If /app's environment looks broken, report it via your blocked / escalation verb — don't try to repair it." >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
Reference in New Issue
Block a user