Skip to content

Commit 4beca4c

Browse files
fix: better comments
1 parent a03b094 commit 4beca4c

File tree

6 files changed

+13
-9
lines changed

6 files changed

+13
-9
lines changed

policies/critical_vulnerabilities_count/critical_vulnerabilities_count.rego

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ violation[{}] if {
1010
alert.security_vulnerability.severity == "critical"
1111
]
1212

13-
# If there are 3 or more such alerts, then deny.
13+
# If there are 2 or more such alerts, then deny.
1414
count(open_alerts) >= 2
1515
}
1616

policies/low_vulnerabilities_dismissal/low_vulnerabilities_dismissal.rego

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ violation[{}] if {
66
working_day_now_ns := time_ext.reduce_day_ns(time.now_ns())
77
three_months_ago := working_day_now_ns - (84 * time_ext.one_day_ns)
88

9-
# Build a set of low alerts that have been open for more than 5 working days.
9+
# Check there exists a low alert that has been open for more than 5 working days.
1010
some alert in input.alerts
1111
alert.state == "open"
1212
alert.security_vulnerability.severity == "low"

policies/medium_vulnerabilities_count/medium_vulnerabilities_count.rego

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@ import future.keywords.in
44

55
violation[{}] if {
66
# Build a set of alerts that are open and with a medium severity.
7-
some alert in input.alerts
8-
alert.state == "open"
9-
alert.security_vulnerability.severity == "medium"
7+
open_alerts := [alert |
8+
some alert in input.alerts
9+
alert.state == "open"
10+
alert.security_vulnerability.severity == "medium"
11+
]
12+
13+
count(open_alerts) >= 5
1014
}
1115

1216
title := "Limit amount of medium vulnerabilities"

policies/vulnerabilities_dismissed_by_security_team/vulnerabilities_dismissed_by_security_team.rego

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ package vulnerabilities_dismissed_by_security_team
33
violation[{}] if {
44
input.security_team_members != null
55

6-
# Build a set of alerts that have been dismissed by someone not in the security team
76
some alert in input.alerts
87
in_security_team := [team_member |
98
some team_member in input.security_team_members
109
alert.dismissed_by.login == team_member.login
1110
]
11+
12+
# Ensure there is no team member that has dismissed an alert who is not part of the security team
1213
count(in_security_team) == 0
1314
}
1415

policies/vulnerability_dismissal_count/vulnerability_dimissal_count.rego

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
package vulnerability_dismissal_count
22

33
violation[{}] if {
4-
# Build a set of alerts that have been dismissed_alerts
4+
# Build a set of alerts that have been dismissed
55
dismissed_alerts := [alert |
66
some alert in input.alerts
77
alert.dismissed_at != null
88
]
99

10-
# If there are 10 or more dismissed alerts, deny
1110
count(dismissed_alerts) >= 10
1211
}
1312

policies/vulnerability_patch_available/vulnerability_patch_available.rego

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package vulnerability_patch_available
22

33
violation[{}] if {
4-
# Build a set of alerts that have been dismissed, but a patch is available
4+
# Check if there are any dismissed alerts that have patches available
55
some alert in input.alerts
66
alert.dismissed_at != null
77
alert.security_vulnerability.first_patched_version != null

0 commit comments

Comments
 (0)