Skip to content

fix(no-ticket): quote the standalone binary path in helper launchers - #492

Open
cloudsmith-iduffy wants to merge 1 commit into
iduffy/v2-workspace-domainsfrom
iduffy/shared-credential-helper-code
Open

cloudsmith-iduffy wants to merge 1 commit into
iduffy/v2-workspace-domainsfrom
iduffy/shared-credential-helper-code

Conversation

@cloudsmith-iduffy

@cloudsmith-iduffy cloudsmith-iduffy commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

Description

The standalone binary writes launchers that run the binary by its absolute path. The docker, pnpm, cargo and terraform installers each had their own copy of that code, and each copy put the path in plain double quotes. In a POSIX shell, $ and backticks still expand inside double quotes, so a binary under a path such as /opt/price$USD/cloudsmith gave a launcher that ran the wrong command.

  • helper_command() in credential_helpers/launchers.py now builds the launcher command for every helper. It quotes the path with shlex.quote on Linux and macOS. The Windows .cmd output is the same as before.
  • The helpers also had five copies of the "Unable to retrieve credentials" message. It is now one REFUSAL_MESSAGE in credential_helpers/common.py. The text does not change.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Refactoring
  • Other (please describe)

Additional Notes

test_frozen_install_launcher_targets_executable now installs the docker launcher from a path with $ in it and checks the exact exec line. It fails on the old code.

🤖 Generated with Claude Code

The docker, pnpm, cargo and terraform installers each had a copy of the
code that builds the launcher command for a standalone binary. The copies
put the path in plain double quotes, so a path with `$` or a backtick
broke the POSIX launcher. `helper_command()` in `launchers.py` replaces
the copies and quotes the path with `shlex.quote`. Windows output does
not change.

The helpers also had five copies of the "Unable to retrieve credentials"
message. It is now one `REFUSAL_MESSAGE` in `common.py`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cloudsmith-iduffy
cloudsmith-iduffy requested a review from a team as a code owner October 16, 2026 21:23
Copilot AI balanced review requested due to automatic review settings October 16, 2026 21:23
@cloudsmith-iduffy
cloudsmith-iduffy added this pull request to stack #493 October 16, 2026 21:23
@cloudsmith-iduffy cloudsmith-iduffy changed the title iduffy/shared credential helper code fix(no-ticket): quote the standalone binary path in helper launchers Oct 16, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused quoting fix and behavior-preserving refactoring have no unresolved findings, and reported execution checks confirm literal paths and argument forwarding.

No open issues 🎉

What changed in this PR

Fixes standalone credential-helper launchers on POSIX systems by safely quoting executable paths and sharing command construction.

Changes:

  • Centralizes launcher commands for Docker, pnpm, Cargo, and Terraform; preserves Windows output.
  • Consolidates credential-refusal messages without changing their text.
  • Strengthens the path-quoting regression test and documents the fix.
File Description
cloudsmith_cli/​credential_helpers/​terraform/​runtime.py Uses shared refusal message.
cloudsmith_cli/​credential_helpers/​terraform/​installer.py Uses shared launcher command.
cloudsmith_cli/​credential_helpers/​pnpm/​runtime.py Uses shared refusal message.
cloudsmith_cli/​credential_helpers/​pnpm/​installer.py Uses shared launcher command.
cloudsmith_cli/​credential_helpers/​launchers.py Centralizes commands and safe POSIX quoting.
cloudsmith_cli/​credential_helpers/​generic.py Uses shared refusal message.
cloudsmith_cli/​credential_helpers/​docker/​runtime.py Uses shared refusal message.
cloudsmith_cli/​credential_helpers/​docker/​installer.py Uses shared launcher command.
cloudsmith_cli/​credential_helpers/​common.py Defines shared refusal message.
cloudsmith_cli/​credential_helpers/​cargo/​runtime.py Uses shared refusal message.
cloudsmith_cli/​credential_helpers/​cargo/​installer.py Uses shared launcher command.
cloudsmith_cli/​cli/​tests/​test_credential_helper_terraform.py Updates refusal-message assertions.
cloudsmith_cli/​cli/​tests/​test_credential_helper_pnpm.py Updates refusal-message assertions.
cloudsmith_cli/​cli/​tests/​test_credential_helper_cargo.py Updates refusal-message assertions.
cloudsmith_cli/​cli/​tests/​commands/​test_credential_helper.py Updates refusal-message assertions.
cloudsmith_cli/​cli/​tests/​commands/​test_credential_helper_install.py Checks quoting for paths containing $ and spaces.
cloudsmith_cli/​cli/​tests/​commands/​test_credential_helper_generic.py Updates refusal-message references.
CHANGELOG.md Documents the POSIX launcher fix.

Review effort: Balanced

@cloudsmith-iduffy
cloudsmith-iduffy removed this pull request from stack #493 October 16, 2026 21:36
@cloudsmith-iduffy
cloudsmith-iduffy added this pull request to stack #495 October 16, 2026 21:36

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

None yet

Development

Successfully merging this pull request may close these issues.

2 participants