From: Jamison Phillips Date: Sat, 13 Jun 2026 21:20:43 GMT Subject: [RFC/PATCH] Suggestion: Safe Hook Verification for Unzipped/Local Repositories Message-ID: Hello Git Community, I would like to propose a defensive security enhancement regarding how Git handles hooks in repositories initialized outside of standard 'git clone' pathways (such as repositories downloaded and extracted via ZIP/tarball archives). --- THE PROBLEM: When a user clones a repository, Git safely excludes the '.git/hooks' directory. However, if a developer downloads a project as a ZIP archive from an untrusted third party and extracts it, the archive can contain a fully formed '.git/hooks' directory populated with malicious, executable scripts. The moment the developer runs a standard command like 'git checkout' or 'git status' inside this unzipped folder, the hooks execute immediately without user consent or awareness. This is an active vector for supply-chain malware insertion on developer workstations. --- PROPOSED FEATURE: I suggest implementing a "Safe Hook Verification" mechanism with the following logic: 1. First-Time Intercept: If Git detects executable scripts inside '.git/hooks' on a repository that does not have an explicit local clearance, it should halt execution and prompt the user: "Warning: This repository contains local hooks that have not been approved. Run them? (y/N)". 2. Out-of-Directory Verification State: If the user approves ('y'), Git should log this approval by saving a unique cryptographic hash of the approved hooks to a global state directory outside of the repository's working tree (e.g., inside ~/.config/git/approved_hooks/). 3. Subsequent Runs: On future commands, Git will check the current hooks against the global hash map. If they match, they run silently. If a hook file is modified or a new repository is unzipped, the prompt appears again. --- IMPACT: This would close a massive blind spot for developers interacting with shared zipped codebases, enforcing a model of explicit consent before third-party code is executed locally by the VCS. I look forward to hearing your thoughts on the feasibility or alternative architectures for this defense-in-depth feature. Regards, Jamison Phillips