| Age | Commit message (Collapse) | Author |
|
security-guidance: reviews run when the Windows certificate store has an unreadable entry
|
|
security-guidance: keep nested repositories out of the index copy
|
|
fixture works with LibreSSL
|
|
|
|
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.
|
|
The test deleted a repository with shutil.rmtree, which fails on git's
read-only object files there. It moves the directory away instead.
|
|
security-guidance: find a rewritten file's earlier version from a repo subdirectory
|
|
|
|
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
|
|
security-guidance: report how long the launcher waits for interpreter probes
|
|
symlinked folder
When the tool's path and the session directory name the same repo through
different symlinks (/tmp and /var on macOS), the relative path between the two
spellings left the repo and the lookup found nothing, so a rewrite re-reported
code that was already in the file. The lookup now tries again with both paths
resolved. The first attempt is unchanged.
|
|
|
|
The fixture wrote its files with write_text, which stores "\n" as "\r\n" on
Windows, so the committed text no longer equalled the string the tests compare
against. The files are now written as bytes.
|
|
The expected budget is the platform figure where that is lower than half
of what the environment leaves.
|
|
security-guidance: skip an unusable security-patterns file on its own
|
|
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.
|
|
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: bump version to 2.0.15
|
|
|
|
security-guidance: count secret-named data files in the Stop review set
|
|
security-guidance: read the Stop review's git diff without holding it whole
|
|
security-guidance: report how Stop reviews relate to the session's own edits
|
|
Resolves the overlap with the bootstrap working-directory change and the gateway sign-in route: the import probe keeps the state-dir working directory, and llm.py keeps both imports.
|
|
Resolves the overlap with the baseline-origin change in security_reminder_hook.py: both sets of state keys are stored beside the baseline.
|
|
|
|
security-guidance: keep Claude Code's own credential files out of reviews
|
|
security-guidance: run SDK bootstrap subprocesses from the state dir
|
|
security-guidance: do not review against a baseline from another checkout
|
|
security-guidance: run reviews on machines with a managed MCP config
|
|
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.
|
|
The tests' stand-ins for claude were files with a #! line, which Windows
cannot start, so the gateway sign-in tests and the inner-CLI warning test
failed there. On Windows a stand-in is now an .exe built the way pip
builds a console script, and the gateway one writes its call log as
UTF-8. Two tests that move the home directory also set USERPROFILE, and
the one test that needs the Agent SDK without saying so is skipped
without it.
|
|
security-guidance: stay out of repositories nested in the work tree
|
|
Windows file names can hold a lone surrogate, so the path the test uses as
unreadable is an ordinary file in the repo there and the Stop row carries
review_scope. Elsewhere the path cannot be encoded and the key is left out,
as before.
|
|
security-guidance: find Python releases newer than the launcher's list
|
|
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.
|
|
# Conflicts:
# plugins/security-guidance/README.md
# plugins/security-guidance/hooks/security_reminder_hook.py
# plugins/security-guidance/tests/test_no_credentials_notice.py
|
|
security-guidance: run pattern checks on NotebookEdit cells
|
|
`python -c` and `python -m` put the working directory first on the import
path, and hooks run in the user's repository. A repository file named
claude_agent_sdk.py, venv.py or pip.py was imported in place of the real
module by the SessionStart check and the venv build. Run those
subprocesses from the plugin's state dir, and make state_dir() return an
absolute path as its docstring says, so a relative override isn't
resolved twice.
|
|
no answer
When `claude auth status` gives no usable answer, the Stop hook skipped
the review and dropped the turn's changes, so they were never reviewed
even once the check answered. They are now kept for the next Stop
review, as for other transient skips.
A gateway review that runs out of time is no longer tried again on
Sonnet: what makes it do so (a rejected sign-in, an unreachable gateway)
does not depend on the model, and the second attempt doubled the wait.
The timeout's log line now says which API statuses the CLI retried, and
includes the CLI's stderr.
The new tests no longer share one state file across sessions when run
inside a remote session.
|
|
In a Claude Code session signed in to a Claude apps gateway with /login,
Claude Code gives plugin hooks no credential, so the Stop, commit, push
and agentic commit reviews were all skipped.
When the plugin has no credential of its own, it now asks the user's
installed claude (`claude auth status --json`) whether the session is
signed in to a gateway. A yes or no is kept for the session; when the CLI
gives no usable answer, the next hook asks again. If apiProvider is
"gateway" and loggedIn is true, the reviews run through that same CLI,
which restores the stored sign-in by itself, so no credential enters the
plugin. A review the CLI cannot complete counts as a failed review, never
a clean one. The reviews run even with
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC set, as they do on Bedrock and
Vertex: the gateway docs suggest setting it, and the review goes through
the gateway like the session's own requests.
The CLI is found the way the agentic reviewer already finds it:
SG_AGENTIC_CLI_PATH, CLAUDE_CODE_EXECPATH, then fixed install paths, with
no PATH search, and it must be a full path. The reviews use Claude Code's
opus and sonnet aliases, which resolve to the ids Claude Code itself uses
on a gateway, and get the 120 s a direct review gets. Review rows set bit
4 of gateway_cfg, so this route's failure rate can be read apart from
first-party reviews.
Every Claude Code the plugin starts for a review, on any provider, now
runs with SECURITY_GUIDANCE_DISABLE=1. If policy settings enable the
plugin inside that CLI, its hooks there don't start reviews of their own.
The weekly notice that the reviews are not running is no longer shown in
a session signed in to a gateway, since the reviews do run there. The
edit that would show it asks claude first, and the notice marker is
written either way, so that edit waits for claude at most once a week.
Sessions the gateway route cannot review still get the notice, unless,
in the past week, an edit's check found a session signed in to a
gateway. Their skipped reviews still report no_creds.
|
|
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.
|
|
The turn baseline (stash SHA, HEAD, untracked snapshot) is kept per
session, and the Stop review used it in whatever checkout the turn ended
in. After the session entered another worktree, that worktree's older
commits looked like commits made this turn and its files were diffed
against the first checkout's, so code committed long before was reviewed
and reported again (anthropics/claude-code#102567).
The prompt hook now stores the repo root and the prompt time beside the
baseline. When the Stop review runs in a different checkout it leaves the
baseline out and uses what that checkout can say for itself: its own HEAD
when the turn began (from its reflog) for the commit range, HEAD for file
contents, and file times to leave out uncommitted files last written
before the turn. A baseline taken after a finding records the checkout it
was taken in.
A prompt in a folder that is not a repo no longer replaces the untracked
snapshot of the kept baseline with an empty one, which made every
untracked file in the repo look new at the next Stop.
Stop rows carry `bl_origin`: 0 same checkout, 1 another worktree, 2
another repository, 3 a folder that is gone, 4 no baseline; plus 10 or 20
when the baseline is an earlier turn's.
|
|
|
|
mhegazy/sg-gateway-login
|
|
Since 2.0.14 the plugin starts the reviewing Claude Code with
--strict-mcp-config. Claude Code exits at startup with that flag on a
machine whose administrator delivers the MCP servers (managed-mcp.json),
so the agentic commit review always fell back to the single-shot review,
and reviews that only run through Claude Code (Bedrock, Vertex) failed.
When the inner CLI refuses the flag, the plugin now starts it once more
without it, and leaves it out for the rest of the hook process. Those
starts deny every MCP tool (--disallowedTools "mcp__*") instead, so the
reviewer still gets only its read tools. Review rows from such a process
carry strict_mcp_off: 1.
|
|
Data files named like secrets.yml or client_secret.json are reviewed like any other file. The Stop hook now reports how many are in its review set, as a count only (secret_named_reviewed, emitted when nonzero), so the share of reviews that include one can be read from telemetry. No change to what is reviewed.
Refs anthropics/claude-code#96276
|