fix: restrict docker commands for ai-worker (wrapper blacklist — exec, cp, commit, etc. blocked) #65
Reference in New Issue
Block a user
No description provided.
Delete Branch "feat/restrict-docker-blacklist"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Security Fix: Block dangerous docker commands for ai-worker
Problem
The
ai-workeruser is in thedockergroup, giving unrestricted access to ALL Docker commands. An agent was able to generate a Gitea admin token viadocker exec -u git gitea gitea admin user generate-access-token -u gortium.This PR
Keeps ai-worker in the
dockergroup (sodocker ps,docker compose,docker build,docker run, etc. still work), but wraps thedockerbinary with a script that blocks dangerous subcommands.BLOCKED commands
exec,cp,commit,diff,export,import,load,save,attach,push,tagALLOWED commands
ps,images,inspect,logs,start,stop,restart,rm,rmi,pull,build,run,compose,system,network ls,volume lsHow it works
A wrapper script intercepts
dockercalls, parses the subcommand, and rejects blocked ones. The wrapper is installed both as a system package and in ai-worker's personal profile so it takes precedence over the real Docker binary.Fixes
Closes the security incident where the agent created a Gitea admin token via docker exec.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.