| Age | Commit message (Collapse) | Author |
|
security-guidance: count reviewer verdicts the CLI refused
|
|
security-guidance: send a claude.ai token as a bearer, hold back a gateway's
|
|
Co-authored-by: mhegazy <mhegazy@anthropic.com>
|
|
security-guidance: count commits that no commit hook saw
|
|
security-guidance: say when a Stop finding is in a file the session has no record of editing
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
mhegazy/sg-stop-finding-names-unwritten
# Conflicts:
# plugins/security-guidance/hooks/security_reminder_hook.py
|
|
Co-authored-by: mhegazy <mhegazy@anthropic.com>
|
|
security-guidance: stop the commit reviewer on refused credentials, end hung reviews in time
|
|
security-guidance: count Bash hook starts that match no commit or push
|
|
security-guidance: take the turn baseline without git stash create
|
|
security-guidance: keep new files in the Stop review when git add -N fails
|
|
security-guidance: treat a blank ANTHROPIC_BASE_URL as unset
|
|
security-guidance: stop starting the packaged Python alias on every hook
|
|
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>
|
|
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>
|
|
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>
|
|
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.
|
|
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.
|
|
|
|
reviews in time
|
|
A set but empty value left the request URL as /v1/messages, so urllib raised and
every Stop, push and single-shot commit review failed. The SDK and Claude Code read a
blank value as the default endpoint; the plugin now does too.
|
|
stash create checks the work tree on one thread. add -u into the throwaway
index copy, write-tree and commit-tree produce the same commit and use git's
index preload instead, which matters where each file status is slow. See #6854.
|
|
Retry the add with a private object directory for users who cannot write the object store. Drop the pathspec settings git refuses alongside literal pathspecs, which hid new files since 2.0.16. When a failure stays and nothing is reviewed, keep the files for a later turn.
|
|
On Windows with the Python Install Manager, python, python3 and py are
packaged aliases under ...\Microsoft\WindowsApps, and each start of one
makes Windows run an App Installer update check for the package. The
launcher started the chosen alias twice per hook (probe, then the hook),
on every Edit, prompt and Stop. See anthropics/claude-code#98929.
When the name that answers is such an alias and its interpreter is a
regular python*.exe elsewhere, the launcher now checks that interpreter
once (same version, reads the hook script when started by itself), runs
the hook with it, and keeps its path in the state folder for a day.
Later hooks start it directly: one process, none through the alias.
The remembered path is used only while PATH and the hook folder are
unchanged and the file is still there. A hook that fails on it empties
the entry so the next hook searches again. Not used while VIRTUAL_ENV is
set. Other systems, regular installs and Microsoft Store Python are
unchanged.
Hooks report launcher_direct (1 remembered, 2 just checked) as the last
metric key on rows they already send.
|
|
|
|
security-guidance: count failed git add -N calls in the Stop review
|
|
security-guidance: report why a review call got no HTTP response
|
|
security-guidance: count reviews of a diff that was already reviewed
|
|
review took
review_ms says how long an agentic commit review took but not why. Add one
count-only key, rv_effort, on rows where the agentic reviewer ran: the turns
it took and the time it spent waiting on the model, summed over all stages
and packed as turns * 10,000,000 + model ms. It is emitted after every other
key, so it never displaces one at the metric key cap.
No behaviour change.
|
|
A failed add leaves new files out of the diff with no sign of it. Measure only; behaviour is unchanged.
|
|
Prompts that wait a second or more in the UserPromptSubmit hook send one
metrics row: total, baseline and untracked listing time, index size, and
whether the repository is on a Windows drive under WSL. Measures only;
capture is unchanged. See #6854.
|
|
Keeps both sides in emit_metrics: diff_seen stays after the other review
tail keys, and the launcher probe keys stay after everything else.
|
|
|
|
unreadable entry
Older Python releases load each Windows certificate store in one call, so
one certificate OpenSSL cannot parse makes the default TLS context fail to
build and every review call fails before a request is sent.
When that happens the plugin's API calls now use a default context built
from the store entries that do parse. Verification of the chain and the
host name is unchanged. Review rows carry tls_store_skipped (a count) when
this route is in use.
|
|
security-guidance: keep the Stop review working when the changed paths do not fit one command
|
|
security-guidance: report which pattern rules fired on every Stop row
|
|
A review call that never gets an HTTP response is reported as api_error -1
whatever the cause, so a certificate failure, a refused connection and a
timeout look the same. Rows whose last call failed that way now carry a
count-only net_err key: the failure class, the TLS verify code, and whether
CA files, a proxy or TLS variables are in play. No behaviour change.
|
|
record of editing
The Stop review takes its files from git, so it can report a finding in a
file another session or process changed in the same checkout, or in earlier
uncommitted work when no turn-start snapshot could be taken. The finding then
read as an instruction to fix code the session did not write.
A finding in a reviewed file with no record of the session's edit tools
writing it since the prompt now carries a note naming the file: the change may
have been made another way, leave it and tell the user if it is not yours,
handle it as usual if it is. What gets reviewed is unchanged.
The note is left out when the record is known to be incomplete (state file
lost or overwritten, or more edited paths than the list keeps). Stop rows with
findings carry finding_no_edit_record: the number of such findings, or -1 when
the record was incomplete.
Refs #4524
|
|
A change that comes back under a new commit (undo and re-commit, rebase
before the first push) is unknown to the reviewed-shas record, so the
commit or push review runs on it again. Nothing says how often.
Each commit and push review now notes a hash of every hunk it is sent in
.git/sg-reviewed-diffs, once when it starts and once when it has a
verdict, and reports one new metric, diff_seen:
0 some hunk was never reviewed in this clone
1 all were seen, but a review of one has no verdict (yet)
2 all had a finished review, on different repo contents
3 all had a finished review, on the same tree
-1 the record could not be read or written
Count only: no review is skipped, delayed or changed. The record is
bounded (1 MB, 7 days), is not written in portable output mode, and its
lock is never waited on for more than half a second.
|
|
The batched path commands now read each diff through the bounded reader
that main added, so both changes apply to get_git_diff.
|
|
Other tail metrics are now added after the two warning masks, so the
masks are no longer the last keys on the Stop row. What matters is that
the fired mask comes after the unresolved one, so a row cut at the key
cap loses the fired mask first. Test that, and say so in the comment.
|
|
|
|
|
|
|
|
security-guidance: count secret-named data files in the Stop review set
|