<feed xmlns='http://www.w3.org/2005/Atom'>
<title>claude-plugins-official.git/plugins/security-guidance/hooks/gitutil.py, branch mhegazy/sg-stop-diff-memory</title>
<subtitle>Official Claude Code plugin directory
</subtitle>
<link rel='alternate' type='text/html' href='https://git.1991861.xyz/claude-plugins-official.git/'/>
<entry>
<title>Merge main into mhegazy/sg-stop-diff-memory</title>
<updated>2026-10-20T17:19:54+00:00</updated>
<author>
<name>Mohamed Hegazy</name>
<email>mhegazy@anthropic.com</email>
</author>
<published>2026-10-20T17:19:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.1991861.xyz/claude-plugins-official.git/commit/?id=0f6be178f21e3966272328322e6291b2f47c4727'/>
<id>0f6be178f21e3966272328322e6291b2f47c4727</id>
<content type='text'>
Conflict in get_git_diff: main added IGNORE_SUBMODULES to the diff command on the line where this branch resets its read counters. Both are kept.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Conflict in get_git_diff: main added IGNORE_SUBMODULES to the diff command on the line where this branch resets its read counters. Both are kept.
</pre>
</div>
</content>
</entry>
<entry>
<title>security-guidance: stay out of repositories nested in the work tree</title>
<updated>2026-10-19T17:36:13+00:00</updated>
<author>
<name>Claude</name>
<email>noreply@anthropic.com</email>
</author>
<published>2026-10-19T17:36:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.1991861.xyz/claude-plugins-official.git/commit/?id=7a151516fa58fd0160bacaf8fb5966931170bb9c'/>
<id>7a151516fa58fd0160bacaf8fb5966931170bb9c</id>
<content type='text'>
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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.
</pre>
</div>
</content>
</entry>
<entry>
<title>security-guidance: keep added lines past the cut, hold the diff timeout</title>
<updated>2026-10-19T16:57:46+00:00</updated>
<author>
<name>Mohamed Hegazy</name>
<email>mhegazy@anthropic.com</email>
</author>
<published>2026-10-19T16:57:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.1991861.xyz/claude-plugins-official.git/commit/?id=6d375ed2062b0c34e8a18885439cd992ad2d834a'/>
<id>6d375ed2062b0c34e8a18885439cd992ad2d834a</id>
<content type='text'>
A reviewable file past the per-file cap now keeps as much again of its added lines, so a rewritten large file still shows what is new, and its diff ends with a line saying it was cut. The read runs on a thread so the 30 s limit holds while a process git started keeps the pipe open; a read that breaks is an error instead of a short diff. SG_MAX_FILE_DIFF_BYTES of zero or less means the default. The parser and the reader share one test for which files are reviewed.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
A reviewable file past the per-file cap now keeps as much again of its added lines, so a rewritten large file still shows what is new, and its diff ends with a line saying it was cut. The read runs on a thread so the 30 s limit holds while a process git started keeps the pipe open; a read that breaks is an error instead of a short diff. SG_MAX_FILE_DIFF_BYTES of zero or less means the default. The parser and the reader share one test for which files are reviewed.
</pre>
</div>
</content>
</entry>
<entry>
<title>security-guidance: read the Stop review's git diff without holding it whole</title>
<updated>2026-10-19T16:25:48+00:00</updated>
<author>
<name>Mohamed Hegazy</name>
<email>mhegazy@anthropic.com</email>
</author>
<published>2026-10-19T16:25:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.1991861.xyz/claude-plugins-official.git/commit/?id=af95e28036dec718066ef0c3b684dccb4f23cd39'/>
<id>af95e28036dec718066ef0c3b684dccb4f23cd39</id>
<content type='text'>
The Stop review captured the whole diff of the turn before its per-file caps applied, so a turn that wrote large text files cost the hook several times their size in memory. The output is now read as it arrives: files the review drops keep only their header line, and one file's diff is cut at 4 MiB (SG_MAX_FILE_DIFF_BYTES). The git command is unchanged.

