git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[RFC/PATCH] Suggestion: Safe Hook Verification for Unzipped/Local Repositories

From
JPJamison Phillips <jamisoncphillips@gmail.com>
Date
Jun 13, 2026, 21:20 UTC
Message-ID
<CA+pATbgyg3Wqg7NnScPx3hUmo8nG23EFx2QUXuVAd3nJ6Z_CPw@mail.gmail.com>
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

Next: brian m. carlson
Message 1 of 2 in “Suggestion: Safe Hook Verification for Unzipped/Local Repositories”
  1. Suggestion: Safe Hook Verification for Unzipped/Local RepositoriesJamison Phillips, Jun 13, 2026
  2. brian m. carlsonJun 13, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.