validate repo_url and harden git argv against option injection #94
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #94"
general
weight: 0.35
inteon
VC-53817 — argument / transport injection via
repo_urlBranch:
VC-53817.A standalone reviewer script is embedded at the bottom of this description
(see verify.sh — click to expand). It is fully sandboxed under
/tmp/klone-vc-53817., makes no network calls, and is removed on exit.The vulnerability
klonereadsrepo_urlfromklone.yamlas an opaque string and hands itto
git ls-remoteandgit cloneas a positional argument. Git acceptstwo URL shapes that are not really URLs:
1.
ext::sh -c <cmd>— git's "external transport" helper runs<cmd>as the remote process. Default git config (
protocol.ext.allow=user)permits it when the URL comes from the command line.
2. A value starting with
-— git's option parser treats it as a flag.--upload-pack=<cmd>is honoured by bothls-remoteandcloneandruns
<cmd>instead of the realgit-upload-pack.Either gives the manifest author arbitrary code execution as the invoking
user.
Three things were missing:
repo_urlbefore it reachesgit.--end-of-options terminator before the URL positional.trusted.
The fix
pkg/mod/index.go—ValidateRepoURLenforces an allow-list and shapecheck before any git invocation. Rejects: empty, leading
-,::substring (helper transports), and anything that is not
https:///http:///ssh:///git:///file:////abs/path/scp-like
user@host:path. Called at the top of the per-sourcecleanFnin
pkg/sync/sync.go.pkg/download/git/clone.go—--terminator inserted beforerepoURLin thegit cloneargv.-c protocol.ext.allow=neverprepended to everygitinvocation, sothe
ext::helper is denied regardless of the host's git config.(
git checkout <hash>is deliberately not given a--, becausethere git would re-interpret the hash as a pathspec.)
pkg/download/git/hash.go—--terminator inserted beforerepoURLinthe
git ls-remoteargv.What we deliberately did not do
We did not set
GIT_PROTOCOL_FROM_USER=0. That would have told git"treat all URLs as not-from-user," which also denies
file://(andseveral other protocols whose default is
allow=user).file://is alegitimate transport for tests, on-disk mirrors, and local vendoring —
blocking it would break existing users. The scheme allow-list plus the
explicit
-c protocol.ext.allow=nevergive us the same protectionwithout the collateral damage.
How to review
Prerequisites
go(1.23+),gitonPATH.the bottom of this description and save its contents to
/tmp/verify-vc-53817.sh.Step 1 — confirm the CVE exists on pre-fix klone
Expected: exit code
1.ext::):VULNERABLEorBLOCKED_BY_HOSTdepending onyour git config. If your host already sets
protocol.ext.allow=never, the disclosed vector is unfireable there;this is still printed as
BLOCKED_BY_HOST(not credit to klone) so theexit code stays
1.--upload-pack):VULNERABLE—/tmp/klone-vc-53817./markers/klone-pwned-optinjectwill exist after the run.Step 2 — confirm the fix blocks both vectors
Expected: both vectors
BLOCKED by klone (repo_url validator rejected ...),exit code
0.Step 3 — run the regression tests
Expected: all green. Notable:
TestValidateRepoURLcovers the validator directly — positive cases(https/http/ssh/git/file/abs/scp-like) and negative cases (ext::,
--upload-pack=…, lone-uX,transport_helper::cmd, empty,relative path, bare hostname,
javascript:).Optional — positive smoke test with a real URL
A
file://sync (the scheme most likely to break ifGIT_PROTOCOL_FROM_USER=0had been set) still works:Side-effect statement
The script creates everything under
/tmp/klone-vc-53817.*(includingits own
markers/directory for the PoC payloads). The trap on exitremoves it (set
KEEP_SANDBOX=1to retain). No file outside thatsandbox is created, modified, or deleted at any point. The PoC payloads
write only inside the sandbox, never to
/tmp/klone-pwnedor otherfixed paths.
---
<details>
<summary><b>verify.sh</b> — click to expand the standalone reviewer script</summary>
Save the block below to
/tmp/verify-vc-53817.shbefore running thesteps above.
</details>