Commit 17779659 authored by Mark Florian's avatar Mark Florian

Conform better to secret detection nomenclature

There are still references like SECRET_SCANNING in the codebase, but
those are _mostly_ to do with user-facing strings which do still display
"Secret scanning", so I've left those as-is.
parent 683fa3d2
......@@ -191,7 +191,7 @@ export default {
'dast',
'coverageFuzzing',
'dependencyScanning',
'secretScanning',
'secretDetection',
'summaryCounts',
'modal',
'isCreatingIssue',
......@@ -215,7 +215,7 @@ export default {
'canDismissVulnerability',
]),
...mapGetters('sast', ['groupedSastText', 'sastStatusIcon']),
...mapGetters('secretScanning', ['groupedSecretScanningText', 'secretScanningStatusIcon']),
...mapGetters('secretDetection', ['groupedSecretDetectionText', 'secretDetectionStatusIcon']),
...mapGetters('pipelineJobs', ['hasFuzzingArtifacts', 'fuzzingJobsWithArtifact']),
securityTab() {
return `${this.pipelinePath}/security`;
......@@ -307,9 +307,9 @@ export default {
this.fetchDependencyScanningDiff();
}
const secretScanningDiffEndpoint = gl?.mrWidgetData?.secret_scanning_comparison_path;
if (secretScanningDiffEndpoint && this.hasSecretScanningReports) {
this.setSecretDetectionDiffEndpoint(secretScanningDiffEndpoint);
const secretDetectionDiffEndpoint = gl?.mrWidgetData?.secret_scanning_comparison_path;
if (secretDetectionDiffEndpoint && this.hasSecretDetectionReports) {
this.setSecretDetectionDiffEndpoint(secretDetectionDiffEndpoint);
this.fetchSecretDetectionDiff();
}
......@@ -358,7 +358,7 @@ export default {
setSastDiffEndpoint: 'setDiffEndpoint',
fetchSastDiff: 'fetchDiff',
}),
...mapActions('secretScanning', {
...mapActions('secretDetection', {
setSecretDetectionDiffEndpoint: 'setDiffEndpoint',
fetchSecretDetectionDiff: 'fetchDiff',
}),
......@@ -532,22 +532,22 @@ export default {
/>
</template>
<template v-if="hasSecretScanningReports">
<template v-if="hasSecretDetectionReports">
<summary-row
:status-icon="secretScanningStatusIcon"
:status-icon="secretDetectionStatusIcon"
:popover-options="secretScanningPopover"
class="js-secret-scanning"
data-qa-selector="secret_scan_report"
>
<template #summary>
<security-summary :message="groupedSecretScanningText" />
<security-summary :message="groupedSecretDetectionText" />
</template>
</summary-row>
<grouped-issues-list
v-if="secretScanning.newIssues.length || secretScanning.resolvedIssues.length"
:unresolved-issues="secretScanning.newIssues"
:resolved-issues="secretScanning.resolvedIssues"
v-if="secretDetection.newIssues.length || secretDetection.resolvedIssues.length"
:unresolved-issues="secretDetection.newIssues"
:resolved-issues="secretDetection.resolvedIssues"
:component="$options.componentNames.SecurityIssueBody"
class="report-block-group-list"
data-testid="secret-scanning-issues-list"
......
......@@ -35,7 +35,7 @@ export const summaryCounts = ({
dast,
dependencyScanning,
sast,
secretScanning,
secretDetection,
coverageFuzzing,
} = {}) => {
const allNewVulns = [
......@@ -43,7 +43,7 @@ export const summaryCounts = ({
...dast.newIssues,
...dependencyScanning.newIssues,
...sast.newIssues,
...secretScanning.newIssues,
...secretDetection.newIssues,
...coverageFuzzing.newIssues,
];
......@@ -114,7 +114,7 @@ export const areReportsLoading = state =>
state.dast.isLoading ||
state.containerScanning.isLoading ||
state.dependencyScanning.isLoading ||
state.secretScanning.isLoading ||
state.secretDetection.isLoading ||
state.coverageFuzzing.isLoading;
export const areAllReportsLoading = state =>
......@@ -122,7 +122,7 @@ export const areAllReportsLoading = state =>
state.dast.isLoading &&
state.containerScanning.isLoading &&
state.dependencyScanning.isLoading &&
state.secretScanning.isLoading &&
state.secretDetection.isLoading &&
state.coverageFuzzing.isLoading;
export const allReportsHaveError = state =>
......@@ -130,7 +130,7 @@ export const allReportsHaveError = state =>
state.dast.hasError &&
state.containerScanning.hasError &&
state.dependencyScanning.hasError &&
state.secretScanning.hasError &&
state.secretDetection.hasError &&
state.coverageFuzzing.hasError;
export const anyReportHasError = state =>
......@@ -138,7 +138,7 @@ export const anyReportHasError = state =>
state.dast.hasError ||
state.containerScanning.hasError ||
state.dependencyScanning.hasError ||
state.secretScanning.hasError ||
state.secretDetection.hasError ||
state.coverageFuzzing.hasError;
export const noBaseInAllReports = state =>
......@@ -146,7 +146,7 @@ export const noBaseInAllReports = state =>
!state.dast.hasBaseReport &&
!state.containerScanning.hasBaseReport &&
!state.dependencyScanning.hasBaseReport &&
!state.secretScanning.hasBaseReport &&
!state.secretDetection.hasBaseReport &&
!state.coverageFuzzing.hasBaseReport;
export const anyReportHasIssues = state =>
......@@ -154,7 +154,7 @@ export const anyReportHasIssues = state =>
state.dast.newIssues.length > 0 ||
state.containerScanning.newIssues.length > 0 ||
state.dependencyScanning.newIssues.length > 0 ||
state.secretScanning.newIssues.length > 0 ||
state.secretDetection.newIssues.length > 0 ||
state.coverageFuzzing.newIssues.length > 0;
export const isBaseSecurityReportOutOfDate = state =>
......@@ -162,7 +162,7 @@ export const isBaseSecurityReportOutOfDate = state =>
state.dast.baseReportOutofDate ||
state.containerScanning.baseReportOutofDate ||
state.dependencyScanning.baseReportOutofDate ||
state.secretScanning.baseReportOutofDate ||
state.secretDetection.baseReportOutofDate ||
state.coverageFuzzing.baseReportOutofDate;
export const canCreateIssue = state => Boolean(state.createVulnerabilityFeedbackIssuePath);
......
......@@ -8,7 +8,7 @@ import mutations from './mutations';
import state from './state';
import sast from './modules/sast';
import secretScanning from './modules/secret_detection';
import secretDetection from './modules/secret_detection';
Vue.use(Vuex);
......@@ -16,7 +16,7 @@ export default () =>
new Vuex.Store({
modules: {
sast,
secretScanning,
secretDetection,
pipelineJobs,
},
actions,
......
......@@ -5,7 +5,7 @@ export const updateIssueActionsMap = {
dependency_scanning: 'updateDependencyScanningIssue',
container_scanning: 'updateContainerScanningIssue',
dast: 'updateDastIssue',
secret_detection: 'secretScanning/updateVulnerability',
secret_detection: 'secretDetection/updateVulnerability',
coverage_fuzzing: 'updateCoverageFuzzingIssue',
};
......
import { statusIcon, groupedReportText } from '../../utils';
import messages from '../../messages';
export const groupedSecretScanningText = state =>
export const groupedSecretDetectionText = state =>
groupedReportText(
state,
messages.SECRET_SCANNING,
......@@ -9,5 +9,5 @@ export const groupedSecretScanningText = state =>
messages.SECRET_SCANNING_IS_LOADING,
);
export const secretScanningStatusIcon = ({ isLoading, hasError, newIssues }) =>
export const secretDetectionStatusIcon = ({ isLoading, hasError, newIssues }) =>
statusIcon(isLoading, hasError, newIssues.length);
......@@ -10,7 +10,7 @@ export default {
dast: false,
dependency_scanning: false,
license_management: false,
secret_scanning: false,
secret_detection: false,
},
};
......
......@@ -4,7 +4,7 @@ import GroupedSecurityReportsApp from 'ee/vue_shared/security_reports/grouped_se
import appStore from 'ee/vue_shared/security_reports/store';
import * as types from 'ee/vue_shared/security_reports/store/mutation_types';
import * as sastTypes from 'ee/vue_shared/security_reports/store/modules/sast/mutation_types';
import * as secretScanningTypes from 'ee/vue_shared/security_reports/store/modules/secret_detection/mutation_types';
import * as secretDetectionTypes from 'ee/vue_shared/security_reports/store/modules/secret_detection/mutation_types';
import { mount } from '@vue/test-utils';
import { waitForMutation } from 'helpers/vue_test_utils_helper';
import { trimText } from 'helpers/text_helper';
......@@ -30,7 +30,7 @@ const DEPENDENCY_SCANNING_DIFF_ENDPOINT = 'dependency_scanning.json';
const DAST_DIFF_ENDPOINT = 'dast.json';
const SAST_DIFF_ENDPOINT = 'sast.json';
const PIPELINE_JOBS_ENDPOINT = 'jobs.json';
const SECRET_SCANNING_DIFF_ENDPOINT = 'secret_detection.json';
const SECRET_DETECTION_DIFF_ENDPOINT = 'secret_detection.json';
const COVERAGE_FUZZING_DIFF_ENDPOINT = 'coverage_fuzzing.json';
describe('Grouped security reports app', () => {
......@@ -118,7 +118,7 @@ describe('Grouped security reports app', () => {
gl.mrWidgetData.dependency_scanning_comparison_path = DEPENDENCY_SCANNING_DIFF_ENDPOINT;
gl.mrWidgetData.dast_comparison_path = DAST_DIFF_ENDPOINT;
gl.mrWidgetData.sast_comparison_path = SAST_DIFF_ENDPOINT;
gl.mrWidgetData.secret_scanning_comparison_path = SECRET_SCANNING_DIFF_ENDPOINT;
gl.mrWidgetData.secret_scanning_comparison_path = SECRET_DETECTION_DIFF_ENDPOINT;
gl.mrWidgetData.coverage_fuzzing_comparison_path = COVERAGE_FUZZING_DIFF_ENDPOINT;
});
......@@ -128,7 +128,7 @@ describe('Grouped security reports app', () => {
mock.onGet(DEPENDENCY_SCANNING_DIFF_ENDPOINT).reply(500);
mock.onGet(DAST_DIFF_ENDPOINT).reply(500);
mock.onGet(SAST_DIFF_ENDPOINT).reply(500);
mock.onGet(SECRET_SCANNING_DIFF_ENDPOINT).reply(500);
mock.onGet(SECRET_DETECTION_DIFF_ENDPOINT).reply(500);
mock.onGet(COVERAGE_FUZZING_DIFF_ENDPOINT).reply(500);
createWrapper(allReportProps);
......@@ -140,7 +140,7 @@ describe('Grouped security reports app', () => {
waitForMutation(wrapper.vm.$store, types.RECEIVE_DEPENDENCY_SCANNING_DIFF_ERROR),
waitForMutation(
wrapper.vm.$store,
`secretScanning/${secretScanningTypes.RECEIVE_DIFF_ERROR}`,
`secretDetection/${secretDetectionTypes.RECEIVE_DIFF_ERROR}`,
),
waitForMutation(wrapper.vm.$store, types.RECEIVE_COVERAGE_FUZZING_DIFF_ERROR),
]);
......@@ -183,7 +183,7 @@ describe('Grouped security reports app', () => {
mock.onGet(DEPENDENCY_SCANNING_DIFF_ENDPOINT).reply(200, {});
mock.onGet(DAST_DIFF_ENDPOINT).reply(200, {});
mock.onGet(SAST_DIFF_ENDPOINT).reply(200, {});
mock.onGet(SECRET_SCANNING_DIFF_ENDPOINT).reply(200, {});
mock.onGet(SECRET_DETECTION_DIFF_ENDPOINT).reply(200, {});
mock.onGet(COVERAGE_FUZZING_DIFF_ENDPOINT).reply(200, {});
createWrapper(allReportProps);
......@@ -216,7 +216,7 @@ describe('Grouped security reports app', () => {
mock.onGet(DEPENDENCY_SCANNING_DIFF_ENDPOINT).reply(200, emptyResponse);
mock.onGet(DAST_DIFF_ENDPOINT).reply(200, emptyResponse);
mock.onGet(SAST_DIFF_ENDPOINT).reply(200, emptyResponse);
mock.onGet(SECRET_SCANNING_DIFF_ENDPOINT).reply(200, emptyResponse);
mock.onGet(SECRET_DETECTION_DIFF_ENDPOINT).reply(200, emptyResponse);
mock.onGet(COVERAGE_FUZZING_DIFF_ENDPOINT).reply(200, emptyResponse);
createWrapper(allReportProps);
......@@ -228,7 +228,7 @@ describe('Grouped security reports app', () => {
waitForMutation(wrapper.vm.$store, types.RECEIVE_DEPENDENCY_SCANNING_DIFF_SUCCESS),
waitForMutation(
wrapper.vm.$store,
`secretScanning/${secretScanningTypes.RECEIVE_DIFF_SUCCESS}`,
`secretDetection/${secretDetectionTypes.RECEIVE_DIFF_SUCCESS}`,
),
waitForMutation(wrapper.vm.$store, types.RECEIVE_COVERAGE_FUZZING_DIFF_SUCCESS),
]);
......@@ -269,7 +269,7 @@ describe('Grouped security reports app', () => {
mock.onGet(DEPENDENCY_SCANNING_DIFF_ENDPOINT).reply(200, dependencyScanningDiffSuccessMock);
mock.onGet(DAST_DIFF_ENDPOINT).reply(200, dastDiffSuccessMock);
mock.onGet(SAST_DIFF_ENDPOINT).reply(200, sastDiffSuccessMock);
mock.onGet(SECRET_SCANNING_DIFF_ENDPOINT).reply(200, secretScanningDiffSuccessMock);
mock.onGet(SECRET_DETECTION_DIFF_ENDPOINT).reply(200, secretScanningDiffSuccessMock);
mock.onGet(COVERAGE_FUZZING_DIFF_ENDPOINT).reply(200, coverageFuzzingDiffSuccessMock);
createWrapper(allReportProps);
......@@ -281,7 +281,7 @@ describe('Grouped security reports app', () => {
waitForMutation(wrapper.vm.$store, types.RECEIVE_DEPENDENCY_SCANNING_DIFF_SUCCESS),
waitForMutation(
wrapper.vm.$store,
`secretScanning/${secretScanningTypes.RECEIVE_DIFF_SUCCESS}`,
`secretDetection/${secretDetectionTypes.RECEIVE_DIFF_SUCCESS}`,
),
waitForMutation(wrapper.vm.$store, types.RECEIVE_COVERAGE_FUZZING_DIFF_SUCCESS),
]);
......@@ -563,9 +563,9 @@ describe('Grouped security reports app', () => {
describe('secret scanning reports', () => {
const initSecretScan = (isEnabled = true) => {
gl.mrWidgetData = gl.mrWidgetData || {};
gl.mrWidgetData.secret_scanning_comparison_path = SECRET_SCANNING_DIFF_ENDPOINT;
gl.mrWidgetData.secret_scanning_comparison_path = SECRET_DETECTION_DIFF_ENDPOINT;
mock.onGet(SECRET_SCANNING_DIFF_ENDPOINT).reply(200, secretScanningDiffSuccessMock);
mock.onGet(SECRET_DETECTION_DIFF_ENDPOINT).reply(200, secretScanningDiffSuccessMock);
createWrapper({
...props,
......@@ -576,7 +576,7 @@ describe('Grouped security reports app', () => {
return waitForMutation(
wrapper.vm.$store,
`secretScanning/${secretScanningTypes.RECEIVE_DIFF_SUCCESS}`,
`secretDetection/${secretDetectionTypes.RECEIVE_DIFF_SUCCESS}`,
);
};
......@@ -589,8 +589,10 @@ describe('Grouped security reports app', () => {
expect(wrapper.find('[data-qa-selector="secret_scan_report"]').exists()).toBe(true);
});
it('should set setDiffEndpoint', () => {
expect(wrapper.vm.secretScanning.paths.diffEndpoint).toEqual(SECRET_SCANNING_DIFF_ENDPOINT);
it('should set diffEndpoint', () => {
expect(wrapper.vm.secretDetection.paths.diffEndpoint).toEqual(
SECRET_DETECTION_DIFF_ENDPOINT,
);
});
it('should display the correct numbers of vulnerabilities', () => {
......
......@@ -38,7 +38,7 @@ describe('Security reports getters', () => {
beforeEach(() => {
state = createState();
state.sast = createSastState();
state.secretScanning = createSecretScanningState();
state.secretDetection = createSecretScanningState();
});
describe.each`
......@@ -220,7 +220,7 @@ describe('Security reports getters', () => {
state.dast.hasError = true;
state.containerScanning.hasError = true;
state.dependencyScanning.hasError = true;
state.secretScanning.hasError = true;
state.secretDetection.hasError = true;
state.coverageFuzzing.hasError = true;
expect(allReportsHaveError(state)).toEqual(true);
......@@ -234,7 +234,7 @@ describe('Security reports getters', () => {
state.dast.hasError = false;
state.containerScanning.hasError = true;
state.dependencyScanning.hasError = true;
state.secretScanning.hasError = true;
state.secretDetection.hasError = true;
expect(allReportsHaveError(state)).toEqual(false);
});
......
......@@ -7,24 +7,24 @@ const createReport = (config = {}) => ({
...config,
});
describe('groupedSecretScanningText', () => {
describe('groupedSecretDetectionText', () => {
it("should return the error message if there's an error", () => {
const report = createReport({ hasError: true });
const result = getters.groupedSecretScanningText(report);
const result = getters.groupedSecretDetectionText(report);
expect(result).toStrictEqual({ message: messages.SECRET_SCANNING_HAS_ERROR });
});
it("should return the loading message if it's still loading", () => {
const report = createReport({ isLoading: true });
const result = getters.groupedSecretScanningText(report);
const result = getters.groupedSecretDetectionText(report);
expect(result).toStrictEqual({ message: messages.SECRET_SCANNING_IS_LOADING });
});
it('should call groupedTextBuilder if everything is fine', () => {
const report = createReport();
const result = getters.groupedSecretScanningText(report);
const result = getters.groupedSecretDetectionText(report);
expect(result).toStrictEqual({
countMessage: '',
......@@ -38,24 +38,24 @@ describe('groupedSecretScanningText', () => {
});
});
describe('secretScanningStatusIcon', () => {
describe('secretDetectionStatusIcon', () => {
it("should return `loading` when we're still loading", () => {
const report = createReport({ isLoading: true });
const result = getters.secretScanningStatusIcon(report);
const result = getters.secretDetectionStatusIcon(report);
expect(result).toBe('loading');
});
it("should return `warning` when there's an issue", () => {
const report = createReport({ hasError: true });
const result = getters.secretScanningStatusIcon(report);
const result = getters.secretDetectionStatusIcon(report);
expect(result).toBe('warning');
});
it('should return `success` when nothing is wrong', () => {
const report = createReport();
const result = getters.secretScanningStatusIcon(report);
const result = getters.secretDetectionStatusIcon(report);
expect(result).toBe('success');
});
......
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