Commit 2b295bb2 authored by Alex Kalderimis's avatar Alex Kalderimis

Merge branch '343280-add-feature-flag-for-reading-from-model' into 'master'

Put feature flag for reading from finding_evidence

See merge request gitlab-org/gitlab!79883
parents 42234def 7ae8d70c
---
name: read_from_vulnerability_finding_evidence
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/79883
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/352632
milestone: '14.8'
type: development
group: group::threat insights
default_enabled: false
......@@ -291,7 +291,7 @@ module Vulnerabilities
end
def evidence
evidence_data = finding_evidence.present? ? finding_evidence.data : metadata.dig('evidence')
evidence_data = finding_evidence.present? && Feature.enabled?(:read_from_vulnerability_finding_evidence) ? finding_evidence.data : metadata.dig('evidence')
{
summary: evidence_data&.dig('summary'),
......
......@@ -899,9 +899,31 @@ RSpec.describe Vulnerabilities::Finding do
context 'with finding_evidence' do
let(:finding_evidence) { build(:vulnerabilties_finding_evidence) }
let(:finding) { finding_evidence.finding }
let(:evidence) { finding_evidence.data }
include_examples 'evidence schema'
before do
finding_evidence.data[:summary] = "finding_evidence Summary"
finding_evidence.save!
end
context 'when the vulnerability_finding_replace_metadata feature flag is off' do
let(:evidence) { finding.metadata['evidence'] }
before do
stub_feature_flags(read_from_vulnerability_finding_evidence: false)
end
include_examples 'evidence schema'
end
context 'when the vulnerability_finding_replace_metadata feature flag is on' do
let(:evidence) { finding_evidence.data }
before do
stub_feature_flags(read_from_vulnerability_finding_evidence: true)
end
include_examples 'evidence schema'
end
end
end
......
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