Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(git-tool): suppress textconv on git_diff, not just external diff\n\nCodeRabbit caught a gap in the `--no-ext-diff` hardening this PR added:\n`--no-ext-diff` covers `diff.external` and `diff.<driver>.command`, but\ntextconv is a separate mechanism with its own flag. A `.gitattributes` line\nselecting a driver whose `diff.<driver>.textconv` is set makes git EXECUTE\nthat command to render a binary file as text.\n\nReproduced against a scratch repo before changing anything: with\n`--no-ext-diff` alone the textconv script ran; with `--no-textconv` added it\ndid not.\n\nScope, stated honestly: this is the same second layer `--no-ext-diff` is, not\na live hole. `diff.<driver>.textconv` is not on `ALLOWED_REPO_CONFIG`, which is\nan allowlist that fails closed, so a repository carrying the key is already\nrefused before the command runs. The flag closes the window between that\ninspection and the invocation — the same rationale the existing `--no-ext-diff`\ncomment gives for itself.\n\n`hardened_git`'s `-c` list cannot do this job: driver names are arbitrary, so\nthere is no finite set of keys to neutralise. It has to be a command flag.\n

M3gA-Mind730befd6944f
diff --git a/src/openhuman/tools/impl/filesystem/git_operations.rs b/src/openhuman/tools/impl/filesystem/git_operations.rs
index c96d1dd7fa..1fbcd7dd5c 100644
--- a/src/openhuman/tools/impl/filesystem/git_operations.rs
+++ b/src/openhuman/tools/impl/filesystem/git_operations.rs
@@ -177,7 +177,17 @@ impl GitOperationsTool {
// `--no-ext-diff` is where external-diff suppression has to live: it is
// a diff-command flag, and the `-c diff.external=` that used to stand in
// for it made git exec the empty string instead of disabling anything.
- let mut git_args = vec!["diff", "--no-ext-diff", "--unified=3"];
+ //
+ // `--no-textconv` is a SEPARATE mechanism and needs its own flag.
+ // `--no-ext-diff` covers `diff.external` and `diff.<driver>.command`;
+ // it does not touch `diff.<driver>.textconv`, which a `.gitattributes`
+ // line (`*.bin diff=evil`) can select and which git then EXECUTES to
+ // render a binary file as text. Verified against a scratch repo: with
+ // `--no-ext-diff` alone the textconv script ran; adding
+ // `--no-textconv` it did not. `hardened_git`'s `-c` list cannot close
+ // this — driver names are arbitrary, so there is no finite set of keys
+ // to neutralise, and the suppression has to be a command flag.
+ let mut git_args = vec!["diff", "--no-ext-diff", "--no-textconv", "--unified=3"];
if cached {
git_args.push("--cached");
}