summaryrefslogtreecommitdiff
path: root/plugins/security-guidance/tests
AgeCommit message (Collapse)Author
2026-10-07security-guidance: remove stash indexes older releases left in the git directorymhegazy/sg-reclaim-after-hook-killMohamed Hegazy
Releases before 2.0.10 ran `git stash create` on the real index. When that git was killed, it left an `index.stash.<pid>` 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.<digits>`, and never `index.lock`. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QR7edfw5HHkxJvJVgZiWpM
2026-10-07security-guidance: stop a killed hook from leaving index copies behind ↵Mohamed Hegazy
(2.0.10 → 2.0.11) In a clone with a very large git index, 2.0.10 could still fill the disk. It copies the index for each git call that might write it, and a hook that Claude Code cancels (SIGTERM, then SIGKILL) never reached its cleanup, so every cancelled hook left index-sized files in the temp directory for up to 30 minutes. With several agents in one clone the live copies alone could take many GB. - A hook told to terminate removes its copies before it exits. - A copy's name records the hook's pid; the next run deletes copies whose hook is gone instead of waiting for the age limit. - Diffs no longer need a copy: diff.autoRefreshIndex is off, so they only read the index. Only `git stash create` and `git add -N` get one. - The copy is a hard link where the filesystem allows it. - Only so many hooks hold a copy at once, fewer as the disk fills. A hook that gets no slot within 5 s goes without: the baseline falls back to HEAD, or new untracked files are left out of that review. Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-05security-guidance: leave nothing behind when git is killed (2.0.9 → 2.0.10)mhegazy/sg-temp-index-cleanupMohamed Hegazy
With a very large git index the hook's git calls hit their time limits and are killed, so git cannot clean up. Each kill could leave an index-sized file in the temp directory, index.stash.<pid> files in .git, and a dead .git/index.lock that fails the user's next git add or commit. - `git stash create` and the work-tree diff run on a throwaway index copy. - Every git the hook spawns gets GIT_OPTIONAL_LOCKS=0. - Copies live in a private per-user folder and are removed together with the files git writes next to them. - Leftovers older than 30 minutes are swept, including existing ones. Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-02security-guidance: follow the newest Opus instead of a pinned release (2.0.8 ↵mhegazy/sg-track-latest-opusMohamed Hegazy
→ 2.0.9) The review model was hardcoded to claude-opus-4-7, so the plugin fell behind each time a new Opus shipped. - The diff review asks the configured endpoint (GET /v1/models) for the newest Opus it serves, cached for a day; claude-opus-5-5 if it can't say. - The agentic commit review, and every review on Bedrock, Vertex and Foundry, use Claude Code's `opus` alias. - SECURITY_REVIEW_MODEL and SG_AGENTIC_MODEL still pin a model. - Adds pricing rows for the newer Opus models, and tests. Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-09-09Harden git invocation and repository hint handlingsg-resolve-repo-rootOctavian Guzu
:house: Remote-Dev: homespace
2026-09-09Adjust SubagentStop handling and repository precedenceOctavian Guzu
- SubagentStop reviews without consuming or advancing the session's Stop state; an identical diff is not reviewed twice. - SubagentStop from a different working tree than the project is skipped. - An explicit `git -C <dir>` / `cd <dir>` naming another repository takes precedence over the hook cwd. - Narrows the `git -C … commit` matcher; keeps Windows path separators when tokenizing; adds `--no-textconv` to diff/show invocations. - Adds tests. :house: Remote-Dev: homespace
2026-09-09security-guidance: resolve repository from command and edited paths (2.0.7 ↵Octavian Guzu
→ 2.0.8) - Adds repository resolution from `git -C <dir>` / `cd <dir>` in the hook command, from the commit SHA, and from edited file paths when the hook cwd is not a git repository. - Adds PostToolUse matchers for `git -C … commit|push`. - Registers SubagentStop. - Adds `repo_resolution` / `cwd_is_repo` metric fields. - Adds tests. :house: Remote-Dev: homespace