You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Zero-trust layer on the git wrapper. LLM-driven shell calls inherit the parent env verbatim today, so anything that can set env vars (compromised dotfile, dirty CI runner, hostile postinstall) can steer subsequent contextcrawler git calls. We're not defending against active exploits — we're closing the inheritance gap so the agent can't be wagged by config it didn't author.
Config-injection (the GIT_CONFIG_COUNT/_KEY_N/_VALUE_N family lets attacker set any config key including diff.external, core.fsmonitor, core.sshCommand, core.editor, core.gitProxy): GIT_CONFIG, GIT_CONFIG_GLOBAL, GIT_CONFIG_SYSTEM, GIT_CONFIG_COUNT, GIT_CONFIG_KEY_*, GIT_CONFIG_VALUE_*, GIT_TEMPLATE_DIR, GIT_EXEC_PATH, GIT_HOOKS_PATH
Args to reject in check_forbidden_git_args()
-c key=val where key matches a denylist (diff.external, core.editor, core.pager, core.sshCommand, core.fsmonitor, core.gitProxy, core.hooksPath, core.gitProxy, safe.directory=*, protocol.*.allow, uploadpack.packObjectsHook). Allowlist by prefix is fine too.
--upload-pack=<cmd>, --receive-pack=<cmd> (HIGH)
--exec-path=<dir>
--git-dir=<...>, --work-tree=<...> (or restrict to project root)
Escape hatch
contextcrawler proxy git ... runs unwrapped for legitimate edge cases.
Tests (negative regression)
tests/security/git_hardening.rs:
Each stripped env var: invoke with the var set to a script that drops a marker file; assert marker NOT created.
Each rejected -c key: assert exit non-zero with the deny error.
Positive: git status, git log -3 --oneline still work.
Wire-in sites
src/cmds/git/git.rs (already uses resolved_command("git")) → switch to secure_git_command()
src/main.rs::Commands::Git { config_override } — drop config_override forwarding entirely OR validate against allowlist before forwarding
Any gh/glab/gt subcommands that internally shell to git — secondary
Activity
Merge pull request #42 from thehoff/harden/git
harden(git): secure_git_command + check_forbidden_git_args (thehoff#35)
fix(git): enforce transport-flag denylist on all subcommand + passthr…