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
330a1180
Commit
330a1180
authored
Jan 29, 2021
by
Jonathan Schafer
Committed by
Michael Kozono
Jan 29, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Populate description of vulnerability from finding if needed
parent
6c4006d7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
0 deletions
+49
-0
ee/app/graphql/types/vulnerability_type.rb
ee/app/graphql/types/vulnerability_type.rb
+4
-0
ee/changelogs/unreleased/294173-description-of-vulnerability-is-empty-in-graphql.yml
...4173-description-of-vulnerability-is-empty-in-graphql.yml
+5
-0
ee/spec/graphql/types/vulnerability_type_spec.rb
ee/spec/graphql/types/vulnerability_type_spec.rb
+40
-0
No files found.
ee/app/graphql/types/vulnerability_type.rb
View file @
330a1180
...
...
@@ -130,6 +130,10 @@ module Types
object
.
finding
&
.
identifiers
end
def
description
object
.
description
||
object
.
finding_description
end
def
project
Gitlab
::
Graphql
::
Loaders
::
BatchModelLoader
.
new
(
Project
,
object
.
project_id
).
find
end
...
...
ee/changelogs/unreleased/294173-description-of-vulnerability-is-empty-in-graphql.yml
0 → 100644
View file @
330a1180
---
title
:
Properly populate description in an issue created from a vulnerability
merge_request
:
52619
author
:
type
:
fixed
ee/spec/graphql/types/vulnerability_type_spec.rb
View file @
330a1180
...
...
@@ -106,4 +106,44 @@ RSpec.describe GitlabSchema.types['Vulnerability'] do
end
end
end
describe
'#description'
do
let_it_be
(
:vulnerability_with_finding
)
{
create
(
:vulnerability
,
:with_findings
,
project:
project
)
}
let
(
:query
)
do
%(
query {
project(fullPath: "#{project.full_path}") {
name
vulnerabilities {
nodes {
description
}
}
}
}
)
end
context
'when the vulnerability description field is populated'
do
it
'returns the description for the vulnerability'
do
vulnerabilities
=
subject
.
dig
(
'data'
,
'project'
,
'vulnerabilities'
,
'nodes'
)
expect
(
vulnerabilities
.
first
[
'description'
]).
to
eq
(
vulnerability_with_finding
.
description
)
end
end
context
'when the vulnerability description field is empty'
do
before
do
vulnerability_with_finding
.
description
=
nil
vulnerability_with_finding
.
save!
end
it
'returns the description for the vulnerability finding'
do
vulnerabilities
=
subject
.
dig
(
'data'
,
'project'
,
'vulnerabilities'
,
'nodes'
)
expect
(
vulnerabilities
.
first
[
'description'
]).
to
eq
(
vulnerability_with_finding
.
finding
.
description
)
end
end
end
end
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