summaryrefslogtreecommitdiff
path: root/plugins/security-guidance/tests/test_nested_repos.py
AgeCommit message (Collapse)Author
2026-11-05Merge main into mhegazy/sg-index-copy-all-gitlinksmhegazy/sg-index-copy-all-gitlinksClaude
Co-authored-by: mhegazy <mhegazy@anthropic.com>
2026-11-04security-guidance: drop every gitlink from the index copyMohamed Hegazy
Whether git starts something in a gitlink's directory is decided when git runs, so the check for a .git there beforehand can go stale. Remove all of them from the copy. On git older than 2.34 the baseline for a submodule that is not checked out falls back to HEAD. Co-authored-by: mhegazy <mhegazy@anthropic.com>
2026-11-04security-guidance: read git log output without signature checksmhegazy/sg-git-log-signature-offMohamed Hegazy
With log.showSignature set, git log and git show verify every signed commit, which adds lines to the output the hooks parse and starts gpg.program. Set it off for the hooks' git and for the commit reviewer's environment. Co-authored-by: mhegazy <mhegazy@anthropic.com>
2026-10-21security-guidance: make one nested repository test work on Windowsmhegazy/sg-index-copy-gitlinksClaude
The test deleted a repository with shutil.rmtree, which fails on git's read-only object files there. It moves the directory away instead.
2026-10-20security-guidance: keep nested repositories out of the index copyClaude
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.
2026-10-19security-guidance: stay out of repositories nested in the work treemhegazy/sg-nested-reposClaude
A directory with its own .git inside the work tree (a submodule, a vendored checkout, an unpacked archive) was added to the throwaway index as a submodule entry, and git then started a second git inside it to see whether it had changed. Nothing in such a directory is reviewed. git status and work-tree git diff now ignore submodule entries, an untracked nested repository is no longer listed as a changed file or added to the index copy, and a commit that moves a submodule is always shown as its two commit ids.