Adds whitelist for GIT_* env vars containing only GIT_SSH

This commit is contained in:
Rory Prendergast 2018-01-02 10:51:13 -08:00
parent 9b6fb149f9
commit e3cf0975f9

View file

@ -76,8 +76,11 @@ def no_git_env():
# while running pre-commit hooks in submodules. # while running pre-commit hooks in submodules.
# GIT_DIR: Causes git clone to clone wrong thing # GIT_DIR: Causes git clone to clone wrong thing
# GIT_INDEX_FILE: Causes 'error invalid object ...' during commit # GIT_INDEX_FILE: Causes 'error invalid object ...' during commit
# list of explicitly whitelisted variables
allowed_git_envs = ['GIT_SSH']
return { return {
k: v for k, v in os.environ.items() if not k.startswith('GIT_') k: v for k, v in os.environ.items() if not k.startswith('GIT_') or k in allowed_git_envs
} }