Commit fd41e449 authored by Mark Florian's avatar Mark Florian

Merge branch '243569-DAST-add-vulnerability-url' into 'master'

Added DAST path to display on vulnerabilities list

See merge request gitlab-org/gitlab!49616
parents a1a48caf 61a661d5
......@@ -215,7 +215,7 @@ export default {
},
methods: {
createLocationString(location) {
const { image, file, startLine } = location;
const { image, file, startLine, path } = location;
if (image) {
return image;
......@@ -225,6 +225,10 @@ export default {
return `${file} ${sprintf(__('(line: %{startLine})'), { startLine })}`;
}
if (path) {
return path;
}
return file;
},
deselectVulnerability(vulnerabilityId) {
......@@ -255,7 +259,7 @@ export default {
return identifiers?.length > 1;
},
shouldShowVulnerabilityPath(item) {
return Boolean(item.location.image || item.location.file);
return Boolean(item.location.image || item.location.file || item.location.path);
},
toggleAllVulnerabilities() {
if (this.hasSelectedAllVulnerabilities) {
......
......@@ -37,6 +37,9 @@ fragment Vulnerability on Vulnerability {
file
startLine
}
... on VulnerabilityLocationDast {
path
}
}
project {
nameWithNamespace
......
---
title: Added DAST path to display on vulnerabilities list
merge_request: 49616
author:
type: changed
......@@ -99,6 +99,19 @@ export const generateVulnerabilities = () => [
},
scanner: {},
},
{
id: 'id_5',
title: 'Vulnerability 5',
severity: 'high',
state: 'DETECTED',
location: {
path: '/v1/trees',
},
project: {
nameWithNamespace: 'Administrator / Security reports',
},
scanner: {},
},
];
export const vulnerabilities = generateVulnerabilities();
......@@ -243,6 +243,16 @@ describe('Vulnerability list component', () => {
expect(cellText).toEqual(project.nameWithNamespace);
expect(cellText).not.toContain('(line: ');
});
it('should display the vulnerability locations for path', () => {
const { id, project, location } = newVulnerabilities[5];
const cell = findDataCell(`location-${id}`);
expect(cell.text()).toContain(project.nameWithNamespace);
expect(findLocationTextWrapper(cell).props()).toEqual({
text: location.path,
position: 'middle',
});
});
});
describe('when displayed on a project level dashboard', () => {
......
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