Secrets from .env are passed in docker exec/run argv (visible via ps)
What happened?
When the Docker sandbox is enabled (docker.enabled: true), values loaded from ~/.ductor/.env are passed to the container as -e KEY=VALUE, so they appear in the docker client's command line and are readable by any local user via ps or /proc/<pid>/cmdline.
ductor_bot/cli/base.py- the exec branch ofdocker_wrap()builds-e f"{key}={value}"for each merged env entry, so this happens on every CLI turn.ductor_bot/infra/docker.py-_env_secret_flags()does the same fordocker runat container start.
Non-Docker execution is unaffected: ductor_bot/cli/executor.py merges the values into the subprocess env= mapping, so they never reach argv.
redact_cmd_for_log() masks values in the logged command string only; the real argv is unchanged, so it does not cover this.
Approaches considered
Not proposing a specific PR - recording the options and their caveats so you can pick:
-e KEY(name only), value supplied through the docker client's environment. Docker reads the value from the client env, so argv carries only names (works from API 1.25+). Caveat:.envaccepts arbitrary keys and some names are meaningful to the docker CLI itself, so this needs an explicit policy for those before it is safe. It also requires threading a client environment fromdocker_wrap()throughSubprocessSpec, the executors, the provider call sites andDockerManager._exec; mutating the process-global environment is not viable because concurrent turns would race.--env-file. Keeps values out of argv, but needs a filtered temporary file holding plaintext (lifetime and cleanup), and docker's env-file parsing differs from the current dotenv handling.- Docker Engine API/SDK instead of the CLI. Env travels in the request body, so neither argv nor the client environment is involved - but it is a larger architectural change.
- Keep secrets out of
.enventirely. Only~/.ductor/.envis ever read, so a sibling file that ductor never loads is un-injected by construction, with a small loader so each tool reads just the keys it needs. This is what I settled on downstream; it needs no ductor change, but it is a convention and does not protect anyone who keeps secrets in.env.
Also worth noting: even with argv addressed, environment set at docker run is stored in the container configuration and readable via docker inspect.
Steps to Reproduce
- Put a secret in
~/.ductor/.env, e.g.EXAMPLE_TOKEN=<value>. - Run with
docker.enabled: true(Docker sandbox). - Send any message so a CLI turn starts.
- On the host, while the turn runs:
ps -eo args | grep 'docker exec'
The command line contains -e EXAMPLE_TOKEN=<value>.
Expected Behavior
Secret values should not appear in process arguments. Passing them over a channel that is not world-readable (for example the child process environment) would keep ps and /proc/<pid>/cmdline clean.
Operating System
Linux
Environment
Docker
Which LLM provider?
Not provider-specific
ductor version
0.20.1
/diagnose output
Relevant log output
LLM self-diagnosis (optional)
No response
Additional context
No response
Before submitting
- [x] I have searched existing issues for duplicates.
- [x] I am running the latest version.