summaryrefslogtreecommitdiff
path: root/plugins/security-guidance/hooks/diffstate.py
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/security-guidance/hooks/diffstate.py')
-rw-r--r--plugins/security-guidance/hooks/diffstate.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/plugins/security-guidance/hooks/diffstate.py b/plugins/security-guidance/hooks/diffstate.py
index de9719cf..34655335 100644
--- a/plugins/security-guidance/hooks/diffstate.py
+++ b/plugins/security-guidance/hooks/diffstate.py
@@ -18,7 +18,7 @@ from gitutil import (
GIT_CMD,
_git_dir, _git_toplevel, _git_status_porcelain,
_git_rev_parse_head, _is_ancestor, _git_name_only, _temp_index,
- index_entry_count,
+ _secret_rename_origins, index_entry_count,
)
from session_state import with_locked_state
from extensibility import _same_dir
@@ -1165,6 +1165,10 @@ def compute_v2_review_set(cwd, baseline_sha, head_at_capture, untracked_at_basel
# dangling baseline 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.
+ secret_origins = {
+ old for new, old in _secret_rename_origins.items() if new in review_set}
+ review_set = review_set | secret_origins
review_paths = [os.path.join(repo, p) for p in sorted(review_set)]
untracked_in_review = sorted(new_untracked & review_set)
@@ -1176,4 +1180,6 @@ def compute_v2_review_set(cwd, baseline_sha, head_at_capture, untracked_at_basel
# Only emit when nonzero to stay under the 10-key telemetry cap.
if preexisting_unchanged:
metrics["preexisting_untracked_excluded"] = len(preexisting_unchanged)
+ if secret_origins:
+ metrics["secret_renamed"] = len(secret_origins)
return review_paths, diff_base, repo, untracked_in_review, metrics