summaryrefslogtreecommitdiff
path: root/plugins/security-guidance/hooks/security_reminder_hook.py
AgeCommit message (Collapse)Author
2026-11-19security-guidance: skip other repositories whose settings change what git runsmhegazy/sg-other-repo-settingsClaude
The hooks run git in the session's repository and in those the session moves to. A repository other than the session's own is now skipped when its own config has settings that change what git runs. An index copy made in another repository holds only the entries for files. Co-authored-by: mhegazy <mhegazy@anthropic.com>
2026-11-18Merge remote-tracking branch 'origin/main' into mhegazy/sg-commit-diff-memoryClaude
Co-authored-by: mhegazy <mhegazy@anthropic.com> # Conflicts: # plugins/security-guidance/hooks/security_reminder_hook.py
2026-11-17Merge pull request #7108 from anthropics/mhegazy/sg-lead-review-keysMohamed Hegazy
security-guidance: keep a review's result and time on full metric rows
2026-11-17Merge pull request #7105 from anthropics/mhegazy/sg-renamed-into-codeMohamed Hegazy
security-guidance: review text files renamed to code names
2026-11-17Merge pull request #7103 from anthropics/mhegazy/sg-chained-push-no-verdictMohamed Hegazy
security-guidance: review a commit-and-push again when the commit review gave no verdict
2026-11-16security-guidance: read commit and push diffs without holding themClaude
The commit and push reviews captured, decoded and split the whole `git show -p` / `git diff` before looking at the number of files. An import of 5,800 files and 4.6 M lines took 6.4 GB, and the review was then skipped for its file count. Read git's output as it arrives and keep what the review uses: the characters of each file the prompt takes, a count of the added lines after them, and past the file cut-off only the file names. Co-authored-by: mhegazy <mhegazy@anthropic.com>
2026-11-16security-guidance: keep severity counts on full metric rowsmhegazy/sg-lead-review-keysClaude
With findings, the critical and high counts could be cut from a full row. They now come with the result. commit_review_on and push_sweep_on, which are always true on a reviewed row, go last instead. Co-authored-by: mhegazy <mhegazy@anthropic.com>
2026-11-16security-guidance: wait for the original review on a message-only amend, and ↵mhegazy/sg-chained-push-no-verdictClaude
report a failure the push review did not A message-only amend made while the first review was running counted as reviewed at once. When that review then failed, a later push reviewed nothing. The amend now waits for that review. A failed commit review stayed quiet for the push review of its own command, which can itself end quietly (a cap, no network, killed). It now waits for the push review, and reports unless that one got a verdict or told of its own failure. Co-authored-by: mhegazy <mhegazy@anthropic.com>
2026-11-13security-guidance: review text files renamed to code namesClaude
git shows no content for a renamed file, so a text or document file renamed to a code name (notes.txt to payload.py) was never read by the commit and push reviews. They now read it whole, behind the files they already review and within a small share of the prompt. Other renames are reviewed as before. Part of #4852 Co-authored-by: mhegazy <mhegazy@anthropic.com>
2026-11-13security-guidance: match git commit and push continued on the next linemhegazy/sg-line-continuationClaude
`git \` with `commit` or `push` on the next line started the hook, but the command patterns only allowed whitespace between the words, so nothing was reviewed. They now also allow a line continued with a backslash (Bash) or a backtick (PowerShell). Co-authored-by: mhegazy <mhegazy@anthropic.com>
2026-11-13security-guidance: review a commit-and-push again when the commit review ↵Claude
gave no verdict When one command commits and pushes, the push review left the new commit to the commit review and ended at once. A commit review that then failed, was killed or skipped the commit left it pushed and unreviewed, and no later push covers it. The push review now waits for the commit review's process to end, and reviews the pushed range itself when there is no verdict. Both choose the commit through one helper, so they cannot pick differently. Co-authored-by: mhegazy <mhegazy@anthropic.com>
2026-11-13security-guidance: keep a review's result and time on full metric rowsClaude
Only the first 20 keys of a hook's metrics are kept. Commit reviews with findings, and failed reviews that used tokens, often have more, so their time and sometimes their result were lost. The result, kind and time of a review now come first. Co-authored-by: mhegazy <mhegazy@anthropic.com>
2026-11-11Merge pull request #7081 from anthropics/mhegazy/sg-one-model-settingMohamed Hegazy
security-guidance: take the review model from one place, default to the newest listed
2026-11-11Merge pull request #7076 from anthropics/mhegazy/sg-powershell-commit-hooksMohamed Hegazy
security-guidance: review commits and pushes made through the PowerShell tool
2026-11-11Merge pull request #7072 from anthropics/mhegazy/sg-chained-push-reviewMohamed Hegazy
security-guidance: review what a commit-and-push command sends out beyond its own commit
2026-11-11Merge pull request #7070 from anthropics/mhegazy/sg-custom-regex-time-limitMohamed Hegazy
security-guidance: stop custom rule regexes that run too long
2026-11-11Merge pull request #7055 from anthropics/mhegazy/sg-custom-rule-globsMohamed Hegazy
security-guidance: custom rule globs can be relative to the project
2026-11-11Merge pull request #7047 from anthropics/mhegazy/sg-push-merge-baseMohamed Hegazy
security-guidance: push review of a merge reviews what the push added
2026-11-11security-guidance: take the review model from one place, default to the ↵Claude
newest listed The commit reviewer asked its CLI for the opus alias, so an out-of-date CLI reviewed on an older model. It now uses the same lookup as the diff review, at medium effort, and keeps the alias when the endpoint can't list models. The retry model comes from the same lookup. Model names remain only for a direct API call when the endpoint can't list. Co-authored-by: mhegazy <mhegazy@anthropic.com>
2026-11-11Treat the PowerShell tool as Bash once, where the tool name is readmhegazy/sg-powershell-commit-hooksClaude
Co-authored-by: mhegazy <mhegazy@anthropic.com>
2026-11-10security-guidance: review what a commit-and-push command sends out beyond ↵mhegazy/sg-chained-push-reviewClaude
its own commit Co-authored-by: mhegazy <mhegazy@anthropic.com>
2026-11-10Read more PowerShell command shapesClaude
Co-authored-by: mhegazy <mhegazy@anthropic.com>
2026-11-10Review commits and pushes made through the PowerShell toolClaude
Co-authored-by: mhegazy <mhegazy@anthropic.com>
2026-11-10Stop custom rule regexes that run too longClaude
Co-authored-by: mhegazy <mhegazy@anthropic.com>
2026-11-10security-guidance: custom rule globs can be relative to the projectmhegazy/sg-custom-rule-globsClaude
Co-authored-by: mhegazy <mhegazy@anthropic.com>
2026-11-10security-guidance: pack the custom rule counts into one telemetry keymhegazy/sg-pack-custom-rule-countsClaude
Co-authored-by: mhegazy <mhegazy@anthropic.com>
2026-11-09Merge pull request #7032 from anthropics/mhegazy/sg-refused-verdict-countMohamed Hegazy
security-guidance: count reviewer verdicts the CLI refused
2026-11-09Merge pull request #7031 from anthropics/mhegazy/sg-credential-routingMohamed Hegazy
security-guidance: send a claude.ai token as a bearer, hold back a gateway's
2026-11-09Merge mainMohamed Hegazy
Co-authored-by: mhegazy <mhegazy@anthropic.com>
2026-11-09Merge pull request #7033 from anthropics/mhegazy/sg-unseen-commit-countMohamed Hegazy
security-guidance: count commits that no commit hook saw
2026-11-09Merge pull request #6838 from anthropics/mhegazy/sg-stop-finding-names-unwrittenMohamed Hegazy
security-guidance: say when a Stop finding is in a file the session has no record of editing
2026-11-09security-guidance: push review of a merge reviews what the push addedClaude
The reviewed prefix could end on the merged-in branch, so the diff held everything the first parent has that the branch lacks. Keep the base on HEAD's first-parent line. A merge whose history is all reviewed is sent as its combined diff, so only its conflict resolutions and hand edits are read. Co-authored-by: mhegazy <mhegazy@anthropic.com>
2026-11-07security-guidance: keep an incomplete edit record incomplete for the whole turnmhegazy/sg-stop-finding-names-unwrittenMohamed Hegazy
A record lost before one Stop was treated as whole by the next, and a prompt that was never stored as having no edits, so the note could name the session's own file. File names in the note are quoted as JSON. Co-authored-by: mhegazy <mhegazy@anthropic.com>
2026-11-07security-guidance: count reviewer verdicts the CLI refusedmhegazy/sg-refused-verdict-countMohamed Hegazy
Measure only, for #5746: one key on the commit and push review row when the reviewer's verdict was refused, and how many were wrapped in their own key. Co-authored-by: mhegazy <mhegazy@anthropic.com>
2026-11-07security-guidance: send a claude.ai token as a bearer, hold back a gateway'smhegazy/sg-credential-routingMohamed Hegazy
A claude.ai token that arrives as ANTHROPIC_API_KEY (from an apiKeyHelper) is refused by the API as a key; send it as a bearer. On hosts other than Claude Code, a bearer that is not a claude.ai token is not sent without a base URL. Other hosts' base URLs and cloud providers are left alone. Fixes #6955 Co-authored-by: mhegazy <mhegazy@anthropic.com>
2026-11-07security-guidance: count commits that no commit hook sawmhegazy/sg-unseen-commit-countMohamed Hegazy
A commit review starts from a hook on the Bash tool, so a commit made any other way starts none. The Stop row now carries turn_commits: how many commits the turn made, how many have no review, and how many of those no commit hook saw. Count only; what is reviewed does not change, and no hook entry is added. Co-authored-by: mhegazy <mhegazy@anthropic.com>
2026-11-07security-guidance: count how custom rules are writtenMohamed Hegazy
Measure only: path globs a wider reading would change, refused and counted repeats in regexes, and the slowest custom regex, on the Stop row. Which rules apply does not change. Co-authored-by: mhegazy <mhegazy@anthropic.com>
2026-11-06Merge remote-tracking branch 'origin/main' into ↵Claude
mhegazy/sg-stop-finding-names-unwritten # Conflicts: # plugins/security-guidance/hooks/security_reminder_hook.py
2026-11-05Merge main into mhegazy/sg-net-err-on-verdictmhegazy/sg-net-err-on-verdictClaude
Co-authored-by: mhegazy <mhegazy@anthropic.com>
2026-11-05Merge pull request #6965 from anthropics/mhegazy/sg-agentic-stop-on-authMohamed Hegazy
security-guidance: stop the commit reviewer on refused credentials, end hung reviews in time
2026-11-05Merge pull request #6998 from anthropics/mhegazy/sg-count-unmatched-bash-startsMohamed Hegazy
security-guidance: count Bash hook starts that match no commit or push
2026-11-05Merge pull request #6922 from anthropics/mhegazy/sg-prompt-snapshotMohamed Hegazy
security-guidance: take the turn baseline without git stash create
2026-11-05Merge pull request #6919 from anthropics/mhegazy/sg-add-failure-fixMohamed Hegazy
security-guidance: keep new files in the Stop review when git add -N fails
2026-11-05Merge pull request #6930 from anthropics/fix/sg-blank-base-urlMohamed Hegazy
security-guidance: treat a blank ANTHROPIC_BASE_URL as unset
2026-11-05Merge pull request #6918 from anthropics/mhegazy/sg-launcher-alias-real-pathMohamed Hegazy
security-guidance: stop starting the packaged Python alias on every hook
2026-11-04security-guidance: name new files the Stop review could not seeMohamed Hegazy
When git add -N fails on both tries or times out, wake Claude once per set of files with their names, so the review no longer ends as "no changes". A timed-out add now keeps the tracked files' diff, so a timeout on every turn cannot stop their reviews. Private object directory cleanup no longer chmods through a link. Fixes #6996 Co-authored-by: mhegazy <mhegazy@anthropic.com>
2026-11-04security-guidance: end a commit or push review's single-shot review at the ↵mhegazy/sg-agentic-stop-on-authMohamed Hegazy
hook's time limit A single-shot review that follows a fast agentic failure, or runs with the agentic review off, had no deadline: with no answer it ran 739 s, past Claude Code's 600 s kill, so the session heard nothing. It now ends at 570 s into the hook with the usual notice. The limit counts from hook start, so a push review's wait and the work before the review count. Failed push rows keep inflight_wait_s, and CLAUDE_CODE_REMOTE is read the same way in both places. Co-authored-by: mhegazy <mhegazy@anthropic.com>
2026-11-04security-guidance: keep the state folder to its usermhegazy/sg-state-dir-owner-onlyMohamed Hegazy
Create ~/.claude/security with mode 0700 from every place that makes it, and narrow the default folder on the next run, so a umask such as 002 does not leave the reviewer's venv group-writable. The in-place state write replaces a link instead of following it, and creates a 0600 file. Co-authored-by: mhegazy <mhegazy@anthropic.com>
2026-11-04security-guidance: count Bash hook starts that match no commit or pushClaude
Measurement only. One Bash call in ten that starts the hook without a commit or push reports bash_no_match, and precheck_skip when a plain text check on the hook input could have told so before Python started. precheck_miss marks a reviewed command that such a check would have dropped. Nothing is skipped and no review changes.
2026-11-04security-guidance: clear net_err when a review gets throughMohamed Hegazy
A failed first probe, a lost race fallback or a failed dual leg left its class (and api_error) on the row of a review that got a verdict.