summaryrefslogtreecommitdiff
path: root/lib/gitlab/ci/reports
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/ci/reports')
-rw-r--r--lib/gitlab/ci/reports/security/finding.rb6
-rw-r--r--lib/gitlab/ci/reports/security/reports.rb8
2 files changed, 6 insertions, 8 deletions
diff --git a/lib/gitlab/ci/reports/security/finding.rb b/lib/gitlab/ci/reports/security/finding.rb
index 2fc466e356d..a0d9318859d 100644
--- a/lib/gitlab/ci/reports/security/finding.rb
+++ b/lib/gitlab/ci/reports/security/finding.rb
@@ -7,8 +7,6 @@ module Gitlab
class Finding
include ::VulnerabilityFindingHelpers
- UNSAFE_SEVERITIES = %w[unknown high critical].freeze
-
attr_reader :compare_key
attr_reader :confidence
attr_reader :identifiers
@@ -86,8 +84,8 @@ module Gitlab
@location = new_location
end
- def unsafe?
- severity.in?(UNSAFE_SEVERITIES)
+ def unsafe?(severity_levels)
+ severity.in?(severity_levels)
end
def eql?(other)
diff --git a/lib/gitlab/ci/reports/security/reports.rb b/lib/gitlab/ci/reports/security/reports.rb
index a7a6e5b2593..b7a5e36b108 100644
--- a/lib/gitlab/ci/reports/security/reports.rb
+++ b/lib/gitlab/ci/reports/security/reports.rb
@@ -22,8 +22,8 @@ module Gitlab
reports.values.flat_map(&:findings)
end
- def violates_default_policy_against?(target_reports, vulnerabilities_allowed)
- unsafe_findings_count(target_reports) > vulnerabilities_allowed
+ def violates_default_policy_against?(target_reports, vulnerabilities_allowed, severity_levels)
+ unsafe_findings_count(target_reports, severity_levels) > vulnerabilities_allowed
end
private
@@ -32,8 +32,8 @@ module Gitlab
findings - target_reports&.findings.to_a
end
- def unsafe_findings_count(target_reports)
- findings_diff(target_reports).count(&:unsafe?)
+ def unsafe_findings_count(target_reports, severity_levels)
+ findings_diff(target_reports).count {|finding| finding.unsafe?(severity_levels)}
end
end
end