Skip to content

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

chore: files changed src/openhuman/tools/impl/filesystem/git_operations_config.rs

Steven Enamakelb4bd466c1293
diff --git a/src/openhuman/tools/impl/filesystem/git_operations_config.rs b/src/openhuman/tools/impl/filesystem/git_operations_config.rs
index 20f11429f1..9f683e2562 100644
--- a/src/openhuman/tools/impl/filesystem/git_operations_config.rs
+++ b/src/openhuman/tools/impl/filesystem/git_operations_config.rs
@@ -137,6 +137,49 @@ pub(super) const NEUTRALISED_CONFIG: &[&str] = &[
"uploadpack.packObjectsHook=",
];
+/// The entries of [`NEUTRALISED_CONFIG`] that are also safe to force on an
+/// *arbitrary* `git` invocation, plus `commit.gpgSign`.
+///
+/// The `shell` tool runs git too, and since the `files` tool pack withheld
+/// `git_operations` it runs most of it. Nothing there controls argv, so the
+/// `-c` layer [`hardened_git`] builds is unavailable; the same overrides ride
+/// `GIT_CONFIG_PARAMETERS` instead, which git documents as the mechanism `-c`
+/// itself uses to reach child processes, at the same precedence.
+///
+/// **This is the denylist half of the policy, not the fail-closed half.**
+/// [`ALLOWED_REPO_CONFIG`] cannot come with it: inspecting the repository
+/// config before every shell command would cost a `git` round trip on commands
+/// that have nothing to do with git, and would refuse to run in an ordinary
+/// LFS checkout. So this narrows the surface; it does not close it the way
+/// `git_operations` does.
+///
+/// Three entries of [`NEUTRALISED_CONFIG`] are deliberately **not** here:
+///
+/// - `core.sshCommand=`. It is the same trap the `diff.external` note above
+/// records: an empty value is not "use the default", it is a command git
+/// tries to execute. `git_operations` gets away with listing it because none
+/// of its operations reach a remote; a shell `git fetch` / `git push` does,
+/// and would die on every one. Excluded rather than risked.
+/// - `diff.external`. Unsuppressable by value for the same reason, and the fix
+/// `git_operations` uses — `--no-ext-diff` — is an argv change this path
+/// cannot make. A repository that sets it keeps it, and that is a known gap.
+/// - `core.hooksPath`. Not a gap here but a different owner: the shell already
+/// points it at OpenHuman's attribution hook directory, whose shims
+/// deliberately delegate onward to whatever the repository configured. Hooks
+/// therefore still run under `shell`, by design — see the module docs on
+/// `agent::git_attribution`.
+pub(crate) const SHELL_NEUTRALISED_CONFIG: &[&str] = &[
+ "core.fsmonitor=",
+ "core.pager=cat",
+ "core.editor=false",
+ "sequence.editor=false",
+ "uploadpack.packObjectsHook=",
+ // Not in `NEUTRALISED_CONFIG` — `hardened_git` adds it separately, for the
+ // reason written there: a repository must not get to spend the host's
+ // signing key on a commit nobody asked to sign.
+ "commit.gpgSign=false",
+];
+
/// A path git will read as an empty config file.
///
/// `GIT_CONFIG_GLOBAL` must name something readable-and-empty rather than be