Commit d88b3b5d authored by Lukas 'Eipi' Eipert's avatar Lukas 'Eipi' Eipert Committed by Mark Florian

Removed deprecated Dependency Scanning from MR widget

Removed old code paths related to Frontend parsing of security scanning
results, see: https://gitlab.com/groups/gitlab-org/-/epics/1425
parent bcf1d813
...@@ -72,10 +72,8 @@ export default { ...@@ -72,10 +72,8 @@ export default {
}, },
shouldRenderSecurityReport() { shouldRenderSecurityReport() {
return ( return (
(this.mr.sast && this.mr.sast.head_path) || this.mr.enabledSecurityReports &&
(this.mr.sastContainer && this.mr.sastContainer.head_path) || Object.values(this.mr.enabledSecurityReports).some(isReportEnabled => isReportEnabled)
(this.mr.dast && this.mr.dast.head_path) ||
(this.mr.dependencyScanning && this.mr.dependencyScanning.head_path)
); );
}, },
codequalityText() { codequalityText() {
...@@ -304,17 +302,9 @@ export default { ...@@ -304,17 +302,9 @@ export default {
:target-branch="mr.targetBranch" :target-branch="mr.targetBranch"
:base-blob-path="mr.baseBlobPath" :base-blob-path="mr.baseBlobPath"
:enabled-reports="mr.enabledSecurityReports" :enabled-reports="mr.enabledSecurityReports"
:sast-head-path="mr.sast.head_path"
:sast-base-path="mr.sast.base_path"
:sast-help-path="mr.sastHelp" :sast-help-path="mr.sastHelp"
:dast-head-path="mr.dast.head_path"
:dast-base-path="mr.dast.base_path"
:dast-help-path="mr.dastHelp" :dast-help-path="mr.dastHelp"
:sast-container-head-path="mr.sastContainer.head_path"
:sast-container-base-path="mr.sastContainer.base_path"
:sast-container-help-path="mr.sastContainerHelp" :sast-container-help-path="mr.sastContainerHelp"
:dependency-scanning-head-path="mr.dependencyScanning.head_path"
:dependency-scanning-base-path="mr.dependencyScanning.base_path"
:dependency-scanning-help-path="mr.dependencyScanningHelp" :dependency-scanning-help-path="mr.dependencyScanningHelp"
:vulnerability-feedback-path="mr.vulnerabilityFeedbackPath" :vulnerability-feedback-path="mr.vulnerabilityFeedbackPath"
:vulnerability-feedback-help-path="mr.vulnerabilityFeedbackHelpPath" :vulnerability-feedback-help-path="mr.vulnerabilityFeedbackHelpPath"
......
...@@ -10,10 +10,6 @@ export default class MergeRequestStore extends CEMergeRequestStore { ...@@ -10,10 +10,6 @@ export default class MergeRequestStore extends CEMergeRequestStore {
const blobPath = data.blob_path || {}; const blobPath = data.blob_path || {};
this.headBlobPath = blobPath.head_path || ''; this.headBlobPath = blobPath.head_path || '';
this.baseBlobPath = blobPath.base_path || ''; this.baseBlobPath = blobPath.base_path || '';
this.sast = data.sast || {};
this.sastContainer = data.sast_container || {};
this.dast = data.dast || {};
this.dependencyScanning = data.dependency_scanning || {};
this.sastHelp = data.sast_help_path; this.sastHelp = data.sast_help_path;
this.sastContainerHelp = data.sast_container_help_path; this.sastContainerHelp = data.sast_container_help_path;
this.dastHelp = data.dast_help_path; this.dastHelp = data.dast_help_path;
......
...@@ -46,46 +46,6 @@ export default { ...@@ -46,46 +46,6 @@ export default {
required: false, required: false,
default: null, default: null,
}, },
sastHeadPath: {
type: String,
required: false,
default: null,
},
sastBasePath: {
type: String,
required: false,
default: null,
},
dastHeadPath: {
type: String,
required: false,
default: null,
},
dastBasePath: {
type: String,
required: false,
default: null,
},
sastContainerHeadPath: {
type: String,
required: false,
default: null,
},
sastContainerBasePath: {
type: String,
required: false,
default: null,
},
dependencyScanningHeadPath: {
type: String,
required: false,
default: null,
},
dependencyScanningBasePath: {
type: String,
required: false,
default: null,
},
sastHelpPath: { sastHelpPath: {
type: String, type: String,
required: false, required: false,
...@@ -182,21 +142,16 @@ export default { ...@@ -182,21 +142,16 @@ export default {
return `${this.pipelinePath}/security`; return `${this.pipelinePath}/security`;
}, },
hasContainerScanningReports() { hasContainerScanningReports() {
const type = 'containerScanning'; return this.enabledReports.containerScanning;
if (this.isMergeRequestReportApiEnabled(type)) {
return this.enabledReports[type];
}
const { head, diffEndpoint } = this.sastContainer.paths;
return Boolean(head || diffEndpoint);
}, },
hasDependencyScanningReports() { hasDependencyScanningReports() {
return this.hasReportsType('dependencyScanning'); return this.enabledReports.dependencyScanning;
}, },
hasDastReports() { hasDastReports() {
return this.hasReportsType('dast'); return this.enabledReports.dast;
}, },
hasSastReports() { hasSastReports() {
return this.hasReportsType('sast'); return this.enabledReports.sast;
}, },
subHeadingText() { subHeadingText() {
const mrDivergedCommitsCount = const mrDivergedCommitsCount =
...@@ -236,70 +191,36 @@ export default { ...@@ -236,70 +191,36 @@ export default {
this.setCanCreateIssuePermission(this.canCreateIssue); this.setCanCreateIssuePermission(this.canCreateIssue);
this.setCanCreateFeedbackPermission(this.canCreateFeedback); this.setCanCreateFeedbackPermission(this.canCreateFeedback);
const sastDiffEndpoint = gl && gl.mrWidgetData && gl.mrWidgetData.sast_comparison_path; // eslint-disable-next-line camelcase
const sastDiffEndpoint = gl?.mrWidgetData?.sast_comparison_path;
if (this.isMergeRequestReportApiEnabled('sast') && sastDiffEndpoint && this.hasSastReports) { if (sastDiffEndpoint && this.hasSastReports) {
this.setSastDiffEndpoint(sastDiffEndpoint); this.setSastDiffEndpoint(sastDiffEndpoint);
this.fetchSastDiff(); this.fetchSastDiff();
} else if (this.sastHeadPath) {
this.setSastHeadPath(this.sastHeadPath);
if (this.sastBasePath) {
this.setSastBasePath(this.sastBasePath);
}
this.fetchSastReports();
} }
const sastContainerDiffEndpoint = // eslint-disable-next-line camelcase
gl && gl.mrWidgetData && gl.mrWidgetData.container_scanning_comparison_path; const containerScanningDiffEndpoint = gl?.mrWidgetData?.container_scanning_comparison_path;
if ( if (containerScanningDiffEndpoint && this.hasContainerScanningReports) {
this.isMergeRequestReportApiEnabled('containerScanning') && this.setSastContainerDiffEndpoint(containerScanningDiffEndpoint);
sastContainerDiffEndpoint &&
this.hasContainerScanningReports
) {
this.setSastContainerDiffEndpoint(sastContainerDiffEndpoint);
this.fetchSastContainerDiff(); this.fetchSastContainerDiff();
} else if (this.sastContainerHeadPath) {
this.setSastContainerHeadPath(this.sastContainerHeadPath);
if (this.sastContainerBasePath) {
this.setSastContainerBasePath(this.sastContainerBasePath);
}
this.fetchSastContainerReports();
} }
const dastDiffEndpoint = gl && gl.mrWidgetData && gl.mrWidgetData.dast_comparison_path; // eslint-disable-next-line camelcase
const dastDiffEndpoint = gl?.mrWidgetData?.dast_comparison_path;
if (this.isMergeRequestReportApiEnabled('dast') && dastDiffEndpoint && this.hasDastReports) { if (dastDiffEndpoint && this.hasDastReports) {
this.setDastDiffEndpoint(dastDiffEndpoint); this.setDastDiffEndpoint(dastDiffEndpoint);
this.fetchDastDiff(); this.fetchDastDiff();
} else if (this.dastHeadPath) {
this.setDastHeadPath(this.dastHeadPath);
if (this.dastBasePath) {
this.setDastBasePath(this.dastBasePath);
}
this.fetchDastReports();
} }
const dependencyScanningDiffEndpoint = // eslint-disable-next-line camelcase
gl && gl.mrWidgetData && gl.mrWidgetData.dependency_scanning_comparison_path; const dependencyScanningDiffEndpoint = gl?.mrWidgetData?.dependency_scanning_comparison_path;
if ( if (dependencyScanningDiffEndpoint && this.hasDependencyScanningReports) {
this.isMergeRequestReportApiEnabled('dependencyScanning') &&
dependencyScanningDiffEndpoint &&
this.hasDependencyScanningReports
) {
this.setDependencyScanningDiffEndpoint(dependencyScanningDiffEndpoint); this.setDependencyScanningDiffEndpoint(dependencyScanningDiffEndpoint);
this.fetchDependencyScanningDiff(); this.fetchDependencyScanningDiff();
} else if (this.dependencyScanningHeadPath) {
this.setDependencyScanningHeadPath(this.dependencyScanningHeadPath);
if (this.dependencyScanningBasePath) {
this.setDependencyScanningBasePath(this.dependencyScanningBasePath);
}
this.fetchDependencyScanningReports();
} }
}, },
methods: { methods: {
...@@ -308,15 +229,6 @@ export default { ...@@ -308,15 +229,6 @@ export default {
'setHeadBlobPath', 'setHeadBlobPath',
'setBaseBlobPath', 'setBaseBlobPath',
'setSourceBranch', 'setSourceBranch',
'setSastContainerHeadPath',
'setSastContainerBasePath',
'setDastHeadPath',
'setDastBasePath',
'setDependencyScanningHeadPath',
'setDependencyScanningBasePath',
'fetchSastContainerReports',
'fetchDastReports',
'fetchDependencyScanningReports',
'setVulnerabilityFeedbackPath', 'setVulnerabilityFeedbackPath',
'setVulnerabilityFeedbackHelpPath', 'setVulnerabilityFeedbackHelpPath',
'setCreateVulnerabilityFeedbackIssuePath', 'setCreateVulnerabilityFeedbackIssuePath',
...@@ -344,22 +256,9 @@ export default { ...@@ -344,22 +256,9 @@ export default {
'setDastDiffEndpoint', 'setDastDiffEndpoint',
]), ]),
...mapActions('sast', { ...mapActions('sast', {
setSastHeadPath: 'setHeadPath',
setSastBasePath: 'setBasePath',
setSastDiffEndpoint: 'setDiffEndpoint', setSastDiffEndpoint: 'setDiffEndpoint',
fetchSastReports: 'fetchReports',
fetchSastDiff: 'fetchDiff', fetchSastDiff: 'fetchDiff',
}), }),
isMergeRequestReportApiEnabled(type) {
return Boolean(this.glFeatures[`${type}MergeRequestReportApi`]);
},
hasReportsType(type) {
if (this.isMergeRequestReportApiEnabled(type)) {
return this.enabledReports[type];
}
const { head, diffEndpoint } = this[type].paths;
return Boolean(head || diffEndpoint);
},
}, },
}; };
</script> </script>
......
...@@ -119,10 +119,10 @@ export const anyReportHasError = state => ...@@ -119,10 +119,10 @@ export const anyReportHasError = state =>
state.dependencyScanning.hasError; state.dependencyScanning.hasError;
export const noBaseInAllReports = state => export const noBaseInAllReports = state =>
!state.sast.paths.base && !state.sast.hasBaseReport &&
!state.dast.paths.base && !state.dast.hasBaseReport &&
!state.sastContainer.paths.base && !state.sastContainer.hasBaseReport &&
!state.dependencyScanning.paths.base; !state.dependencyScanning.hasBaseReport;
export const anyReportHasIssues = state => export const anyReportHasIssues = state =>
state.sast.newIssues.length > 0 || state.sast.newIssues.length > 0 ||
......
...@@ -62,12 +62,14 @@ export default { ...@@ -62,12 +62,14 @@ export default {
[types.RECEIVE_DIFF_SUCCESS](state, { diff, enrichData }) { [types.RECEIVE_DIFF_SUCCESS](state, { diff, enrichData }) {
const { added, fixed, existing } = parseDiff(diff, enrichData); const { added, fixed, existing } = parseDiff(diff, enrichData);
const baseReportOutofDate = diff.base_report_out_of_date || false; const baseReportOutofDate = diff.base_report_out_of_date || false;
const hasBaseReport = Boolean(diff.base_report_created_at);
state.isLoading = false; state.isLoading = false;
state.newIssues = added; state.newIssues = added;
state.resolvedIssues = fixed; state.resolvedIssues = fixed;
state.allIssues = existing; state.allIssues = existing;
state.baseReportOutofDate = baseReportOutofDate; state.baseReportOutofDate = baseReportOutofDate;
state.hasBaseReport = hasBaseReport;
}, },
[types.RECEIVE_DIFF_ERROR](state) { [types.RECEIVE_DIFF_ERROR](state) {
......
...@@ -12,4 +12,5 @@ export default () => ({ ...@@ -12,4 +12,5 @@ export default () => ({
resolvedIssues: [], resolvedIssues: [],
allIssues: [], allIssues: [],
baseReportOutofDate: false, baseReportOutofDate: false,
hasBaseReport: false,
}); });
...@@ -109,12 +109,14 @@ export default { ...@@ -109,12 +109,14 @@ export default {
[types.RECEIVE_SAST_CONTAINER_DIFF_SUCCESS](state, { diff, enrichData }) { [types.RECEIVE_SAST_CONTAINER_DIFF_SUCCESS](state, { diff, enrichData }) {
const { added, fixed, existing } = parseDiff(diff, enrichData); const { added, fixed, existing } = parseDiff(diff, enrichData);
const baseReportOutofDate = diff.base_report_out_of_date || false; const baseReportOutofDate = diff.base_report_out_of_date || false;
const hasBaseReport = Boolean(diff.base_report_created_at);
Vue.set(state.sastContainer, 'isLoading', false); Vue.set(state.sastContainer, 'isLoading', false);
Vue.set(state.sastContainer, 'newIssues', added); Vue.set(state.sastContainer, 'newIssues', added);
Vue.set(state.sastContainer, 'resolvedIssues', fixed); Vue.set(state.sastContainer, 'resolvedIssues', fixed);
Vue.set(state.sastContainer, 'allIssues', existing); Vue.set(state.sastContainer, 'allIssues', existing);
Vue.set(state.sastContainer, 'baseReportOutofDate', baseReportOutofDate); Vue.set(state.sastContainer, 'baseReportOutofDate', baseReportOutofDate);
Vue.set(state.sastContainer, 'hasBaseReport', hasBaseReport);
}, },
[types.RECEIVE_SAST_CONTAINER_DIFF_ERROR](state) { [types.RECEIVE_SAST_CONTAINER_DIFF_ERROR](state) {
...@@ -167,12 +169,14 @@ export default { ...@@ -167,12 +169,14 @@ export default {
[types.RECEIVE_DAST_DIFF_SUCCESS](state, { diff, enrichData }) { [types.RECEIVE_DAST_DIFF_SUCCESS](state, { diff, enrichData }) {
const { added, fixed, existing } = parseDiff(diff, enrichData); const { added, fixed, existing } = parseDiff(diff, enrichData);
const baseReportOutofDate = diff.base_report_out_of_date || false; const baseReportOutofDate = diff.base_report_out_of_date || false;
const hasBaseReport = Boolean(diff.base_report_created_at);
Vue.set(state.dast, 'isLoading', false); Vue.set(state.dast, 'isLoading', false);
Vue.set(state.dast, 'newIssues', added); Vue.set(state.dast, 'newIssues', added);
Vue.set(state.dast, 'resolvedIssues', fixed); Vue.set(state.dast, 'resolvedIssues', fixed);
Vue.set(state.dast, 'allIssues', existing); Vue.set(state.dast, 'allIssues', existing);
Vue.set(state.dast, 'baseReportOutofDate', baseReportOutofDate); Vue.set(state.dast, 'baseReportOutofDate', baseReportOutofDate);
Vue.set(state.dast, 'hasBaseReport', hasBaseReport);
}, },
[types.RECEIVE_DAST_DIFF_ERROR](state) { [types.RECEIVE_DAST_DIFF_ERROR](state) {
...@@ -256,12 +260,14 @@ export default { ...@@ -256,12 +260,14 @@ export default {
[types.RECEIVE_DEPENDENCY_SCANNING_DIFF_SUCCESS](state, { diff, enrichData }) { [types.RECEIVE_DEPENDENCY_SCANNING_DIFF_SUCCESS](state, { diff, enrichData }) {
const { added, fixed, existing } = parseDiff(diff, enrichData); const { added, fixed, existing } = parseDiff(diff, enrichData);
const baseReportOutofDate = diff.base_report_out_of_date || false; const baseReportOutofDate = diff.base_report_out_of_date || false;
const hasBaseReport = Boolean(diff.base_report_created_at);
Vue.set(state.dependencyScanning, 'isLoading', false); Vue.set(state.dependencyScanning, 'isLoading', false);
Vue.set(state.dependencyScanning, 'newIssues', added); Vue.set(state.dependencyScanning, 'newIssues', added);
Vue.set(state.dependencyScanning, 'resolvedIssues', fixed); Vue.set(state.dependencyScanning, 'resolvedIssues', fixed);
Vue.set(state.dependencyScanning, 'allIssues', existing); Vue.set(state.dependencyScanning, 'allIssues', existing);
Vue.set(state.dependencyScanning, 'baseReportOutofDate', baseReportOutofDate); Vue.set(state.dependencyScanning, 'baseReportOutofDate', baseReportOutofDate);
Vue.set(state.dependencyScanning, 'hasBaseReport', hasBaseReport);
}, },
[types.RECEIVE_DEPENDENCY_SCANNING_DIFF_ERROR](state) { [types.RECEIVE_DEPENDENCY_SCANNING_DIFF_ERROR](state) {
......
...@@ -29,6 +29,7 @@ export default () => ({ ...@@ -29,6 +29,7 @@ export default () => ({
newIssues: [], newIssues: [],
resolvedIssues: [], resolvedIssues: [],
baseReportOutofDate: false, baseReportOutofDate: false,
hasBaseReport: false,
}, },
dast: { dast: {
paths: { paths: {
...@@ -43,6 +44,7 @@ export default () => ({ ...@@ -43,6 +44,7 @@ export default () => ({
newIssues: [], newIssues: [],
resolvedIssues: [], resolvedIssues: [],
baseReportOutofDate: false, baseReportOutofDate: false,
hasBaseReport: false,
}, },
dependencyScanning: { dependencyScanning: {
...@@ -59,6 +61,7 @@ export default () => ({ ...@@ -59,6 +61,7 @@ export default () => ({
resolvedIssues: [], resolvedIssues: [],
allIssues: [], allIssues: [],
baseReportOutofDate: false, baseReportOutofDate: false,
hasBaseReport: false,
}, },
modal: { modal: {
......
...@@ -525,8 +525,8 @@ describe('Security reports getters', () => { ...@@ -525,8 +525,8 @@ describe('Security reports getters', () => {
expect(noBaseInAllReports(state)).toEqual(true); expect(noBaseInAllReports(state)).toEqual(true);
}); });
it('returns false when any of the reports has base', () => { it('returns false when any of the reports has a base', () => {
state.dast.paths.base = BASE_PATH; state.dast.hasBaseReport = true;
expect(noBaseInAllReports(state)).toEqual(false); expect(noBaseInAllReports(state)).toEqual(false);
}); });
......
...@@ -11,9 +11,9 @@ export default Object.assign({}, mockData, { ...@@ -11,9 +11,9 @@ export default Object.assign({}, mockData, {
}, },
vulnerability_feedback_help_path: '/help/user/application_security/index', vulnerability_feedback_help_path: '/help/user/application_security/index',
enabled_reports: { enabled_reports: {
sast: true, sast: false,
container_scanning: false, container_scanning: false,
dast: true, dast: false,
dependency_scanning: false, dependency_scanning: false,
license_management: true, license_management: true,
}, },
......
...@@ -4,37 +4,22 @@ import * as mockData from '../../../frontend/vue_shared/security_reports/mock_da ...@@ -4,37 +4,22 @@ import * as mockData from '../../../frontend/vue_shared/security_reports/mock_da
// https://gitlab.com/gitlab-org/gitlab/merge_requests/10466#note_156218753 // https://gitlab.com/gitlab-org/gitlab/merge_requests/10466#note_156218753
export const { export const {
allIssuesParsed,
baseIssues,
containerScanningFeedbacks, containerScanningFeedbacks,
dast, dast,
dastBase, dastBase,
dastFeedbacks, dastFeedbacks,
dependencyScanningFeedbacks, dependencyScanningFeedbacks,
dependencyScanningIssues,
dependencyScanningIssuesBase,
dependencyScanningIssuesMajor2,
dependencyScanningIssuesOld,
dockerBaseReport, dockerBaseReport,
dockerNewIssues,
dockerOnlyHeadParsed,
dockerReport, dockerReport,
dockerReportParsed, dockerReportParsed,
oldSastIssues,
parsedDast, parsedDast,
parsedDastNewIssues,
parsedDependencyScanningBaseStore,
parsedDependencyScanningIssuesHead,
parsedDependencyScanningIssuesStore,
parsedSastBaseStore,
parsedSastContainerBaseStore,
parsedSastIssuesHead,
parsedSastIssuesStore,
sastBaseAllIssues,
sastFeedbacks, sastFeedbacks,
sastHeadAllIssues,
sastIssues, sastIssues,
sastIssuesBase, sastIssuesBase,
sastIssuesMajor2,
sastParsedIssues, sastParsedIssues,
mockFindings,
sastDiffSuccessMock,
dastDiffSuccessMock,
containerScanningDiffSuccessMock,
dependencyScanningDiffSuccessMock,
} = mockData; } = mockData;
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