Commit 7f716dc0 authored by Sam Kerr's avatar Sam Kerr Committed by Alexander Turinske

Add scanner name

- update the security dashboards to show the scanner type
- update the pipeline security tab to show the scanner name
- add tests
parent c3b54d05
......@@ -80,6 +80,9 @@ export default {
<div class="table-section section-15" role="rowheader">
{{ s__('Reports|Identifier') }}
</div>
<div class="table-section section-15" role="rowheader">
{{ s__('Reports|Scanner') }}
</div>
<div class="table-section section-20" role="rowheader"></div>
</div>
......
......@@ -47,6 +47,10 @@ export default {
}
return location && (location.image || location.file || location.path);
},
vulnerabilityScanner() {
const { scanner } = this.vulnerability;
return scanner?.name;
},
isDismissed() {
return Boolean(this.vulnerability.dismissal_feedback);
},
......@@ -146,6 +150,13 @@ export default {
</div>
</div>
<div class="table-section section-15">
<div class="table-mobile-header" role="rowheader">{{ s__('Reports|Scanner') }}</div>
<div class="table-mobile-content">
{{ vulnerabilityScanner }}
</div>
</div>
<div class="table-section section-20">
<div class="table-mobile-header" role="rowheader">{{ s__('Reports|Actions') }}</div>
<div class="table-mobile-content action-buttons d-flex justify-content-end">
......
......@@ -29,7 +29,7 @@ export const initFirstClassVulnerabilityFilters = projects => {
selection: new Set([ALL]),
},
{
name: s__('SecurityReports|Report type'),
name: s__('Reports|Scanner'),
id: 'reportType',
options: [BASE_FILTERS.report_type, ...parseOptions(REPORT_TYPES)],
selection: new Set([ALL]),
......
......@@ -8,7 +8,7 @@ export const BASE_FILTERS = {
id: ALL,
},
report_type: {
name: s__('ciReport|All report types'),
name: s__('ciReport|All scanner types'),
id: ALL,
},
project_id: {
......
......@@ -14,7 +14,7 @@ export default () => ({
selection: new Set([BASE_FILTERS.severity.id]),
},
{
name: s__('SecurityReports|Report type'),
name: s__('SecurityReports|Scanner type'),
id: 'report_type',
options: [BASE_FILTERS.report_type, ...optionsObjectToArray(REPORT_TYPES)],
hidden: false,
......
......@@ -99,6 +99,11 @@ export default {
thClass: commonThClass,
tdClass: 'gl-word-break-all',
},
{
key: 'reportType',
label: s__('Reports|Scanner'),
thClass: `${commonThClass}`,
},
];
},
},
......@@ -224,6 +229,10 @@ export default {
<remediated-badge v-if="item.resolved_on_default_branch" class="ml-2" />
</template>
<template #cell(reportType)="{ item }">
<span class="text-capitalize js-reportType">{{ item.reportType }}</span>
</template>
<template #table-busy>
<gl-skeleton-loading
v-for="n in $options.VULNERABILITIES_PER_PAGE"
......
......@@ -31,4 +31,5 @@ fragment Vulnerability on Vulnerability {
project {
nameWithNamespace
}
reportType
}
---
title: Add scanner name to vulnerability row
merge_request: 31775
author:
type: changed
......@@ -81,6 +81,14 @@ describe('Security Dashboard Table Row', () => {
expect(findContent(2).text()).toContain(vulnerability.identifiers[0].name);
});
it('should render the scanner name', () => {
expect(
findContent(2)
.text()
.toLowerCase(),
).toContain(wrapper.props().vulnerability.scanner.name.toLowerCase());
});
describe('the project name', () => {
it('should render the name', () => {
expect(findContent(1).text()).toContain(vulnerability.name);
......
......@@ -4,6 +4,7 @@ export const generateVulnerabilities = () => [
title: 'Vulnerability 1',
severity: 'critical',
state: 'dismissed',
reportType: 'sast',
location: {
image:
'registry.gitlab.com/groulot/container-scanning-test/master:5f21de6956aee99ddb68ae49498662d9872f50ff',
......@@ -17,6 +18,7 @@ export const generateVulnerabilities = () => [
title: 'Vulnerability 2',
severity: 'high',
state: 'opened',
reportType: 'sast',
location: {
file: 'src/main/java/com/gitlab/security_products/tests/App.java',
},
......
......@@ -63,6 +63,11 @@ describe('Vulnerability list component', () => {
expect(cell.text().toLowerCase()).toBe(newVulnerabilities[0].severity);
});
it('should correctly render the scanner type', () => {
const cell = findCell('reportType');
expect(cell.text().toLowerCase()).toBe(newVulnerabilities[0].reportType);
});
it('should correctly render the description', () => {
const cell = findCell('description');
......
......@@ -19156,6 +19156,9 @@ msgstr ""
msgid "Reports|Metrics reports failed loading results"
msgstr ""
msgid "Reports|Scanner"
msgstr ""
msgid "Reports|Severity"
msgstr ""
......@@ -20121,10 +20124,10 @@ msgstr ""
msgid "SecurityReports|Remove project from dashboard"
msgstr ""
msgid "SecurityReports|Report type"
msgid "SecurityReports|Return to dashboard"
msgstr ""
msgid "SecurityReports|Return to dashboard"
msgid "SecurityReports|Scanner type"
msgstr ""
msgid "SecurityReports|Scan details"
......@@ -26830,7 +26833,7 @@ msgstr ""
msgid "ciReport|All projects"
msgstr ""
msgid "ciReport|All report types"
msgid "ciReport|All scanner types"
msgstr ""
msgid "ciReport|All severities"
......
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