Redact environment secrets from dev container `docker exec` logs (#63606)
# Objective
Fixes #63569
`run_docker_command` Debug-formatted the whole `docker exec` command, so
every `-e NAME=VALUE` pair forwarded into a dev container was written to
`Zed.log` in plaintext: once at DEBUG, and again in the error message
that `remote_client.rs` logs at ERROR on a failed reconnect.
## Solution
Render the command with `redact_arguments`, which replaces the value of
every `-e NAME=VALUE` argument with `<redacted>` before the arguments
are flattened, and pass the remaining arguments and stderr through
`util::redact::redact_command`.
Validate `containerEnv` and `remoteEnv` keys in `spawn_dev_container`
before any container is reused or built, because an empty key produced
`-e =VALUE`, which the Docker CLI rejects while echoing the value
verbatim to stderr.
Skip invalid names in `remote` as well, since `remote_env` is also
rehydrated from the workspace database.
The shared predicate lives in `util::redact::is_valid_environment_name`.
The DEBUG line now logs the redacted command and exit status only; the
previous stdout and stderr byte dumps are gone.
## Testing
`cargo test -p remote -p dev_container --lib`.
Unit tests cover redaction of forwarded env, argument boundaries,
assignments inside program arguments and stderr, invalid-name skipping
and rejection, and the podman CLI.
Release Notes:
- Fixed dev container environment variables being logged in full
---------
Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
1057c2cf3dCoinleft LFT committed on 9/4/2026, 3:02:13 AM· committed by GitHubparent206a863