diff --git a/tools/approval.py b/tools/approval.py index 6e282c98d59..cc5aedc9e02 100644 --- a/tools/approval.py +++ b/tools/approval.py @@ -367,6 +367,13 @@ DANGEROUS_PATTERNS = [ # terminates all running agents mid-work. (r'\bhermes\s+gateway\s+(stop|restart)\b', "stop/restart hermes gateway (kills running agents)"), (r'\bhermes\s+update\b', "hermes update (restarts gateway, kills running agents)"), + # Docker container lifecycle — any user with docker.sock mounted (a common + # Docker Compose pattern) gives the agent the ability to restart/stop/kill + # containers without approval. These are agent-initiated lifecycle operations + # that should always require user consent, just like `hermes gateway restart` + # already does for the gateway process. + (r'\bdocker\s+compose\s+(restart|stop|kill|down)\b', "docker compose restart/stop/kill/down (container lifecycle)"), + (r'\bdocker\s+(restart|stop|kill)\b', "docker restart/stop/kill (container lifecycle)"), # Gateway protection: never start gateway outside systemd management (r'gateway\s+run\b.*(&\s*$|&\s*;|\bdisown\b|\bsetsid\b)', "start gateway outside systemd (use 'systemctl --user restart hermes-gateway')"), (r'\bnohup\b.*gateway\s+run\b', "start gateway outside systemd (use 'systemctl --user restart hermes-gateway')"),