summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rwxr-xr-xplugins/security-guidance/hooks/security_reminder_hook.py7
-rw-r--r--plugins/security-guidance/tests/test_pattern_fired_metrics.py5
2 files changed, 7 insertions, 5 deletions
diff --git a/plugins/security-guidance/hooks/security_reminder_hook.py b/plugins/security-guidance/hooks/security_reminder_hook.py
index 93a545b4..e2f40a8b 100755
--- a/plugins/security-guidance/hooks/security_reminder_hook.py
+++ b/plugins/security-guidance/hooks/security_reminder_hook.py
@@ -2377,9 +2377,10 @@ def handle_stop_hook(input_data):
# The two masks also ride the tail, so the reviewed rows below, which
# leave `sweep` or its mask out, carry them when there is room under the
# key cap. Per rule they give how often it fired and how often the
- # flagged code was still there at Stop. warn_fired_mask goes last: a row
- # cut at the cap loses it first, and a row without it is left out of the
- # per-rule read instead of counting its rules as fixed.
+ # flagged code was still there at Stop. warn_fired_mask goes after
+ # warn_unresolved_mask: a row cut at the cap loses it first, and a row
+ # without it is left out of the per-rule read instead of counting its
+ # rules as fixed.
if warn_unresolved_mask:
_TAIL_METRICS["warn_unresolved_mask"] = warn_unresolved_mask
if warn_fired_mask:
diff --git a/plugins/security-guidance/tests/test_pattern_fired_metrics.py b/plugins/security-guidance/tests/test_pattern_fired_metrics.py
index 256cbf73..c1e31300 100644
--- a/plugins/security-guidance/tests/test_pattern_fired_metrics.py
+++ b/plugins/security-guidance/tests/test_pattern_fired_metrics.py
@@ -34,13 +34,14 @@ class TestFiredRulesReachTheStopRow:
assert m["warn_unresolved_mask"] == EVAL
assert list(m).index("warn_fired_mask") < 20
- def test_fired_mask_is_the_last_key(self, env, gateway, workspace):
+ def test_fired_mask_follows_the_unresolved_mask(self, env, gateway, workspace):
"""A row cut at the key cap loses the fired mask before the
unresolved one."""
_, repo = workspace
gateway.vulns = [STUB_VULN]
m = _turn(repo, env, {"calc.js": "const v = eval(src)\n"})
- assert list(m)[-2:] == ["warn_unresolved_mask", "warn_fired_mask"]
+ keys = list(m)
+ assert keys.index("warn_unresolved_mask") < keys.index("warn_fired_mask")
assert m["warn_fixed"] == 0 and m["warn_unresolved"] == 1
def test_review_with_findings(self, env, gateway, workspace):