Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
0a84a07e
Commit
0a84a07e
authored
Mar 10, 2022
by
Jonathan Schafer
Committed by
Heinrich Lee Yu
Mar 10, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove vulnerability_finding_replace_metadata flag
Changelog: changed EE: true
parent
d7793c0e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
55 deletions
+8
-55
config/feature_flags/development/vulnerability_finding_replace_metadata.yml
...gs/development/vulnerability_finding_replace_metadata.yml
+0
-8
ee/app/models/vulnerabilities/finding.rb
ee/app/models/vulnerabilities/finding.rb
+1
-1
ee/app/services/security/ingestion/tasks/ingest_finding_links.rb
...services/security/ingestion/tasks/ingest_finding_links.rb
+0
-6
ee/spec/models/vulnerabilities/finding_spec.rb
ee/spec/models/vulnerabilities/finding_spec.rb
+4
-20
ee/spec/services/security/ingestion/tasks/ingest_finding_links_spec.rb
...ces/security/ingestion/tasks/ingest_finding_links_spec.rb
+3
-20
No files found.
config/feature_flags/development/vulnerability_finding_replace_metadata.yml
deleted
100644 → 0
View file @
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
ee/app/models/vulnerabilities/finding.rb
View file @
0a84a07e
...
...
@@ -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
...
...
ee/app/services/security/ingestion/tasks/ingest_finding_links.rb
View file @
0a84a07e
...
...
@@ -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
...
...
ee/spec/models/vulnerabilities/finding_spec.rb
View file @
0a84a07e
...
...
@@ -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
...
...
ee/spec/services/security/ingestion/tasks/ingest_finding_links_spec.rb
View file @
0a84a07e
...
...
@@ -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'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment