debian-mirror-gitlab/app/assets/javascripts/security_configuration/components/constants.js

260 lines
9.3 KiB
JavaScript
Raw Normal View History

2021-03-11 19:13:27 +05:30
import { helpPagePath } from '~/helpers/help_page_helper';
2021-04-17 20:07:23 +05:30
import { __, s__ } from '~/locale';
2021-03-11 19:13:27 +05:30
import {
REPORT_TYPE_SAST,
REPORT_TYPE_DAST,
2021-04-17 20:07:23 +05:30
REPORT_TYPE_DAST_PROFILES,
2021-03-11 19:13:27 +05:30
REPORT_TYPE_SECRET_DETECTION,
REPORT_TYPE_DEPENDENCY_SCANNING,
REPORT_TYPE_CONTAINER_SCANNING,
2021-09-30 23:02:18 +05:30
REPORT_TYPE_CLUSTER_IMAGE_SCANNING,
2021-03-11 19:13:27 +05:30
REPORT_TYPE_COVERAGE_FUZZING,
2021-11-11 11:23:49 +05:30
REPORT_TYPE_CORPUS_MANAGEMENT,
2021-04-17 20:07:23 +05:30
REPORT_TYPE_API_FUZZING,
2021-03-11 19:13:27 +05:30
REPORT_TYPE_LICENSE_COMPLIANCE,
} from '~/vue_shared/security_reports/constants';
2021-09-30 23:02:18 +05:30
import configureSastMutation from '../graphql/configure_sast.mutation.graphql';
import configureSecretDetectionMutation from '../graphql/configure_secret_detection.mutation.graphql';
2021-03-11 19:13:27 +05:30
/**
2021-10-27 15:23:28 +05:30
* Translations & helpPagePaths for Security Configuration Page
2021-03-11 19:13:27 +05:30
*/
2021-10-27 15:23:28 +05:30
2021-04-17 20:07:23 +05:30
export const SAST_NAME = __('Static Application Security Testing (SAST)');
2021-09-04 01:27:46 +05:30
export const SAST_SHORT_NAME = s__('ciReport|SAST');
2021-04-17 20:07:23 +05:30
export const SAST_DESCRIPTION = __('Analyze your source code for known vulnerabilities.');
2021-03-11 19:13:27 +05:30
export const SAST_HELP_PATH = helpPagePath('user/application_security/sast/index');
2021-09-04 01:27:46 +05:30
export const SAST_CONFIG_HELP_PATH = helpPagePath('user/application_security/sast/index', {
anchor: 'configuration',
});
2021-03-11 19:13:27 +05:30
2021-04-17 20:07:23 +05:30
export const DAST_NAME = __('Dynamic Application Security Testing (DAST)');
2021-09-04 01:27:46 +05:30
export const DAST_SHORT_NAME = s__('ciReport|DAST');
2021-04-17 20:07:23 +05:30
export const DAST_DESCRIPTION = __('Analyze a review version of your web application.');
2021-03-11 19:13:27 +05:30
export const DAST_HELP_PATH = helpPagePath('user/application_security/dast/index');
2021-09-04 01:27:46 +05:30
export const DAST_CONFIG_HELP_PATH = helpPagePath('user/application_security/dast/index', {
anchor: 'enable-dast',
});
2021-03-11 19:13:27 +05:30
2021-04-17 20:07:23 +05:30
export const DAST_PROFILES_NAME = __('DAST Scans');
2021-09-30 23:02:18 +05:30
export const DAST_PROFILES_DESCRIPTION = s__(
'SecurityConfiguration|Manage profiles for use by DAST scans.',
2021-04-17 20:07:23 +05:30
);
export const DAST_PROFILES_HELP_PATH = helpPagePath('user/application_security/dast/index');
2021-09-04 01:27:46 +05:30
export const DAST_PROFILES_CONFIG_TEXT = s__('SecurityConfiguration|Manage scans');
2021-04-17 20:07:23 +05:30
export const SECRET_DETECTION_NAME = __('Secret Detection');
export const SECRET_DETECTION_DESCRIPTION = __(
2021-03-11 19:13:27 +05:30
'Analyze your source code and git history for secrets.',
);
export const SECRET_DETECTION_HELP_PATH = helpPagePath(
'user/application_security/secret_detection/index',
);
2021-09-04 01:27:46 +05:30
export const SECRET_DETECTION_CONFIG_HELP_PATH = helpPagePath(
'user/application_security/secret_detection/index',
{ anchor: 'configuration' },
);
2021-03-11 19:13:27 +05:30
2021-04-17 20:07:23 +05:30
export const DEPENDENCY_SCANNING_NAME = __('Dependency Scanning');
export const DEPENDENCY_SCANNING_DESCRIPTION = __(
2021-03-11 19:13:27 +05:30
'Analyze your dependencies for known vulnerabilities.',
);
export const DEPENDENCY_SCANNING_HELP_PATH = helpPagePath(
'user/application_security/dependency_scanning/index',
);
2021-09-04 01:27:46 +05:30
export const DEPENDENCY_SCANNING_CONFIG_HELP_PATH = helpPagePath(
'user/application_security/dependency_scanning/index',
{ anchor: 'configuration' },
);
2021-03-11 19:13:27 +05:30
2021-04-17 20:07:23 +05:30
export const CONTAINER_SCANNING_NAME = __('Container Scanning');
export const CONTAINER_SCANNING_DESCRIPTION = __(
2021-03-11 19:13:27 +05:30
'Check your Docker images for known vulnerabilities.',
);
export const CONTAINER_SCANNING_HELP_PATH = helpPagePath(
'user/application_security/container_scanning/index',
);
2021-09-04 01:27:46 +05:30
export const CONTAINER_SCANNING_CONFIG_HELP_PATH = helpPagePath(
'user/application_security/container_scanning/index',
{ anchor: 'configuration' },
);
2021-03-11 19:13:27 +05:30
2021-09-30 23:02:18 +05:30
export const CLUSTER_IMAGE_SCANNING_NAME = s__('ciReport|Cluster Image Scanning');
export const CLUSTER_IMAGE_SCANNING_DESCRIPTION = __(
'Check your Kubernetes cluster images for known vulnerabilities.',
);
export const CLUSTER_IMAGE_SCANNING_HELP_PATH = helpPagePath(
'user/application_security/cluster_image_scanning/index',
);
export const CLUSTER_IMAGE_SCANNING_CONFIG_HELP_PATH = helpPagePath(
'user/application_security/cluster_image_scanning/index',
{ anchor: 'configuration' },
);
2021-04-17 20:07:23 +05:30
export const COVERAGE_FUZZING_NAME = __('Coverage Fuzzing');
export const COVERAGE_FUZZING_DESCRIPTION = __(
2021-03-11 19:13:27 +05:30
'Find bugs in your code with coverage-guided fuzzing.',
);
export const COVERAGE_FUZZING_HELP_PATH = helpPagePath(
'user/application_security/coverage_fuzzing/index',
);
2021-10-27 15:23:28 +05:30
export const COVERAGE_FUZZING_CONFIG_HELP_PATH = helpPagePath(
'user/application_security/coverage_fuzzing/index',
{ anchor: 'configuration' },
);
2021-03-11 19:13:27 +05:30
2021-11-11 11:23:49 +05:30
export const CORPUS_MANAGEMENT_NAME = __('Corpus Management');
export const CORPUS_MANAGEMENT_DESCRIPTION = s__(
'SecurityConfiguration|Manage corpus files used as mutation sources in coverage fuzzing.',
);
export const CORPUS_MANAGEMENT_CONFIG_TEXT = s__('SecurityConfiguration|Manage corpus');
2021-04-17 20:07:23 +05:30
export const API_FUZZING_NAME = __('API Fuzzing');
export const API_FUZZING_DESCRIPTION = __('Find bugs in your code with API fuzzing.');
export const API_FUZZING_HELP_PATH = helpPagePath('user/application_security/api_fuzzing/index');
export const LICENSE_COMPLIANCE_NAME = __('License Compliance');
export const LICENSE_COMPLIANCE_DESCRIPTION = __(
2021-03-11 19:13:27 +05:30
'Search your project dependencies for their licenses and apply policies.',
);
export const LICENSE_COMPLIANCE_HELP_PATH = helpPagePath(
'user/compliance/license_compliance/index',
);
2021-09-04 01:27:46 +05:30
export const securityFeatures = [
{
name: SAST_NAME,
shortName: SAST_SHORT_NAME,
description: SAST_DESCRIPTION,
helpPath: SAST_HELP_PATH,
configurationHelpPath: SAST_CONFIG_HELP_PATH,
type: REPORT_TYPE_SAST,
// This field is currently hardcoded because SAST is always available.
// It will eventually come from the Backend, the progress is tracked in
// https://gitlab.com/gitlab-org/gitlab/-/issues/331622
available: true,
// This field is currently hardcoded because SAST can always be enabled via MR
// It will eventually come from the Backend, the progress is tracked in
// https://gitlab.com/gitlab-org/gitlab/-/issues/331621
canEnableByMergeRequest: true,
},
{
name: DAST_NAME,
shortName: DAST_SHORT_NAME,
description: DAST_DESCRIPTION,
helpPath: DAST_HELP_PATH,
configurationHelpPath: DAST_CONFIG_HELP_PATH,
type: REPORT_TYPE_DAST,
secondary: {
type: REPORT_TYPE_DAST_PROFILES,
name: DAST_PROFILES_NAME,
description: DAST_PROFILES_DESCRIPTION,
configurationText: DAST_PROFILES_CONFIG_TEXT,
},
},
{
name: DEPENDENCY_SCANNING_NAME,
description: DEPENDENCY_SCANNING_DESCRIPTION,
helpPath: DEPENDENCY_SCANNING_HELP_PATH,
configurationHelpPath: DEPENDENCY_SCANNING_CONFIG_HELP_PATH,
type: REPORT_TYPE_DEPENDENCY_SCANNING,
2021-09-30 23:02:18 +05:30
// This field will eventually come from the backend, the progress is
// tracked in https://gitlab.com/gitlab-org/gitlab/-/issues/331621
2021-10-27 15:23:28 +05:30
canEnableByMergeRequest: true,
2021-09-04 01:27:46 +05:30
},
{
name: CONTAINER_SCANNING_NAME,
description: CONTAINER_SCANNING_DESCRIPTION,
helpPath: CONTAINER_SCANNING_HELP_PATH,
configurationHelpPath: CONTAINER_SCANNING_CONFIG_HELP_PATH,
type: REPORT_TYPE_CONTAINER_SCANNING,
},
2021-09-30 23:02:18 +05:30
{
name: CLUSTER_IMAGE_SCANNING_NAME,
description: CLUSTER_IMAGE_SCANNING_DESCRIPTION,
helpPath: CLUSTER_IMAGE_SCANNING_HELP_PATH,
configurationHelpPath: CLUSTER_IMAGE_SCANNING_CONFIG_HELP_PATH,
type: REPORT_TYPE_CLUSTER_IMAGE_SCANNING,
},
2021-09-04 01:27:46 +05:30
{
name: SECRET_DETECTION_NAME,
description: SECRET_DETECTION_DESCRIPTION,
helpPath: SECRET_DETECTION_HELP_PATH,
configurationHelpPath: SECRET_DETECTION_CONFIG_HELP_PATH,
type: REPORT_TYPE_SECRET_DETECTION,
2021-09-30 23:02:18 +05:30
// This field is currently hardcoded because Secret Detection is always
// available. It will eventually come from the Backend, the progress is
// tracked in https://gitlab.com/gitlab-org/gitlab/-/issues/333113
2021-09-04 01:27:46 +05:30
available: true,
2021-09-30 23:02:18 +05:30
// This field is currently hardcoded because SAST can always be enabled via MR
// It will eventually come from the Backend, the progress is tracked in
// https://gitlab.com/gitlab-org/gitlab/-/issues/331621
canEnableByMergeRequest: true,
2021-09-04 01:27:46 +05:30
},
{
name: API_FUZZING_NAME,
description: API_FUZZING_DESCRIPTION,
helpPath: API_FUZZING_HELP_PATH,
type: REPORT_TYPE_API_FUZZING,
},
{
name: COVERAGE_FUZZING_NAME,
description: COVERAGE_FUZZING_DESCRIPTION,
helpPath: COVERAGE_FUZZING_HELP_PATH,
2021-10-27 15:23:28 +05:30
configurationHelpPath: COVERAGE_FUZZING_CONFIG_HELP_PATH,
2021-09-04 01:27:46 +05:30
type: REPORT_TYPE_COVERAGE_FUZZING,
2021-11-11 11:23:49 +05:30
secondary: gon?.features?.corpusManagement
? {
type: REPORT_TYPE_CORPUS_MANAGEMENT,
name: CORPUS_MANAGEMENT_NAME,
description: CORPUS_MANAGEMENT_DESCRIPTION,
configurationText: CORPUS_MANAGEMENT_CONFIG_TEXT,
}
: {},
2021-09-04 01:27:46 +05:30
},
];
export const complianceFeatures = [
{
name: LICENSE_COMPLIANCE_NAME,
description: LICENSE_COMPLIANCE_DESCRIPTION,
helpPath: LICENSE_COMPLIANCE_HELP_PATH,
type: REPORT_TYPE_LICENSE_COMPLIANCE,
},
];
2021-06-08 01:23:25 +05:30
export const featureToMutationMap = {
[REPORT_TYPE_SAST]: {
mutationId: 'configureSast',
getMutationPayload: (projectPath) => ({
mutation: configureSastMutation,
variables: {
input: {
projectPath,
configuration: { global: [], pipeline: [], analyzers: [] },
},
},
}),
},
2021-09-30 23:02:18 +05:30
[REPORT_TYPE_SECRET_DETECTION]: {
mutationId: 'configureSecretDetection',
getMutationPayload: (projectPath) => ({
mutation: configureSecretDetectionMutation,
variables: {
input: {
projectPath,
},
},
}),
},
2021-06-08 01:23:25 +05:30
};
2021-10-27 15:23:28 +05:30
export const AUTO_DEVOPS_ENABLED_ALERT_DISMISSED_STORAGE_KEY =
'security_configuration_auto_devops_enabled_dismissed_projects';