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_tests.rs

Steven Enamakel9f92998fadeb
diff --git a/src/openhuman/tools/impl/filesystem/git_operations_config_tests.rs b/src/openhuman/tools/impl/filesystem/git_operations_config_tests.rs
index ddb30306ff..8bc577c97f 100644
--- a/src/openhuman/tools/impl/filesystem/git_operations_config_tests.rs
+++ b/src/openhuman/tools/impl/filesystem/git_operations_config_tests.rs
@@ -541,3 +541,45 @@ async fn an_ordinary_repository_still_produces_a_diff() {
result.output()
);
}
+
+/// The shell subset must stay a subset, so widening the policy is a decision.
+///
+/// `SHELL_NEUTRALISED_CONFIG` exists because the `shell` tool cannot use the
+/// `-c` layer `hardened_git` builds. The risk is drift in one direction:
+/// someone adds a newly-dangerous key to `NEUTRALISED_CONFIG`, the shell path
+/// silently keeps running without it, and the gap is invisible. This test
+/// cannot force the addition — some entries genuinely must not cross, and the
+/// doc comment says which and why — but it does force every shell entry to be
+/// one the main policy already recognises.
+#[test]
+fn the_shell_subset_never_invents_a_key_the_main_policy_does_not_have() {
+ for entry in SHELL_NEUTRALISED_CONFIG {
+ let known = NEUTRALISED_CONFIG.contains(entry)
+ // `hardened_git` adds this one as an argument rather than through
+ // the static list; it is still the same policy.
+ || *entry == "commit.gpgSign=false";
+ assert!(
+ known,
+ "`{entry}` is neutralised for the shell but is not part of the \
+ git_operations policy it is supposed to mirror"
+ );
+ }
+}
+
+/// The three deliberate exclusions must stay excluded, with their reasons.
+///
+/// Each would break ordinary work rather than harden it: an empty
+/// `core.sshCommand` is a command git tries to execute (the same trap the
+/// `diff.external` note records), and `core.hooksPath` belongs to the
+/// attribution shim. Re-adding any of them looks like tightening security and
+/// is actually an outage, so it should be a conscious edit here first.
+#[test]
+fn the_shell_subset_keeps_its_documented_exclusions() {
+ for excluded in ["core.sshCommand=", "diff.external=", "core.hooksPath="] {
+ assert!(
+ !SHELL_NEUTRALISED_CONFIG.contains(&excluded),
+ "`{excluded}` is excluded from the shell subset on purpose — see \
+ the doc comment before changing this"
+ );
+ }
+}