[bug fix] pass docker login token via stdin#1395
Conversation
Avoid interpolating registry tokens into a shell command during docker login. This preserves passwords containing shell-special characters such as quotes or dollar signs.
|
There are multiple occurrences where this can happen, |
Add direct command execution helpers that pass arguments separately and support piped stdin. Use the safe execution path for Docker login, log searches, Docker secret/config creation, container stop/remove, Docker build/run/service create, compose operations without wrappers, stack deploy without env prefixes, and Core network route commands. Keep shell execution only for explicit user-provided scripts, compose command wrappers, and env-prefixed swarm commands where shell behavior is intentional.
|
I tried to address this by centralizing safe command execution in lib/command. |
Ref. #1377
Avoid interpolating registry tokens into a shell command during docker login. This preserves passwords containing shell-special characters such as quotes or dollar signs.
Summary
Fix Docker registry login handling in Periphery by passing the registry token directly to
docker login --password-stdininstead of interpolating it into a shell command.Why
Registry passwords or tokens containing shell-special characters like
'or$could break login because they were evaluated by the shell before reaching Docker.Changes
echo {token} | docker login ...with directtokio::process::Commandexecution.Changes
echo {token} | docker login ...with directtokio::process::Commandexecution.Verification
cargo fmt --checkgit diff --checkcargo check -p komodo_peripheryInittask equivalent completed