Repository navigation
fix(controlplane): end git options before ls-remote source and ref - #43
Conversation
Pinning ran `git ls-remote --exit-code <source> <ref>`. Neither value can be read as an option today: git parses nothing after the repository, and normalization keeps sources off "-". CodeQL flagged it anyway (go/command-injection, alerts #2 and #3). "--" makes the guarantee local instead of resting on both facts. The test passes a source and a ref of --upload-pack=touch <marker> and checks the marker never appears. It fails with "--" removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
What
Adds
--to thegit ls-remotecall that pins a run target's base commit (resolveBaseSHA).Why
This is hardening. Nothing was exploitable before the change:
--upload-pack=touch Xresolves as a plain name and runs nothing.NormalizeRepositoryIdentityonly produces an absolute path orhttps://github.com/...as the source, never a value starting with-.The safety rested on both of those facts. With
--, it no longer does. This also answers CodeQL'sgo/command-injectionalerts #2 and #3.Verification
TestPinningNeverReadsASourceOrRefAsAGitOptionpasses a source and a ref of--upload-pack=touch <marker>and checks the marker never appears.runs.gochange reverted and the test kept, the test fails (git ran --upload-pack), so it covers the fix.just checkpasses: format, vet, boundary, definitions, all tests, build.🤖 Generated with Claude Code
Summary by CodeRabbit