Adds count-only metrics, nonzero only: diff_mb, diff_cut_files, diff_timeout.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The Stop review captured the whole diff of the turn before its per-file caps applied, so a turn that wrote large text files cost the hook several times their size in memory. The output is now read as it arrives: files the review drops keep only their header line, and one file's diff is cut at 4 MiB (SG_MAX_FILE_DIFF_BYTES). The git command is unchanged.

Adds count-only metrics, nonzero only: diff_mb, diff_cut_files, diff_timeout.
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge remote-tracking branch 'origin/main' into mhegazy/sg-diff-prefix-config</title>
<updated>2026-10-15T22:20:59+00:00</updated>
<author>
<name>Mohamed Hegazy</name>
<email>mhegazy@anthropic.com</email>
</author>
<published>2026-10-15T22:19:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.1991861.xyz/claude-plugins-official.git/commit/?id=9e4906b18c07462941ff499d47576bf04c40534a'/>
<id>9e4906b18c07462941ff499d47576bf04c40534a</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>security-guidance: keep secret-shaped files out of reviews (#6537)</title>
<updated>2026-10-15T21:32:14+00:00</updated>
<author>
<name>Mohamed Hegazy</name>
<email>8000722+mhegazy@users.noreply.github.com</email>
</author>
<published>2026-10-15T21:32:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.1991861.xyz/claude-plugins-official.git/commit/?id=4c12e0797dafb29971a6f6e5db650e2cf4c5983c'/>
<id>4c12e0797dafb29971a6f6e5db650e2cf4c5983c</id>
<content type='text'>
* security-guidance: keep secret-shaped files out of reviews

The Stop review covers every dirty file in the work tree, including ones the user changed and Claude never opened. Key files, credential files and encrypted dotfile sources were sent along with the code.

Skip files that are secret stores by naming convention: .env variants, SSH private keys, common credential files, and chezmoi private/encrypted sources.

* security-guidance: report how many secret-shaped files were skipped

The Stop hook now reports secret_shaped_skipped (a count, never names, only when nonzero) so the skip can be confirmed after release and watched for over-matching.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* security-guidance: keep secret-shaped files out of reviews

The Stop review covers every dirty file in the work tree, including ones the user changed and Claude never opened. Key files, credential files and encrypted dotfile sources were sent along with the code.

Skip files that are secret stores by naming convention: .env variants, SSH private keys, common credential files, and chezmoi private/encrypted sources.

* security-guidance: report how many secret-shaped files were skipped

The Stop hook now reports secret_shaped_skipped (a count, never names, only when nonzero) so the skip can be confirmed after release and watched for over-matching.</pre>
</div>
</content>
</entry>
<entry>
<title>security-guidance: read diffs the same whatever the user's prefix settings</title>
<updated>2026-10-13T20:57:12+00:00</updated>
<author>
<name>Mohamed Hegazy</name>
<email>mhegazy@anthropic.com</email>
</author>
<published>2026-10-13T20:57:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.1991861.xyz/claude-plugins-official.git/commit/?id=eb638fbf680ae279a9e6699d2243344ccddc9624'/>
<id>eb638fbf680ae279a9e6699d2243344ccddc9624</id>
<content type='text'>
With diff.mnemonicPrefix or diff.noprefix set in the user's git config, diff headers no longer read `a/&lt;path&gt; b/&lt;path&gt;`, the parser matched no file, and the review was skipped with nothing shown. mnemonicPrefix switched off the Stop review; noprefix switched off the commit and push reviews as well.

Pass the default prefix settings on every git call the hook makes.

Fixes #4569
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
With diff.mnemonicPrefix or diff.noprefix set in the user's git config, diff headers no longer read `a/&lt;path&gt; b/&lt;path&gt;`, the parser matched no file, and the review was skipped with nothing shown. mnemonicPrefix switched off the Stop review; noprefix switched off the commit and push reviews as well.

Pass the default prefix settings on every git call the hook makes.

Fixes #4569
</pre>
</div>
</content>
</entry>
<entry>
<title>security-guidance: count diff headers the parser could not read</title>
<updated>2026-10-12T17:36:29+00:00</updated>
<author>
<name>Mohamed Hegazy</name>
<email>mhegazy@anthropic.com</email>
</author>
<published>2026-10-12T17:36:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.1991861.xyz/claude-plugins-official.git/commit/?id=ed2ae7cd72fb60b4b3e58d622745870072cfd2aa'/>
<id>ed2ae7cd72fb60b4b3e58d622745870072cfd2aa</id>
<content type='text'>
A file whose header cannot be parsed is left out of the review without a trace. The Stop hook now reports diff_hdr_unparsed (a count, only when nonzero) so a header shape the parser misses shows up in metrics.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
A file whose header cannot be parsed is left out of the review without a trace. The Stop hook now reports diff_hdr_unparsed (a count, only when nonzero) so a header shape the parser misses shows up in metrics.
</pre>
</div>
</content>
</entry>
<entry>
<title>security-guidance: parse diff sections by header line</title>
<updated>2026-10-12T17:19:01+00:00</updated>
<author>
<name>Mohamed Hegazy</name>
<email>mhegazy@anthropic.com</email>
</author>
<published>2026-10-12T17:18:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.1991861.xyz/claude-plugins-official.git/commit/?id=ccdb984025c4115b7d534a41a9fdad43a5283f74'/>
<id>ccdb984025c4115b7d534a41a9fdad43a5283f74</id>
<content type='text'>
The diff parser split on the text 'diff --git ' anywhere, so a file whose own content contains it was cut short, and the rest of that file was never reviewed. It also dropped files whose names git quotes (a double quote, backslash or control character in the name).

Split only where a line starts with the header, and decode quoted names.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The diff parser split on the text 'diff --git ' anywhere, so a file whose own content contains it was cut short, and the rest of that file was never reviewed. It also dropped files whose names git quotes (a double quote, backslash or control character in the name).

Split only where a line starts with the header, and decode quoted names.
</pre>
</div>
</content>
</entry>
<entry>
<title>security-guidance: remove stash indexes older releases left in the git directory</title>
<updated>2026-10-07T15:40:40+00:00</updated>
<author>
<name>Mohamed Hegazy</name>
<email>mhegazy@anthropic.com</email>
</author>
<published>2026-10-07T15:40:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.1991861.xyz/claude-plugins-official.git/commit/?id=f711194a9ecdf004b655dbc5006610fbb9e7c7bb'/>
<id>f711194a9ecdf004b655dbc5006610fbb9e7c7bb</id>
<content type='text'>
Releases before 2.0.10 ran `git stash create` on the real index. When that
git was killed, it left an `index.stash.&lt;pid&gt;` file the size of the index
in the git directory, and nothing removes those: a clone can hold hundreds.

Before it copies the index, the hook now deletes such files once they are
older than 30 minutes. It only touches regular files of the current user
whose name is exactly `index.stash.&lt;digits&gt;`, and never `index.lock`.

Co-Authored-By: Claude &lt;noreply@anthropic.com&gt;
Claude-Session: https://claude.ai/code/session_01QR7edfw5HHkxJvJVgZiWpM
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Releases before 2.0.10 ran `git stash create` on the real index. When that
git was killed, it left an `index.stash.&lt;pid&gt;` file the size of the index
in the git directory, and nothing removes those: a clone can hold hundreds.

Before it copies the index, the hook now deletes such files once they are
older than 30 minutes. It only touches regular files of the current user
whose name is exactly `index.stash.&lt;digits&gt;`, and never `index.lock`.

Co-Authored-By: Claude &lt;noreply@anthropic.com&gt;
Claude-Session: https://claude.ai/code/session_01QR7edfw5HHkxJvJVgZiWpM
</pre>
</div>
</content>
</entry>
</feed>
