Standardize shell-safe rendering of recreated CLI commands
Open
@michaelryanmcneill is already working on this.
Since Sep 11, 2026.
- Dominant language
- Go
- Stars
- 103
- Forks
- 257
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 43
Description
Summary
Define and implement a consistent shell-safe rendering policy for recreated ROSA CLI commands.
Rationale
buildCommand renders a command for users to copy into a shell. It does not execute that command. Several user-controlled values are inserted into the rendered command without shell quoting. This includes comma-joined flag values and other string arguments. A targeted change for one flag would be inconsistent.
Affected areas
cmd/create/cluster/cmd.go, especiallybuildCommand- Equivalent recreated-command renderers in other CLI commands, if present
- Shared command-rendering or quoting helpers in
pkg/helper - Unit tests for command rendering
Required changes
- Define which generated command values require shell-safe quoting.
- Select or extend a shared helper for POSIX-shell-safe argument rendering.
- Apply the policy consistently to recreated commands and their user-controlled arguments.
- Preserve command semantics for normal values, lists, and intentionally empty values.
- Add focused tests for spaces, quotes, shell metacharacters, and comma-joined values.
Acceptance criteria
- Generated recreation commands remain copy-paste safe for supported user input.
- Similar value types use the same quoting policy.
- Tests cover the shell-sensitive input cases.
- Documentation or code comments state the rendering policy and its scope.
Backlinks
- Pull request: https://github.com/openshift/rosa/pull/3500
- Review discussion: https://github.com/openshift/rosa/pull/3500#discussion_r3990744573
- Requested by: @michaelryanmcneill
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.