diff options
| author | Mohamed Hegazy <mhegazy@anthropic.com> | 2026-10-20 22:51:59 +0000 |
|---|---|---|
| committer | Claude <noreply@anthropic.com> | 2026-10-20 22:51:59 +0000 |
| commit | 3725318ee5052793cbbafd8b92edbdba771ce03a (patch) | |
| tree | 21fb825fec31e5dfa1fe5e161f181fd1e00b361f /plugins/security-guidance/hooks/diffstate.py | |
| parent | beecef224291d252a87f58c5e83df28d15fe3450 (diff) | |
security-guidance: keep a renamed file paired with its old name in the Stop review
The Stop review limits its diff to the changed paths. For a rename that git
already knows about (git mv, or a rename committed during the turn) that list
held only the new name, so the diff showed a new file and the parsers could
not apply the rule that leaves out a file renamed away from a secret-shaped
name. The old name now goes into the list beside the new one, as it already
did for a plain mv.
The file listings themselves are unchanged.
Diffstat (limited to 'plugins/security-guidance/hooks/diffstate.py')
| -rw-r--r-- | plugins/security-guidance/hooks/diffstate.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/plugins/security-guidance/hooks/diffstate.py b/plugins/security-guidance/hooks/diffstate.py index d3dd2a51..b0fae3cf 100644 --- a/plugins/security-guidance/hooks/diffstate.py +++ b/plugins/security-guidance/hooks/diffstate.py @@ -16,6 +16,7 @@ from gitutil import ( GIT_CMD, _git_dir, _git_toplevel, _git_status_porcelain, _git_rev_parse_head, _is_ancestor, _git_name_only, _temp_index, + _secret_rename_origins, ) from session_state import with_locked_state from extensibility import _same_dir @@ -833,6 +834,9 @@ def compute_v2_review_set(cwd, baseline_sha, head_at_capture, untracked_at_basel # dangling stash SHA was pruned). Either way, don't intersect with ∅ — # that would silently zero the review set. Fall back to dirty_now. review_set = (dirty_now & changed_since) if changed_since is not None else dirty_now + # Kept beside its new name so that the content diff pairs the two. + review_set = review_set | { + old for new, old in _secret_rename_origins.items() if new in review_set} review_paths = [os.path.join(repo, p) for p in sorted(review_set)] untracked_in_review = sorted(new_untracked & review_set) |
