diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-10 03:10:29 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-10 03:10:29 +0300 |
commit | 981771279a48c03263e29f3b4f41f54204ea3146 (patch) | |
tree | 5e48e8debb84850147d183b094ffcd9d8b084c48 /lib/gitlab/ci/reports | |
parent | a8648ba08604085c76be1e4f5253ffa89aa192e3 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/ci/reports')
-rw-r--r-- | lib/gitlab/ci/reports/security/finding.rb | 6 | ||||
-rw-r--r-- | lib/gitlab/ci/reports/security/reports.rb | 8 |
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 |