Commit eecc0d19 authored by Miguel Rincon's avatar Miguel Rincon

Merge branch 'jnnkl-secret-detection-refactoring' into 'master'

Refactor the usage of Secret Scanning to Secret Detection

See merge request gitlab-org/gitlab!71824
parents 339c68b4 bbf11b1b
......@@ -289,7 +289,7 @@ export default class MergeRequestStore {
// Security reports
this.sastComparisonPath = data.sast_comparison_path;
this.secretScanningComparisonPath = data.secret_scanning_comparison_path;
this.secretDetectionComparisonPath = data.secret_detection_comparison_path;
}
get isNothingToMergeState() {
......
......@@ -50,7 +50,7 @@ export default {
required: false,
default: '',
},
secretScanningComparisonPath: {
secretDetectionComparisonPath: {
type: String,
required: false,
default: '',
......@@ -149,8 +149,8 @@ export default {
this.canShowCounts = true;
}
if (this.secretScanningComparisonPath && this.hasSecretDetectionReports) {
this.setSecretDetectionDiffEndpoint(this.secretScanningComparisonPath);
if (this.secretDetectionComparisonPath && this.hasSecretDetectionReports) {
this.setSecretDetectionDiffEndpoint(this.secretDetectionComparisonPath);
this.fetchSecretDetectionDiff();
this.canShowCounts = true;
}
......
......@@ -325,7 +325,7 @@ Note the following:
- For a secret detection scan, only rules with the default ruleset are supported. [Custom rulesets](../secret_detection/index.md#custom-rulesets)
are not supported.
- A secret detection scan runs in `normal` mode when executed as part of a pipeline, and in
[`historic`](../secret_detection/index.md#full-history-secret-scan)
[`historic`](../secret_detection/index.md#full-history-secret-detection)
mode when executed as part of a scheduled scan.
- A container scanning and cluster image scanning scans configured for the `pipeline` rule type will ignore the cluster defined in the `clusters` object.
They will use predefined CI/CD variables defined for your project. Cluster selection with the `clusters` object is supported for the `schedule` rule type.
......
......@@ -285,20 +285,20 @@ sequenceDiagram
Cloud Vendor-->>+RevocationAPI: ACCEPTED
```
## Full History Secret Scan
## Full History Secret Detection
GitLab 12.11 introduced support for scanning the full history of a repository. This new functionality
is particularly useful when you are enabling Secret Detection in a repository for the first time and you
want to perform a full secret scan. Running a secret scan on the full history can take a long time,
want to perform a full secret detection scan. Running a secret detection scan on the full history can take a long time,
especially for larger repositories with lengthy Git histories. We recommend not setting this CI/CD variable
as part of your normal job definition.
A new configuration variable ([`SECRET_DETECTION_HISTORIC_SCAN`](#available-cicd-variables))
can be set to change the behavior of the GitLab Secret Detection scan to run on the entire Git history of a repository.
We have created a [short video walkthrough](https://youtu.be/wDtc_K00Y0A) showcasing how you can perform a full history secret scan.
We have created a [short video walkthrough](https://youtu.be/wDtc_K00Y0A) showcasing how you can perform a full history secret detection scan.
<div class="video-fallback">
See the video: <a href="https://www.youtube.com/watch?v=wDtc_K00Y0A">Walkthrough of historical secret scan</a>.
See the video: <a href="https://www.youtube.com/watch?v=wDtc_K00Y0A">Walkthrough of historical secret detection scan</a>.
</div>
<figure class="video-container">
<iframe src="https://www.youtube.com/embed/wDtc_K00Y0A" frameborder="0" allowfullscreen="true"> </iframe>
......
......@@ -363,7 +363,7 @@ export default {
:project-id="mr.sourceProjectId"
:security-reports-docs-path="mr.securityReportsDocsPath"
:sast-comparison-path="mr.sastComparisonPath"
:secret-scanning-comparison-path="mr.secretScanningComparisonPath"
:secret-detection-comparison-path="mr.secretDetectionComparisonPath"
:target-project-full-path="mr.targetProjectFullPath"
:mr-iid="mr.iid"
:discover-project-security-path="mr.discoverProjectSecurityPath"
......@@ -381,7 +381,7 @@ export default {
:coverage-fuzzing-help-path="mr.coverageFuzzingHelp"
:container-scanning-help-path="mr.containerScanningHelp"
:dependency-scanning-help-path="mr.dependencyScanningHelp"
:secret-scanning-help-path="mr.secretScanningHelp"
:secret-detection-help-path="mr.secretDetectionHelp"
:can-read-vulnerability-feedback="mr.canReadVulnerabilityFeedback"
:vulnerability-feedback-path="mr.vulnerabilityFeedbackPath"
:create-vulnerability-feedback-issue-path="mr.createVulnerabilityFeedbackIssuePath"
......@@ -404,7 +404,7 @@ export default {
:dast-comparison-path="mr.dastComparisonPath"
:dependency-scanning-comparison-path="mr.dependencyScanningComparisonPath"
:sast-comparison-path="mr.sastComparisonPath"
:secret-scanning-comparison-path="mr.secretScanningComparisonPath"
:secret-detection-comparison-path="mr.secretDetectionComparisonPath"
:target-project-full-path="mr.targetProjectFullPath"
:mr-iid="mr.iid"
class="js-security-widget"
......
......@@ -12,7 +12,7 @@ export default class MergeRequestStore extends CEMergeRequestStore {
this.dastHelp = data.dast_help_path;
this.apiFuzzingHelp = data.api_fuzzing_help_path;
this.coverageFuzzingHelp = data.coverage_fuzzing_help_path;
this.secretScanningHelp = data.secret_scanning_help_path;
this.secretDetectionHelp = data.secret_detection_help_path;
this.dependencyScanningHelp = data.dependency_scanning_help_path;
this.canReadVulnerabilities = data.can_read_vulnerabilities;
this.vulnerabilityFeedbackPath = data.vulnerability_feedback_path;
......
<script>
/**
* Renders Security Issues (SAST, DAST, Container
* Scanning, Secret Scanning) body text
* Scanning, Secret Detection) body text
* [severity-badge] [name] in [link]:[line]
*/
import { GlBadge } from '@gitlab/ui';
......
<script>
import { mapActions, mapState, mapGetters } from 'vuex';
import { once } from 'lodash';
import {
GlButton,
GlSprintf,
......@@ -6,8 +8,6 @@ import {
GlModalDirective,
GlTooltipDirective as GlTooltip,
} from '@gitlab/ui';
import { once } from 'lodash';
import { mapActions, mapState, mapGetters } from 'vuex';
import { componentNames } from 'ee/reports/components/issue_body';
import { fetchPolicies } from '~/lib/graphql';
import { mrStates } from '~/mr_popover/constants';
......@@ -126,7 +126,7 @@ export default {
required: false,
default: '',
},
secretScanningHelpPath: {
secretDetectionHelpPath: {
type: String,
required: false,
default: '',
......@@ -230,7 +230,7 @@ export default {
required: false,
default: '',
},
secretScanningComparisonPath: {
secretDetectionComparisonPath: {
type: String,
required: false,
default: '',
......@@ -386,8 +386,8 @@ export default {
this.fetchDependencyScanningDiff();
}
if (this.secretScanningComparisonPath && this.hasSecretDetectionReports) {
this.setSecretDetectionDiffEndpoint(this.secretScanningComparisonPath);
if (this.secretDetectionComparisonPath && this.hasSecretDetectionReports) {
this.setSecretDetectionDiffEndpoint(this.secretDetectionComparisonPath);
this.fetchSecretDetectionDiff();
}
......@@ -640,9 +640,9 @@ export default {
<summary-row
:nested-summary="true"
:status-icon="secretDetectionStatusIcon"
:popover-options="secretScanningPopover"
class="js-secret-scanning"
data-testid="secret-scan-report"
:popover-options="secretDetectionPopover"
class="js-secret-detection"
data-testid="secret-detection-report"
>
<template #summary>
<security-summary :message="groupedSecretDetectionText" />
......@@ -655,7 +655,7 @@ export default {
:unresolved-issues="secretDetection.newIssues"
:resolved-issues="secretDetection.resolvedIssues"
:component="$options.componentNames.SecurityIssueBody"
data-testid="secret-scanning-issues-list"
data-testid="secret-detection-issues-list"
/>
</template>
......
......@@ -71,15 +71,15 @@ export default {
),
};
},
secretScanningPopover() {
secretDetectionPopover() {
return {
title: s__(
'ciReport|Secret scanning detects secrets and credentials vulnerabilities in your source code.',
'ciReport|Secret Detection detects secrets and credentials vulnerabilities in your source code.',
),
content: sprintf(
s__('ciReport|%{linkStartTag}Learn more about Secret Detection %{linkEndTag}'),
{
linkStartTag: getLinkStartTag(this.secretScanningHelpPath),
linkStartTag: getLinkStartTag(this.secretDetectionHelpPath),
linkEndTag,
},
false,
......
......@@ -8,7 +8,7 @@ const SAST = s__('ciReport|SAST');
const DAST = s__('ciReport|DAST');
const CONTAINER_SCANNING = s__('ciReport|Container scanning');
const DEPENDENCY_SCANNING = s__('ciReport|Dependency scanning');
const SECRET_SCANNING = s__('ciReport|Secret scanning');
const SECRET_DETECTION = s__('ciReport|Secret detection');
const COVERAGE_FUZZING = s__('ciReport|Coverage fuzzing');
const API_FUZZING = s__('ciReport|API fuzzing');
......@@ -17,7 +17,7 @@ export default {
DAST,
CONTAINER_SCANNING,
DEPENDENCY_SCANNING,
SECRET_SCANNING,
SECRET_DETECTION,
COVERAGE_FUZZING,
API_FUZZING,
TRANSLATION_IS_LOADING,
......@@ -36,10 +36,10 @@ export default {
DEPENDENCY_SCANNING_HAS_ERROR: sprintf(TRANSLATION_HAS_ERROR, {
reportType: DEPENDENCY_SCANNING,
}),
SECRET_SCANNING_IS_LOADING: sprintf(TRANSLATION_IS_LOADING, {
reportType: SECRET_SCANNING,
SECRET_DETECTION_IS_LOADING: sprintf(TRANSLATION_IS_LOADING, {
reportType: SECRET_DETECTION,
}),
SECRET_SCANNING_HAS_ERROR: sprintf(TRANSLATION_HAS_ERROR, { reportType: SECRET_SCANNING }),
SECRET_DETECTION_HAS_ERROR: sprintf(TRANSLATION_HAS_ERROR, { reportType: SECRET_DETECTION }),
COVERAGE_FUZZING_IS_LOADING: sprintf(TRANSLATION_IS_LOADING, {
reportType: COVERAGE_FUZZING,
}),
......
......@@ -4,9 +4,9 @@ import { statusIcon, groupedReportText } from '../../utils';
export const groupedSecretDetectionText = (state) =>
groupedReportText(
state,
messages.SECRET_SCANNING,
messages.SECRET_SCANNING_HAS_ERROR,
messages.SECRET_SCANNING_IS_LOADING,
messages.SECRET_DETECTION,
messages.SECRET_DETECTION_HAS_ERROR,
messages.SECRET_DETECTION_IS_LOADING,
);
export const secretDetectionStatusIcon = ({ isLoading, hasError, newIssues }) =>
......
......@@ -7,7 +7,7 @@
window.gl.mrWidgetData.is_geo_secondary_node = '#{Gitlab::Geo.secondary?}' === 'true';
window.gl.mrWidgetData.geo_secondary_help_path = '#{help_page_path("administration/geo/replication/configuration.md")}';
window.gl.mrWidgetData.sast_help_path = '#{help_page_path("user/application_security/sast/index")}';
window.gl.mrWidgetData.secret_scanning_help_path = '#{help_page_path("user/application_security/secret_detection/index")}';
window.gl.mrWidgetData.secret_detection_help_path = '#{help_page_path("user/application_security/secret_detection/index")}';
window.gl.mrWidgetData.container_scanning_help_path = '#{help_page_path("user/application_security/container_scanning/index")}';
window.gl.mrWidgetData.dast_help_path = '#{help_page_path("user/application_security/dast/index")}';
window.gl.mrWidgetData.dependency_scanning_help_path = '#{help_page_path("user/application_security/dependency_scanning/index")}';
......@@ -19,7 +19,7 @@
window.gl.mrWidgetData.dependency_scanning_comparison_path = '#{dependency_scanning_reports_project_merge_request_path(@project, @merge_request) if @project.feature_available?(:dependency_scanning)}'
window.gl.mrWidgetData.sast_comparison_path = '#{sast_reports_project_merge_request_path(@project, @merge_request) if @project.feature_available?(:sast)}'
window.gl.mrWidgetData.dast_comparison_path = '#{dast_reports_project_merge_request_path(@project, @merge_request) if @project.feature_available?(:dast)}'
window.gl.mrWidgetData.secret_scanning_comparison_path = '#{secret_detection_reports_project_merge_request_path(@project, @merge_request) if @project.feature_available?(:secret_detection)}'
window.gl.mrWidgetData.secret_detection_comparison_path = '#{secret_detection_reports_project_merge_request_path(@project, @merge_request) if @project.feature_available?(:secret_detection)}'
window.gl.mrWidgetData.coverage_fuzzing_comparison_path = '#{coverage_fuzzing_reports_project_merge_request_path(@project, @merge_request) if @project.feature_available?(:coverage_fuzzing)}'
window.gl.mrWidgetData.api_fuzzing_comparison_path = '#{api_fuzzing_reports_project_merge_request_path(@project, @merge_request) if @project.feature_available?(:api_fuzzing)}'
......@@ -20,7 +20,7 @@ import {
dastDiffSuccessMock,
containerScanningDiffSuccessMock,
dependencyScanningDiffSuccessMock,
secretScanningDiffSuccessMock,
secretDetectionDiffSuccessMock,
coverageFuzzingDiffSuccessMock,
apiFuzzingDiffSuccessMock,
} from 'ee_jest/vue_shared/security_reports/mock_data';
......@@ -55,7 +55,7 @@ const SAST_SELECTOR = '.js-sast-widget';
const DAST_SELECTOR = '.js-dast-widget';
const DEPENDENCY_SCANNING_SELECTOR = '.js-dependency-scanning-widget';
const CONTAINER_SCANNING_SELECTOR = '.js-container-scanning';
const SECRET_SCANNING_SELECTOR = '.js-secret-scanning';
const SECRET_DETECTION_SELECTOR = '.js-secret-detection';
const COVERAGE_FUZZING_SELECTOR = '.js-coverage-fuzzing-widget';
const API_FUZZING_SELECTOR = '.js-api-fuzzing-widget';
......@@ -836,8 +836,8 @@ describe('ee merge request widget options', () => {
});
});
describe('Secret Scanning', () => {
const SECRET_SCANNING_ENDPOINT = 'secret_detection_report';
describe('Secret Detection', () => {
const SECRET_DETECTION_ENDPOINT = 'secret_detection_report';
beforeEach(() => {
gl.mrWidgetData = {
......@@ -845,31 +845,31 @@ describe('ee merge request widget options', () => {
enabled_reports: {
secret_detection: true,
// The below property needs to exist until
// secret scanning is implemented in backend
// secret Detection is implemented in backend
// Or for some other reason I'm yet to find
dast: true,
},
secret_scanning_comparison_path: SECRET_SCANNING_ENDPOINT,
secret_detection_comparison_path: SECRET_DETECTION_ENDPOINT,
vulnerability_feedback_path: VULNERABILITY_FEEDBACK_ENDPOINT,
};
});
describe('when it is loading', () => {
it('should render loading indicator', () => {
mock.onGet(SECRET_SCANNING_ENDPOINT).reply(200, secretScanningDiffSuccessMock);
mock.onGet(SECRET_DETECTION_ENDPOINT).reply(200, secretDetectionDiffSuccessMock);
mock.onGet(VULNERABILITY_FEEDBACK_ENDPOINT).reply(200, []);
createComponent({ propsData: { mrData: gl.mrWidgetData } });
expect(
trimText(findExtendedSecurityWidget().find(SECRET_SCANNING_SELECTOR).text()),
).toContain('Secret scanning is loading');
trimText(findExtendedSecurityWidget().find(SECRET_DETECTION_SELECTOR).text()),
).toContain('Secret detection is loading');
});
});
describe('with successful request', () => {
beforeEach(() => {
mock.onGet(SECRET_SCANNING_ENDPOINT).reply(200, secretScanningDiffSuccessMock);
mock.onGet(SECRET_DETECTION_ENDPOINT).reply(200, secretDetectionDiffSuccessMock);
mock.onGet(VULNERABILITY_FEEDBACK_ENDPOINT).reply(200, []);
createComponent({ propsData: { mrData: gl.mrWidgetData } });
......@@ -880,11 +880,11 @@ describe('ee merge request widget options', () => {
expect(
trimText(
findExtendedSecurityWidget()
.find(`${SECRET_SCANNING_SELECTOR} .report-block-list-issue-description`)
.find(`${SECRET_DETECTION_SELECTOR} .report-block-list-issue-description`)
.text(),
),
).toEqual(
'Secret scanning detected 2 potential vulnerabilities 1 Critical 1 High and 0 Others',
'Secret detection detected 2 potential vulnerabilities 1 Critical 1 High and 0 Others',
);
done();
});
......@@ -893,7 +893,7 @@ describe('ee merge request widget options', () => {
describe('with failed request', () => {
beforeEach(() => {
mock.onGet(SECRET_SCANNING_ENDPOINT).reply(500, {});
mock.onGet(SECRET_DETECTION_ENDPOINT).reply(500, {});
mock.onGet(VULNERABILITY_FEEDBACK_ENDPOINT).reply(500, []);
createComponent({ propsData: { mrData: gl.mrWidgetData } });
......@@ -901,8 +901,8 @@ describe('ee merge request widget options', () => {
it('should render error indicator', (done) => {
setImmediate(() => {
expect(findExtendedSecurityWidget().find(SECRET_SCANNING_SELECTOR).text()).toContain(
'Secret scanning: Loading resulted in an error',
expect(findExtendedSecurityWidget().find(SECRET_DETECTION_SELECTOR).text()).toContain(
'Secret detection: Loading resulted in an error',
);
done();
});
......
......@@ -75,7 +75,7 @@ describe('MergeRequestStore', () => {
'dependency_scanning_comparison_path',
'sast_comparison_path',
'dast_comparison_path',
'secret_scanning_comparison_path',
'secret_detection_comparison_path',
'api_fuzzing_comparison_path',
'coverage_fuzzing_comparison_path',
])('should set %s path', (property) => {
......
......@@ -8,7 +8,7 @@ import {
sastParsedIssues,
dockerReportParsed,
parsedDast,
secretScanningParsedIssues,
secretDetectionParsedIssues,
} from 'ee_jest/vue_shared/security_reports/mock_data';
import mountComponent, { mountComponentWithStore } from 'helpers/vue_mount_component_helper';
import reportIssues from '~/reports/components/report_item.vue';
......@@ -137,10 +137,10 @@ describe('Report issues', () => {
});
});
describe('for secret scanning issues', () => {
describe('for secret Detection issues', () => {
beforeEach(() => {
vm = mountComponent(ReportIssues, {
issue: secretScanningParsedIssues[0],
issue: secretDetectionParsedIssues[0],
component: componentNames.SecurityIssueBody,
status: STATUS_FAILED,
});
......@@ -148,13 +148,13 @@ describe('Report issues', () => {
it('renders severity', () => {
expect(vm.$el.textContent.trim().toLowerCase()).toContain(
secretScanningParsedIssues[0].severity,
secretDetectionParsedIssues[0].severity,
);
});
it('renders CVE name', () => {
expect(vm.$el.querySelector('.report-block-list-issue button').textContent.trim()).toEqual(
secretScanningParsedIssues[0].title,
secretDetectionParsedIssues[0].title,
);
});
});
......
......@@ -10,7 +10,7 @@ import {
sastParsedIssues,
dockerReportParsed,
parsedDast,
secretScanningParsedIssues,
secretDetectionParsedIssues,
licenseComplianceParsedIssues,
} from 'ee_jest/vue_shared/security_reports/mock_data';
import mountComponent, { mountComponentWithStore } from 'helpers/vue_mount_component_helper';
......@@ -143,10 +143,10 @@ describe('Report issue', () => {
});
});
describe('for secret scanning issue', () => {
describe('for secret Description issue', () => {
beforeEach(() => {
vm = mountComponent(ReportIssue, {
issue: secretScanningParsedIssues[0],
issue: secretDetectionParsedIssues[0],
component: componentNames.SecurityIssueBody,
status: STATUS_FAILED,
});
......@@ -154,13 +154,13 @@ describe('Report issue', () => {
it('renders severity', () => {
expect(vm.$el.textContent.trim().toLowerCase()).toContain(
secretScanningParsedIssues[0].severity,
secretDetectionParsedIssues[0].severity,
);
});
it('renders CVE name', () => {
expect(vm.$el.querySelector('button').textContent.trim()).toEqual(
secretScanningParsedIssues[0].title,
secretDetectionParsedIssues[0].title,
);
});
});
......
......@@ -15,7 +15,7 @@ import {
dockerReportParsed,
parsedDast,
dependencyScanningIssues,
secretScanningParsedIssues,
secretDetectionParsedIssues,
} from '../mock_data';
describe('Security Issue Body', () => {
......@@ -44,7 +44,7 @@ describe('Security Issue Body', () => {
['DAST', parsedDast[0], false, LOW],
['Container Scanning', dockerReportParsed.vulnerabilities[0], false, MEDIUM],
['Dependency Scanning', dependencyScanningIssues[0], true],
['Secret Scanning', secretScanningParsedIssues[0], false, CRITICAL],
['Secret Detection', secretDetectionParsedIssues[0], false, CRITICAL],
])('for a %s vulnerability', (name, vuln, hasReportLink, severity) => {
beforeEach(() => {
createComponent(vuln);
......
......@@ -21,7 +21,7 @@ import {
dastDiffSuccessMock,
containerScanningDiffSuccessMock,
dependencyScanningDiffSuccessMock,
secretScanningDiffSuccessMock,
secretDetectionDiffSuccessMock,
coverageFuzzingDiffSuccessMock,
apiFuzzingDiffSuccessMock,
mockFindings,
......@@ -44,7 +44,7 @@ describe('Grouped security reports app', () => {
const findReportSummary = () => wrapper.find('[data-testid="report-section-code-text"]');
const findCollapseButton = () => wrapper.find('.js-collapse-btn');
const findSpinner = () => wrapper.find('.gl-spinner');
const findSecretScanReport = () => wrapper.find('[data-testid="secret-scan-report"]');
const findSecretDetectionReport = () => wrapper.find('[data-testid="secret-detection-report"]');
const findViewFullReportButton = () => wrapper.find('.report-btn');
const findDastJobLink = () => wrapper.find('[data-testid="dast-ci-job-link"]');
......@@ -55,7 +55,7 @@ describe('Grouped security reports app', () => {
containerScanningHelpPath: 'path',
dastHelpPath: 'path',
dependencyScanningHelpPath: 'path',
secretScanningHelpPath: 'path',
secretDetectionHelpPath: 'path',
canReadVulnerabilityFeedbackPath: true,
vulnerabilityFeedbackPath: 'vulnerability_feedback_path.json',
coverageFuzzingHelpPath: 'path',
......@@ -71,7 +71,7 @@ describe('Grouped security reports app', () => {
dastComparisonPath: DAST_DIFF_ENDPOINT,
dependencyScanningComparisonPath: DEPENDENCY_SCANNING_DIFF_ENDPOINT,
sastComparisonPath: SAST_DIFF_ENDPOINT,
secretScanningComparisonPath: SECRET_DETECTION_DIFF_ENDPOINT,
secretDetectionComparisonPath: SECRET_DETECTION_DIFF_ENDPOINT,
};
const defaultDastSummary = {
......@@ -180,7 +180,7 @@ describe('Grouped security reports app', () => {
expect(wrapperText).toContain('DAST: Loading resulted in an error');
expect(wrapperText).toContain('Secret scanning: Loading resulted in an error');
expect(wrapperText).toContain('Secret detection: Loading resulted in an error');
});
});
......@@ -278,7 +278,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_DETECTION_DIFF_ENDPOINT).reply(200, secretScanningDiffSuccessMock);
mock.onGet(SECRET_DETECTION_DIFF_ENDPOINT).reply(200, secretDetectionDiffSuccessMock);
mock.onGet(COVERAGE_FUZZING_DIFF_ENDPOINT).reply(200, coverageFuzzingDiffSuccessMock);
mock.onGet(API_FUZZING_DIFF_ENDPOINT).reply(200, apiFuzzingDiffSuccessMock);
......@@ -363,7 +363,7 @@ describe('Grouped security reports app', () => {
${'dependency-scanning'} | ${dependencyScanningDiffSuccessMock.fixed} | ${dependencyScanningDiffSuccessMock.added}
${'container-scanning'} | ${containerScanningDiffSuccessMock.fixed} | ${containerScanningDiffSuccessMock.added}
${'dast'} | ${dastDiffSuccessMock.fixed} | ${dastDiffSuccessMock.added}
${'secret-scanning'} | ${secretScanningDiffSuccessMock.fixed} | ${secretScanningDiffSuccessMock.added}
${'secret-detection'} | ${secretDetectionDiffSuccessMock.fixed} | ${secretDetectionDiffSuccessMock.added}
${'coverage-fuzzing'} | ${coverageFuzzingDiffSuccessMock.fixed} | ${coverageFuzzingDiffSuccessMock.added}
${'api-fuzzing'} | ${apiFuzzingDiffSuccessMock.fixed} | ${apiFuzzingDiffSuccessMock.added}
`(
......@@ -615,9 +615,9 @@ describe('Grouped security reports app', () => {
});
});
describe('secret scanning reports', () => {
const initSecretScan = (isEnabled = true) => {
mock.onGet(SECRET_DETECTION_DIFF_ENDPOINT).reply(200, secretScanningDiffSuccessMock);
describe('secret Detection reports', () => {
const initSecretDetection = (isEnabled = true) => {
mock.onGet(SECRET_DETECTION_DIFF_ENDPOINT).reply(200, secretDetectionDiffSuccessMock);
createWrapper({
...props,
......@@ -634,11 +634,11 @@ describe('Grouped security reports app', () => {
describe('enabled', () => {
beforeEach(() => {
return initSecretScan();
return initSecretDetection();
});
it('should render the component', () => {
expect(findSecretScanReport().exists()).toBe(true);
expect(findSecretDetectionReport().exists()).toBe(true);
});
it('should set diffEndpoint', () => {
......@@ -649,18 +649,18 @@ describe('Grouped security reports app', () => {
it('should display the correct numbers of vulnerabilities', () => {
expect(trimText(wrapper.text())).toContain(
'Secret scanning detected 2 potential vulnerabilities 1 Critical 1 High and 0 Others',
'Secret detection detected 2 potential vulnerabilities 1 Critical 1 High and 0 Others',
);
});
});
describe('disabled', () => {
beforeEach(() => {
initSecretScan(false);
initSecretDetection(false);
});
it('should not render the component', () => {
expect(findSecretScanReport().exists()).toBe(false);
expect(findSecretDetectionReport().exists()).toBe(false);
});
});
});
......
......@@ -216,7 +216,7 @@ export const parsedDast = [
},
];
export const secretScanningParsedIssues = [
export const secretDetectionParsedIssues = [
{
title: 'AWS SecretKey detected',
path: 'Gemfile.lock',
......
......@@ -26,7 +26,7 @@ import {
} from 'ee/vue_shared/security_reports/store/getters';
import createApiFuzzingState from 'ee/vue_shared/security_reports/store/modules/api_fuzzing/state';
import createSastState from 'ee/vue_shared/security_reports/store/modules/sast/state';
import createSecretScanningState from 'ee/vue_shared/security_reports/store/modules/secret_detection/state';
import createSecretDetectionState from 'ee/vue_shared/security_reports/store/modules/secret_detection/state';
import createState from 'ee/vue_shared/security_reports/store/state';
import { groupedTextBuilder } from 'ee/vue_shared/security_reports/store/utils';
......@@ -40,7 +40,7 @@ describe('Security reports getters', () => {
beforeEach(() => {
state = createState();
state.sast = createSastState();
state.secretDetection = createSecretScanningState();
state.secretDetection = createSecretDetectionState();
state.apiFuzzing = createApiFuzzingState();
});
......
......@@ -12,14 +12,14 @@ describe('groupedSecretDetectionText', () => {
const report = createReport({ hasError: true });
const result = getters.groupedSecretDetectionText(report);
expect(result).toStrictEqual({ message: messages.SECRET_SCANNING_HAS_ERROR });
expect(result).toStrictEqual({ message: messages.SECRET_DETECTION_HAS_ERROR });
});
it("should return the loading message if it's still loading", () => {
const report = createReport({ isLoading: true });
const result = getters.groupedSecretDetectionText(report);
expect(result).toStrictEqual({ message: messages.SECRET_SCANNING_IS_LOADING });
expect(result).toStrictEqual({ message: messages.SECRET_DETECTION_IS_LOADING });
});
it('should call groupedTextBuilder if everything is fine', () => {
......@@ -30,7 +30,7 @@ describe('groupedSecretDetectionText', () => {
countMessage: '',
critical: 0,
high: 0,
message: 'Secret scanning detected %{totalStart}no%{totalEnd} vulnerabilities.',
message: 'Secret detection detected %{totalStart}no%{totalEnd} vulnerabilities.',
other: 0,
status: '',
total: 0,
......
......@@ -40089,10 +40089,10 @@ msgstr ""
msgid "ciReport|Secret Detection"
msgstr ""
msgid "ciReport|Secret scanning"
msgid "ciReport|Secret Detection detects secrets and credentials vulnerabilities in your source code."
msgstr ""
msgid "ciReport|Secret scanning detects secrets and credentials vulnerabilities in your source code."
msgid "ciReport|Secret detection"
msgstr ""
msgid "ciReport|Security scanning"
......
......@@ -280,7 +280,7 @@ export default {
merge_train_index: 1,
security_reports_docs_path: 'security-reports-docs-path',
sast_comparison_path: '/sast_comparison_path',
secret_scanning_comparison_path: '/secret_scanning_comparison_path',
secret_detection_comparison_path: '/secret_detection_comparison_path',
gitpod_enabled: true,
show_gitpod_button: true,
gitpod_url: 'http://gitpod.localhost',
......
......@@ -162,7 +162,7 @@ describe('MergeRequestStore', () => {
expect(store.securityReportsDocsPath).toBe('security-reports-docs-path');
});
it.each(['sast_comparison_path', 'secret_scanning_comparison_path'])(
it.each(['sast_comparison_path', 'secret_detection_comparison_path'])(
'should set %s path',
(property) => {
// Ensure something is set in the mock data
......
......@@ -314,7 +314,7 @@ export const sastDiffSuccessMock = {
head_report_created_at: '2020-01-10T10:00:00.000Z',
};
export const secretScanningDiffSuccessMock = {
export const secretDetectionDiffSuccessMock = {
added: [mockFindings[0], mockFindings[1]],
fixed: [mockFindings[2]],
base_report_created_at: '2020-01-01T10:00:00.000Z',
......
......@@ -12,7 +12,7 @@ import {
securityReportMergeRequestDownloadPathsQueryNoArtifactsResponse,
securityReportMergeRequestDownloadPathsQueryResponse,
sastDiffSuccessMock,
secretScanningDiffSuccessMock,
secretDetectionDiffSuccessMock,
} from 'jest/vue_shared/security_reports/mock_data';
import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils';
......@@ -31,7 +31,7 @@ Vue.use(VueApollo);
Vue.use(Vuex);
const SAST_COMPARISON_PATH = '/sast.json';
const SECRET_SCANNING_COMPARISON_PATH = '/secret_detection.json';
const SECRET_DETECTION_COMPARISON_PATH = '/secret_detection.json';
describe('Security reports app', () => {
let wrapper;
......@@ -175,12 +175,12 @@ describe('Security reports app', () => {
const SAST_SUCCESS_MESSAGE =
'Security scanning detected 1 potential vulnerability 1 Critical 0 High and 0 Others';
const SECRET_SCANNING_SUCCESS_MESSAGE =
const SECRET_DETECTION_SUCCESS_MESSAGE =
'Security scanning detected 2 potential vulnerabilities 1 Critical 1 High and 0 Others';
describe.each`
reportType | pathProp | path | successResponse | successMessage
${REPORT_TYPE_SAST} | ${'sastComparisonPath'} | ${SAST_COMPARISON_PATH} | ${sastDiffSuccessMock} | ${SAST_SUCCESS_MESSAGE}
${REPORT_TYPE_SECRET_DETECTION} | ${'secretScanningComparisonPath'} | ${SECRET_SCANNING_COMPARISON_PATH} | ${secretScanningDiffSuccessMock} | ${SECRET_SCANNING_SUCCESS_MESSAGE}
${REPORT_TYPE_SECRET_DETECTION} | ${'secretDetectionComparisonPath'} | ${SECRET_DETECTION_COMPARISON_PATH} | ${secretDetectionDiffSuccessMock} | ${SECRET_DETECTION_SUCCESS_MESSAGE}
`(
'given a $pathProp and $reportType artifact',
({ pathProp, path, successResponse, successMessage }) => {
......
......@@ -8,7 +8,7 @@ import {
summaryCounts,
} from '~/vue_shared/security_reports/store/getters';
import createSastState from '~/vue_shared/security_reports/store/modules/sast/state';
import createSecretScanningState from '~/vue_shared/security_reports/store/modules/secret_detection/state';
import createSecretDetectionState from '~/vue_shared/security_reports/store/modules/secret_detection/state';
import createState from '~/vue_shared/security_reports/store/state';
import { groupedTextBuilder } from '~/vue_shared/security_reports/store/utils';
import { CRITICAL, HIGH, LOW } from '~/vulnerabilities/constants';
......@@ -21,7 +21,7 @@ describe('Security reports getters', () => {
beforeEach(() => {
state = createState();
state.sast = createSastState();
state.secretDetection = createSecretScanningState();
state.secretDetection = createSecretDetectionState();
});
describe('summaryCounts', () => {
......
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