{"version":"2.1.275","anchor":"git-related-environment-variables-and-cli-flags-now-get-patt","canonical_anchor":"git-related-environment-variables-and-cli-flags-now-get-patt","heading":"Git-related environment variables and CLI flags now get pattern-matched for hardening","tier":"notice","area":"Permissions","scope":null,"heads_up":null,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.275\/e\/git-related-environment-variables-and-cli-flags-now-get-patt","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.275","markdown":"### Git-related environment variables and CLI flags now get pattern-matched for hardening\n\nClaude Code now scans environment variables and git flags for tricks that redirect where git actually operates\n\n**What**\n\nClaude Code now checks environment variables and command-line flags for signs that something is trying to secretly redirect git operations or hijack the shell. This includes:\n\n- Git environment variables like `GIT_DIR` and `GIT_WORK_TREE`, which can point git at a different repository or working folder than expected\n\n- Shell variables like `CDPATH`, `PATH`, and `IFS` that can be abused to change how commands behave\n\n- Git flags such as `--git-dir`, `--separate-git-dir`, `--namespace`, `core.worktree`, and `includeif.` that redirect where git reads its config or working tree, including shortened (abbreviated) forms of `--separate-git-dir` and `--working-directory`\n\nThis builds on earlier work (cloud file sync opening files through directory handles so a swapped symlink can't redirect a write) by extending the same kind of suspicion to git-specific environment variables and flags rather than just `GIT_DIR` and `GIT_WORK_TREE`.\n\n**Why**\n\nThese variables and flags are legitimate git features, but an attacker who controls a repository or its config could use them to make git read or write files outside the folder you think you're working in. Catching them closes off a way that a malicious repo could quietly redirect Claude Code's git commands.\n\n- Area: Permissions\n- Tier: You'll notice\n- Useful: 2\/5\n- Signal: 2\/5"}