fix: use single-quoted shell escaping for --format env output#3856
Merged
Conversation
2ef769e to
2b441f2
Compare
zhming0
requested changes
Apr 27, 2026
Contributor
zhming0
left a comment
There was a problem hiding this comment.
There might be a blocker re \n handling but otherwise I think this PR is in the right direction 👍🏿
ss1909
commented
Apr 27, 2026
zhming0
approved these changes
Apr 27, 2026
Contributor
zhming0
left a comment
There was a problem hiding this comment.
LGTM, I hallucinated about the newline issue 😅
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Extracts the secretGet logic from the CLI action into a testable function, and adds a unit test suite for it. Also fixes the env format output to use single-quoted shell escaping (via shellQuote) instead of Go's %q double-quoting, so values are safe to source in shell without unintended interpolation.
Context
The secretGet logic previously lived inside the cli.Command action, making it impossible to unit test without going through the CLI framework. The env format also used %q which produces Go-style double-quoted strings — not correct shell quoting for use with source or declare -x.
Changes
Extracted secretGet into a standalone function accepting
Fixed env format to use shellQuote (single quotes with ''' escaping) instead of %q
Added clicommand/secret_get_test.go
Testing
go test ./...). Buildkite employees may check this if the pipeline has run automatically.go tool gofumpt -extra -w .)Disclosures / Credits
Claude Code wrote some of the unit tests, then I changed most of it 😄