Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-02-01 03:14:06 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-02-01 03:14:06 +0300
commitcc2623bcc3040a8b9c9a302e3f660c0ca65a7699 (patch)
tree9c7dad386960a919fbe9b954854f34a41ee4242d /lib/gitlab/ci/reports
parentf2ed38a6b50ee59ce280a3e7d5125b3a35c5f17e (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.rb21
1 files changed, 15 insertions, 6 deletions
diff --git a/lib/gitlab/ci/reports/security/finding.rb b/lib/gitlab/ci/reports/security/finding.rb
index fe1dc2dacd7..990250735ba 100644
--- a/lib/gitlab/ci/reports/security/finding.rb
+++ b/lib/gitlab/ci/reports/security/finding.rb
@@ -122,8 +122,10 @@ module Gitlab
end
def keys
- @keys ||= identifiers.reject(&:type_identifier?).map do |identifier|
- FindingKey.new(location_fingerprint: location&.fingerprint, identifier_fingerprint: identifier.fingerprint)
+ @keys ||= identifiers.reject(&:type_identifier?).flat_map do |identifier|
+ location_fingerprints.map do |location_fingerprint|
+ FindingKey.new(location_fingerprint: location_fingerprint, identifier_fingerprint: identifier.fingerprint)
+ end
end
end
@@ -171,8 +173,10 @@ module Gitlab
original_data['location']
end
+ # Returns either the max priority signature hex
+ # or the location fingerprint
def location_fingerprint
- max_priority_signature_hex || location&.fingerprint
+ location_fingerprints.first
end
private
@@ -181,10 +185,15 @@ module Gitlab
Digest::SHA1.hexdigest(compare_key)
end
- def max_priority_signature_hex
- return unless @vulnerability_finding_signatures_enabled && signatures.present?
+ def location_fingerprints
+ @location_fingerprints ||= signature_hexes << location&.fingerprint
+ end
+
+ # Returns the signature hexes in reverse priority order
+ def signature_hexes
+ return [] unless @vulnerability_finding_signatures_enabled && signatures.present?
- signatures.max_by(&:priority).signature_hex
+ signatures.sort_by(&:priority).map(&:signature_hex).reverse
end
end
end