Commit e582ef4f authored by Tetiana Chupryna's avatar Tetiana Chupryna

Fix scanner comparison error

If one of the key arguments is nil, comparison breaks and fails
report parsing

Issue https://gitlab.com/gitlab-org/gitlab/-/issues/332719

Changelog: fixed
parent 0d066422
......@@ -39,7 +39,7 @@ module Gitlab
end
def <=>(other)
sort_keys <=> other.sort_keys
sort_keys.compact <=> other.sort_keys.compact
end
protected
......
......@@ -110,6 +110,7 @@ RSpec.describe Gitlab::Ci::Reports::Security::Scanner do
{ external_id: 'gemnasium-python', name: 'foo', vendor: 'bar' } | { external_id: 'bandit', name: 'foo', vendor: 'bar' } | 1
{ external_id: 'bandit', name: 'foo', vendor: 'bar' } | { external_id: 'semgrep', name: 'foo', vendor: 'bar' } | -1
{ external_id: 'semgrep', name: 'foo', vendor: 'bar' } | { external_id: 'unknown', name: 'foo', vendor: 'bar' } | -1
{ external_id: 'gemnasium', name: 'foo', vendor: 'bar' } | { external_id: 'gemnasium', name: 'foo', vendor: nil } | 1
end
with_them do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment