fix: close three ways past the hidden-repository protection in the Bash guard #466
All Vouch review confidence checks passed
Residual risk 0.27 = Change Risk (0.50) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.50 · 435 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 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.364
Shallow Review Depth
shallow_review_depth
0.344
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #466"
general
weight: 0.35
Danathar
Summary: This project's safety filter checks the shell commands an AI coding assistant runs. Last week's fixes stopped git from loading a hidden git folder a branch could plant, because that folder can name a program for git to run. Three ordinary ways around that protection still worked, and one git option could print the first line of the secrets file. This closes them.
---
What
The guard is
.claude/hooks/guard-bash.py. With git 2.47.3, each of these ran a planteddiff..textconvprogram while the guard said nothing:git --shallow-file x --git-dir=evil log -pandgit --attr-source HEAD -c safe.bareRepository=all log -p. Both options take the next word as their value. The walk added in #463 read that value as the subcommand and stopped before--git-diror-c safe..--attr-sourceis now in_GIT_GLOBAL_VALUE_NEXT.--shallow-fileis refused outright, becausegit --shallow-file .env log -1also prints.env's first line in its error, past theRead(./.env)deny rule.unset GIT_CONFIG_COUNT; git log -pandGIT_CONFIG_COUNT=0; git log -p..claude/settings.jsonexports that name, so bash passes the change to git.HOME=planted; git log -pmade git readplanted/.gitconfig. The guard refusedHOME=planted git log -pbut not the standalone form.The guard assumed a standalone
NAME=valueonly sets a shell variable no child process sees. That is false for a name already exported. The fix reads a standalone assignment to a name outsideSAFE_ENV, or anunsetof aGIT_CONFIG_name, the way it already readsNAME=valuein front of the verb, for any guarded command later in the same string.unset FOOstill passes: it takes away nothing the guard relies on.Blast radius.
X=1; git diff HEADis now refused where it passed before. Three "passes by design" rows usedX=1to show thatset -o pipefailis notset -a; they now useTZ=UTC, which keeps that meaning. Under AGENTS.md this is widening, not overturning a decision. Names on the safe list, and an assignment written after the git command, still pass.Out of scope. The shared refusal list copy (
tests/fixtures/gate-refusal-corpus.json) is not updated. With this fix the current shared copy passes here except for three rows: it expects this guard to allowenv -u FOO git log -1,env -S -u FOO git log -1andexec -a name git log -1. This guard refuses every wrapper in front of git by design. Allowing them loosens the guard, which needs the owner, so that is left for a separate decision.Validation.
tests/test_agent_permissions.pyfail onmainand pass here: refusal rows for each spelling, plus three mutation rows proving each new rule is what refuses its witness.ruff checkandruff format --checkreport the same findings onmain, so nothing new.Closes #465
Decision taken by hive: per AGENTS.md "Owner's standing decisions" (Adding or widening a check; Repeating an earlier decision: atomic-image-builder#890 and #892, akmods#314, tududi#634, sensi#705).
Checks
pytest -qpasses locallynpx -y @anthropic-ai/mcpb@2.1.2 validate ./manifest.jsonpasses (ifmanifest.jsonchanged): not changedpyproject.toml/manifest.jsonleft unchanged---
Filed by sec-check agent (ACMM L6 — full mode)*