Commit 0a84a07e authored by Jonathan Schafer's avatar Jonathan Schafer Committed by Heinrich Lee Yu

Remove vulnerability_finding_replace_metadata flag

Changelog: changed
EE: true
parent d7793c0e
---
name: vulnerability_finding_replace_metadata
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/66868
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/337253
milestone: '14.2'
group: group::threat insights
type: development
default_enabled: false
......@@ -225,7 +225,7 @@ module Vulnerabilities
end
def links
return metadata.fetch('links', []) if Feature.disabled?(:vulnerability_finding_replace_metadata) || finding_links.load.empty?
return metadata.fetch('links', []) if finding_links.load.empty?
finding_links.as_json(only: [:name, :url])
end
......
......@@ -9,12 +9,6 @@ module Security
self.model = Vulnerabilities::FindingLink
def execute
return unless Feature.enabled?(:vulnerability_finding_replace_metadata)
super
end
private
def attributes
......
......@@ -447,24 +447,8 @@ RSpec.describe Vulnerabilities::Finding do
context 'when there are finding links assigned to given finding' do
let_it_be(:finding_link) { create(:finding_link, name: 'finding_link', url: 'https://link.example.com', finding: finding) }
context 'when the feature flag is enabled' do
before do
stub_feature_flags(vulnerability_finding_replace_metadata: true)
end
it 'returns links from finding link' do
expect(links).to eq([{ 'url' => 'https://link.example.com', 'name' => 'finding_link' }])
end
end
context 'when the feature flag is disabled' do
before do
stub_feature_flags(vulnerability_finding_replace_metadata: false)
end
it 'returns links from raw_metadata' do
expect(links).to eq([{ 'url' => 'https://raw.example.com', 'name' => 'raw_metadata_link' }])
end
it 'returns links from finding link' do
expect(links).to match_array([{ 'url' => 'https://link.example.com', 'name' => 'finding_link' }])
end
end
end
......@@ -898,7 +882,7 @@ RSpec.describe Vulnerabilities::Finding do
finding_evidence.save!
end
context 'when the vulnerability_finding_replace_metadata feature flag is off' do
context 'when the read_from_vulnerability_finding_evidence feature flag is off' do
let(:evidence) { finding.metadata['evidence'] }
before do
......@@ -908,7 +892,7 @@ RSpec.describe Vulnerabilities::Finding do
include_examples 'evidence schema'
end
context 'when the vulnerability_finding_replace_metadata feature flag is on' do
context 'when the read_from_vulnerability_finding_evidence feature flag is on' do
let(:evidence) { finding_evidence.data }
before do
......
......@@ -20,26 +20,9 @@ RSpec.describe Security::Ingestion::Tasks::IngestFindingLinks do
create(:finding_link, finding: finding_2, url: finding_link.url)
end
context 'when the replace raw metadata flag is on' do
before do
stub_feature_flags(vulnerability_finding_replace_metadata: true)
end
it 'creates finding links for the new records' do
expect { ingest_finding_links }.to change { Vulnerabilities::FindingLink.count }.by(1)
.and change { finding_1.finding_links.count }.by(1)
end
end
context 'when the replace raw metadata flag is off' do
before do
stub_feature_flags(vulnerability_finding_replace_metadata: false)
end
it 'does not create finding links for the new records' do
expect { ingest_finding_links }.to change { Vulnerabilities::FindingLink.count }.by(0)
.and change { finding_1.finding_links.count }.by(0)
end
it 'creates finding links for the new records' do
expect { ingest_finding_links }.to change { Vulnerabilities::FindingLink.count }.by(1)
.and change { finding_1.finding_links.count }.by(1)
end
it_behaves_like 'bulk insertable task'
......
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