Skip to content

fix(security): command injection in registry.testRegistry / testRegistryById#4875

Merged
Siumauricio merged 1 commit into
canaryfrom
fix/cmdi-registry-test-login
Jul 20, 2026
Merged

fix(security): command injection in registry.testRegistry / testRegistryById#4875
Siumauricio merged 1 commit into
canaryfrom
fix/cmdi-registry-test-login

Conversation

@Siumauricio

Copy link
Copy Markdown
Contributor

Fixes GHSA-w6r4-f26v-8g36.

Problem

The remote (execAsyncRemote) path of both registry.testRegistry and registry.testRegistryById built the docker login command by interpolating the password directly into a shell string:

`echo ${input.password} | docker ${args.join(" ")}`

password (and registryUrl/username, which flow into args) were only z.string().min(1), so a password like pw; whoami; # executed arbitrary commands as root on the target server via SSH. Any user with registry:read could trigger it.

Fix

Reuse safeDockerLoginCommand (already used by createRegistry/updateRegistry), which shell-escapes registry/user/password and feeds the password through --password-stdin. The local path already used execFileAsync with an argv array + stdin and was safe.

Verification

  • safeDockerLoginCommand output: every payload (; whoami, $(), backtick, ' && rm) collapses to a single literal printf %s argument; legit login command unchanged.
  • Runtime: calling testRegistry with an injected password did not execute the payload (no marker file created).

Closes GHSA-w6r4-f26v-8g36.

…yById remote path

The remote (execAsyncRemote) path built `echo ${password} | docker ${args.join(" ")}`
with the password, registryUrl and username interpolated unescaped, so a password
like `pw; whoami` ran arbitrary commands as root on the target server. Reuse
safeDockerLoginCommand (already used by create/update), which shell-escapes each
field and feeds the password via --password-stdin. The local argv+stdin path was
already safe.
@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. bug Something isn't working labels Jul 20, 2026
@Siumauricio
Siumauricio merged commit ffe62bc into canary Jul 20, 2026
4 checks passed
@Siumauricio
Siumauricio deleted the fix/cmdi-registry-test-login branch July 20, 2026 23:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant