Skip to content

Pass registry passwords over stdin instead of through a shell string - #2221

Open
jlaneve wants to merge 3 commits into
mainfrom
fix/registry-login-stdin
Open

jlaneve wants to merge 3 commits into
mainfrom
fix/registry-login-stdin

Conversation

@jlaneve

@jlaneve jlaneve commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Description

Three registry-login sites built a bash -c string of the form echo "<password>" | docker login ... --password-stdin, splicing the credential into shell text. A password containing a quote, $, or backticks either broke the login or got interpreted by the shell, and login required bash on the host for no reason.

What changed: a new cmdExecWithStdin helper (matching the existing cmdExec's style) runs the runtime binary directly with the password written to the child's stdin pipe — no shell, no quoting rules, no bash dependency. All three sites converted; the rest of the tree was checked for the same pattern and none remain.

Breaking changes

None for legitimate use — same login outcome, same error format. Bash is no longer required for login. One edge-case wording change: a missing runtime binary now errors as "failed to find the command" rather than a bash "not found" error.

Testing

Tests cover passwords containing $(...), backticks, and quotes reaching the login command unchanged via stdin, plus mock updates across the touched files. go test ./..., go vet ./airflow/..., and make lint pass.

🤖 Generated with Claude Code

https://claude.ai/code/session_01P6DEdUpFBFaAiPKEu81Wti

jlaneve and others added 2 commits July 21, 2026 14:43
Docker/podman login built its command as a bash -c string with the
password spliced in directly. A password containing a quote, a dollar
sign, or backticks could break the login or get executed by the shell.
It also meant login only worked on hosts with bash installed.

Login now runs the container runtime binary directly with exec.Command
and writes the password to its stdin pipe for --password-stdin, so the
shell never sees it. Same change in airflow/docker_image.go (Pull and
pushWithBash) and airflow/docker_registry.go (dockerLogin).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…eal runtime

The bash-less login fallback added for the password-stdin fix runs through
cmdExecWithStdin, which this subtest never stubbed, so CI executed a real
docker login against a dummy registry and failed on connection refused.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P6DEdUpFBFaAiPKEu81Wti
@jlaneve
jlaneve requested a review from a team as a code owner July 21, 2026 19:36
@coveralls-official

coveralls-official Bot commented Jul 21, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 29870733103

Coverage increased (+0.01%) to 43.894%

Details

  • Coverage increased (+0.01%) from the base build.
  • Patch coverage: 17 of 17 lines across 2 files are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 59029
Covered Lines: 25910
Line Coverage: 43.89%
Coverage Strength: 8.6 hits per line

💛 - Coveralls

Every existing test stubs cmdExecWithStdin, so the helper body itself
never ran under coverage and coveralls flagged a drop. Add a direct
test mirroring TestExecCmd: stdin reaches the child's stdout, a
missing binary errors with "failed to find", and a nonzero exit
errors with "failed to execute cmd".

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P6DEdUpFBFaAiPKEu81Wti
@github-actions

Copy link
Copy Markdown
Contributor

This PR is stale because it has been open for 60 days with no activity.

@github-actions github-actions Bot added the stale label Sep 20, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant