Commit 3d41663c authored by Max Woolf's avatar Max Woolf

Merge branch '332825-check-record-type-when-comparing-findings' into 'master'

fix: VulnerabilityFinding equality should exclude other record types

See merge request gitlab-org/gitlab!63554
parents 06bee52a 356e004a
......@@ -336,6 +336,7 @@ module Vulnerabilities
alias_method :==, :eql?
def eql?(other)
return false unless other.is_a?(self.class)
return false unless other.report_type == report_type && other.primary_identifier_fingerprint == primary_identifier_fingerprint
if ::Feature.enabled?(:vulnerability_finding_tracking_signatures, project) && project.licensed_feature_available?(:vulnerability_finding_signatures)
......
......@@ -1055,6 +1055,11 @@ RSpec.describe Vulnerabilities::Finding do
expect(finding1.eql?(finding2)).to be(vulnerability_finding_signatures_enabled)
end
it 'wont match other record types' do
historical_stat = build(:vulnerability_historical_statistic, project: project)
expect(finding1.eql?(historical_stat)).to be(false)
end
context 'short circuits on the highest priority signature match' do
using RSpec::Parameterized::TableSyntax
......
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