diff options
| author | Claude <noreply@anthropic.com> | 2026-10-20 23:00:54 +0000 |
|---|---|---|
| committer | Claude <noreply@anthropic.com> | 2026-10-20 23:00:54 +0000 |
| commit | a00d13d77ba7bf13a9d2ae0db5f7e24aeb4b12b2 (patch) | |
| tree | 5f9de8c90afbf0397b32bd18926e071f4486fda5 /plugins/code-modernization/scripts | |
| parent | beecef224291d252a87f58c5e83df28d15fe3450 (diff) | |
security-guidance: keep nested repositories out of the index copy
The hooks run `git stash create` (the turn baseline) and
`git add --intent-to-add` (untracked files) on a throwaway copy of the
index. A nested repository that the index records is a gitlink entry
there. `git stash create` takes no --ignore-submodules option and
`git add` reads the gitlinks its paths cover, so both started a second
git inside that directory.
Before anything runs on the copy, remove the gitlink entry of every
nested repository from the copy, never from the real index. If that
removal fails, do not use the copy at all: the baseline falls back to
HEAD and runs no stash create, and the diff reads the real index with
--ignore-submodules=all. A gitlink whose directory has no `.git` (a
submodule that is not checked out) stays; git starts nothing there.
Run the intent-to-add `git add` with literal pathspecs, in that one
call's environment only.
The index file is scanned for a gitlink's mode bytes first, so a
repository without one starts no extra git process.
Diffstat (limited to 'plugins/code-modernization/scripts')
0 files changed, 0 insertions, 0 deletions
