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
ff2425a1
Commit
ff2425a1
authored
Mar 31, 2020
by
Michał Zając
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Apply reviewer suggestions
parent
7c5a5558
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
19 deletions
+24
-19
ee/app/helpers/vulnerabilities_helper.rb
ee/app/helpers/vulnerabilities_helper.rb
+15
-15
ee/app/views/projects/security/vulnerabilities/show.html.haml
...pp/views/projects/security/vulnerabilities/show.html.haml
+2
-2
ee/spec/helpers/ee/vulnerabilities_helper_spec.rb
ee/spec/helpers/ee/vulnerabilities_helper_spec.rb
+7
-2
No files found.
ee/app/helpers/vulnerabilities_helper.rb
View file @
ff2425a1
# frozen_string_literal: true
# frozen_string_literal: true
module
VulnerabilitiesHelper
module
VulnerabilitiesHelper
def
vulnerability_data
(
vulnerability
,
pipeline
,
current_user:
nil
)
def
vulnerability_data
(
vulnerability
,
pipeline
)
return
unless
vulnerability
return
unless
vulnerability
{
{
...
@@ -10,8 +10,8 @@ module VulnerabilitiesHelper
...
@@ -10,8 +10,8 @@ module VulnerabilitiesHelper
create_issue_url:
create_vulnerability_feedback_issue_path
(
vulnerability
.
finding
.
project
),
create_issue_url:
create_vulnerability_feedback_issue_path
(
vulnerability
.
finding
.
project
),
pipeline_json:
vulnerability_pipeline_data
(
pipeline
).
to_json
,
pipeline_json:
vulnerability_pipeline_data
(
pipeline
).
to_json
,
has_mr:
!!
vulnerability
.
finding
.
merge_request_feedback
.
try
(
:merge_request_iid
),
has_mr:
!!
vulnerability
.
finding
.
merge_request_feedback
.
try
(
:merge_request_iid
),
vulnerability_feedback_help_path:
help_page_path
(
"user/application_security/index"
,
anchor:
"interacting-with-the-vulnerabilities"
),
vulnerability_feedback_help_path:
help_page_path
(
'user/application_security/index'
,
anchor:
'interacting-with-the-vulnerabilities'
),
finding_json:
vulnerability_finding_data
(
vulnerability
.
finding
,
current_user:
current_user
).
to_json
finding_json:
vulnerability_finding_data
(
vulnerability
.
finding
).
to_json
}
}
end
end
...
@@ -25,20 +25,20 @@ module VulnerabilitiesHelper
...
@@ -25,20 +25,20 @@ module VulnerabilitiesHelper
}
}
end
end
def
vulnerability_finding_data
(
finding
,
current_user:
nil
)
def
vulnerability_finding_data
(
finding
)
occurrence
=
Vulnerabilities
::
OccurrenceSerializer
.
new
(
current_user:
current_user
).
represent
(
finding
)
occurrence
=
Vulnerabilities
::
OccurrenceSerializer
.
new
(
current_user:
current_user
).
represent
(
finding
)
remediation
=
occurrence
[
:remediations
]
&
.
first
remediation
=
occurrence
[
:remediations
]
&
.
first
{
occurrence
.
slice
(
description:
occurrence
[
:description
]
,
:description
,
identifiers:
occurrence
[
:identifiers
]
,
:identifiers
,
links:
occurrence
[
:links
]
,
:links
,
location:
occurrence
[
:location
]
,
:location
,
name:
occurrence
[
:name
]
,
:name
,
solution:
occurrence
[
:solution
]
,
:issue_feedback
,
remediation:
remediation
,
:project
issue_feedback:
occurrence
[
:issue_feedback
],
).
merge
(
project:
occurrence
[
:project
]
solution:
remediation
?
remediation
[
'summary'
]
:
occurrence
[
:solution
]
}
)
end
end
end
end
ee/app/views/projects/security/vulnerabilities/show.html.haml
View file @
ff2425a1
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
-
page_title
@vulnerability
.
title
-
page_title
@vulnerability
.
title
-
page_description
@vulnerability
.
description
-
page_description
@vulnerability
.
description
#js-vulnerability-management-app
{
data:
vulnerability_data
(
@vulnerability
,
@pipeline
,
current_user:
@current_user
)
}
#js-vulnerability-management-app
{
data:
vulnerability_data
(
@vulnerability
,
@pipeline
)
}
.issue-details.issuable-details
.issue-details.issuable-details
.detail-page-description
.detail-page-description
...
@@ -38,4 +38,4 @@
...
@@ -38,4 +38,4 @@
%li
%li
%a
{
:href
=>
identifier
.
url
,
target:
"_blank"
,
rel:
'noopener noreferrer'
}=
identifier
.
name
%a
{
:href
=>
identifier
.
url
,
target:
"_blank"
,
rel:
'noopener noreferrer'
}=
identifier
.
name
#js-vulnerability-footer
{
data:
vulnerability_data
(
@vulnerability
,
@pipeline
,
current_user:
@current_user
)
}
#js-vulnerability-footer
{
data:
vulnerability_data
(
@vulnerability
,
@pipeline
)
}
ee/spec/helpers/ee/vulnerabilities_helper_spec.rb
View file @
ff2425a1
...
@@ -8,7 +8,10 @@ describe VulnerabilitiesHelper do
...
@@ -8,7 +8,10 @@ describe VulnerabilitiesHelper do
expect
(
subject
).
to
include
(
expect
(
subject
).
to
include
(
vulnerability_json:
vulnerability
.
to_json
,
vulnerability_json:
vulnerability
.
to_json
,
project_fingerprint:
vulnerability
.
finding
.
project_fingerprint
,
project_fingerprint:
vulnerability
.
finding
.
project_fingerprint
,
create_issue_url:
be_present
create_issue_url:
anything
,
has_mr:
anything
,
vulnerability_feedback_help_path:
anything
,
finding_json:
anything
)
)
end
end
end
end
...
@@ -63,7 +66,9 @@ describe VulnerabilitiesHelper do
...
@@ -63,7 +66,9 @@ describe VulnerabilitiesHelper do
identifiers:
finding
.
identifiers
,
identifiers:
finding
.
identifiers
,
links:
finding
.
links
,
links:
finding
.
links
,
location:
finding
.
location
,
location:
finding
.
location
,
name:
finding
.
name
name:
finding
.
name
,
issue_feedback:
anything
,
project:
anything
)
)
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