From 8c438dd7a6063d7f59bce4d79cc7ca49a31a8346 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 1 Jun 2021 12:09:36 +0000 Subject: [PATCH] Add latest changes from gitlab-org/gitlab@master --- .gitlab/ci/review.gitlab-ci.yml | 10 +- .gitlab/ci/rules.gitlab-ci.yml | 29 +++++ .../components/constants.js | 98 ++++++++++++++++ .../components/redesigned_app.vue | 76 ++++++++++++ .../security_configuration/index.js | 29 ++++- .../security_configuration/utils.js | 24 ++++ .../mr_widget_options.vue | 4 +- .../security/configuration_controller.rb | 4 + app/finders/security/jobs_finder.rb | 2 +- app/views/devise/sessions/_new_base.html.haml | 2 +- app/views/devise/shared/_signup_box.html.haml | 4 +- app/views/groups/_new_group_fields.html.haml | 2 +- app/views/shared/_recaptcha_form.html.haml | 2 +- .../user_refresh_over_user_range_worker.rb | 6 +- config/feature_categories.yml | 7 +- .../security_configuration_redesign.yml | 8 ++ ...acker_data_deployment_type_based_on_url.rb | 26 +++++ ...6160133_remove_segment_selections_table.rb | 26 +++++ db/schema_migrations/20210421163509 | 1 + db/schema_migrations/20210526160133 | 1 + db/structure.sql | 39 ------- doc/administration/incoming_email.md | 8 +- .../replication_and_failover_external.md | 18 +-- .../experiment_guide/experimentation.md | 3 + doc/development/experiment_guide/index.md | 10 +- doc/development/fe_guide/graphql.md | 6 + doc/development/testing_guide/review_apps.md | 3 + ...acker_data_deployment_type_based_on_url.rb | 42 +++++++ lib/gitlab/ci/ansi2json/line.rb | 2 +- .../content_security_policy/config_loader.rb | 4 +- locale/gitlab.pot | 12 ++ .../security/security_jobs_finder_spec.rb | 6 +- .../components/redesigned_app_spec.js | 109 ++++++++++++++++++ .../security_configuration/utils_spec.js | 81 +++++++++++++ .../mutations/ci/runner/update_spec.rb | 4 +- ..._data_deployment_type_based_on_url_spec.rb | 44 +++++++ spec/lib/gitlab/ci/ansi2json/line_spec.rb | 26 ++++- .../config_loader_spec.rb | 2 +- ..._data_deployment_type_based_on_url_spec.rb | 48 ++++++++ ...ser_refresh_over_user_range_worker_spec.rb | 15 ++- 40 files changed, 753 insertions(+), 90 deletions(-) create mode 100644 app/assets/javascripts/security_configuration/components/redesigned_app.vue create mode 100644 app/assets/javascripts/security_configuration/utils.js create mode 100644 config/feature_flags/development/security_configuration_redesign.yml create mode 100644 db/post_migrate/20210421163509_schedule_update_jira_tracker_data_deployment_type_based_on_url.rb create mode 100644 db/post_migrate/20210526160133_remove_segment_selections_table.rb create mode 100644 db/schema_migrations/20210421163509 create mode 100644 db/schema_migrations/20210526160133 create mode 100644 lib/gitlab/background_migration/update_jira_tracker_data_deployment_type_based_on_url.rb create mode 100644 spec/frontend/security_configuration/components/redesigned_app_spec.js create mode 100644 spec/frontend/security_configuration/utils_spec.js create mode 100644 spec/lib/gitlab/background_migration/update_jira_tracker_data_deployment_type_based_on_url_spec.rb create mode 100644 spec/migrations/20210421163509_schedule_update_jira_tracker_data_deployment_type_based_on_url_spec.rb diff --git a/.gitlab/ci/review.gitlab-ci.yml b/.gitlab/ci/review.gitlab-ci.yml index b9a2eb3ebc6..2605b3ec8b6 100644 --- a/.gitlab/ci/review.gitlab-ci.yml +++ b/.gitlab/ci/review.gitlab-ci.yml @@ -144,18 +144,20 @@ review-stop: .allure-report-base: image: - name: ${GITLAB_DEPENDENCY_PROXY}andrcuns/allure-report-publisher:0.0.6 + name: ${GITLAB_DEPENDENCY_PROXY}andrcuns/allure-report-publisher:0.3.1 entrypoint: [""] stage: post-qa variables: GIT_STRATEGY: none STORAGE_CREDENTIALS: $QA_ALLURE_REPORT_GCS_CREDENTIALS + GITLAB_AUTH_TOKEN: $GITLAB_QA_MR_ALLURE_REPORT_TOKEN script: - | allure-report-publisher upload gcs \ --results-glob="qa/gitlab-qa-run-*/**/allure-results/*" \ --bucket="gitlab-qa-allure-reports" \ --prefix="$ALLURE_REPORT_PATH_PREFIX/$CI_COMMIT_REF_SLUG" \ + --update-pr="comment" \ --copy-latest \ --color @@ -231,18 +233,20 @@ parallel-spec-reports: allure-report-qa-smoke: extends: - .allure-report-base - - .review:rules:review-qa-smoke + - .review:rules:review-qa-smoke-report needs: ["review-qa-smoke"] variables: ALLURE_REPORT_PATH_PREFIX: gitlab-review-smoke + ALLURE_JOB_NAME: review-qa-smoke allure-report-qa-all: extends: - .allure-report-base - - .review:rules:review-qa-all + - .review:rules:review-qa-all-report needs: ["review-qa-all"] variables: ALLURE_REPORT_PATH_PREFIX: gitlab-review-all + ALLURE_JOB_NAME: review-qa-all danger-review: extends: diff --git a/.gitlab/ci/rules.gitlab-ci.yml b/.gitlab/ci/rules.gitlab-ci.yml index 4d083541b43..fbc010f90b5 100644 --- a/.gitlab/ci/rules.gitlab-ci.yml +++ b/.gitlab/ci/rules.gitlab-ci.yml @@ -1130,6 +1130,22 @@ changes: *code-qa-patterns allow_failure: true +.review:rules:review-qa-smoke-report: + rules: + - <<: *if-not-ee + when: never + - <<: *if-dot-com-gitlab-org-merge-request + changes: *ci-review-patterns + when: always + - <<: *if-dot-com-gitlab-org-merge-request + changes: *frontend-patterns + allow_failure: true + when: always + - <<: *if-dot-com-gitlab-org-merge-request + changes: *code-qa-patterns + allow_failure: true + when: always + .review:rules:review-qa-all: rules: - <<: *if-not-ee @@ -1142,6 +1158,19 @@ changes: *qa-patterns allow_failure: true +.review:rules:review-qa-all-report: + rules: + - <<: *if-not-ee + when: never + - <<: *if-dot-com-gitlab-org-merge-request + changes: *code-patterns + when: manual + allow_failure: true + - <<: *if-dot-com-gitlab-org-merge-request + changes: *qa-patterns + allow_failure: true + when: always + .review:rules:review-cleanup: rules: - <<: *if-not-ee diff --git a/app/assets/javascripts/security_configuration/components/constants.js b/app/assets/javascripts/security_configuration/components/constants.js index 3cdcac4c0b4..142dade914b 100644 --- a/app/assets/javascripts/security_configuration/components/constants.js +++ b/app/assets/javascripts/security_configuration/components/constants.js @@ -18,18 +18,27 @@ import { * Translations & helpPagePaths for Static Security Configuration Page */ export const SAST_NAME = __('Static Application Security Testing (SAST)'); +export const SAST_SHORT_NAME = s__('ciReport|SAST'); export const SAST_DESCRIPTION = __('Analyze your source code for known vulnerabilities.'); export const SAST_HELP_PATH = helpPagePath('user/application_security/sast/index'); +export const SAST_CONFIG_HELP_PATH = helpPagePath('user/application_security/sast/index', { + anchor: 'configuration', +}); export const DAST_NAME = __('Dynamic Application Security Testing (DAST)'); +export const DAST_SHORT_NAME = s__('ciReport|DAST'); export const DAST_DESCRIPTION = __('Analyze a review version of your web application.'); export const DAST_HELP_PATH = helpPagePath('user/application_security/dast/index'); +export const DAST_CONFIG_HELP_PATH = helpPagePath('user/application_security/dast/index', { + anchor: 'enable-dast', +}); export const DAST_PROFILES_NAME = __('DAST Scans'); export const DAST_PROFILES_DESCRIPTION = __( 'Saved scan settings and target site settings which are reusable.', ); export const DAST_PROFILES_HELP_PATH = helpPagePath('user/application_security/dast/index'); +export const DAST_PROFILES_CONFIG_TEXT = s__('SecurityConfiguration|Manage scans'); export const SECRET_DETECTION_NAME = __('Secret Detection'); export const SECRET_DETECTION_DESCRIPTION = __( @@ -38,6 +47,10 @@ export const SECRET_DETECTION_DESCRIPTION = __( export const SECRET_DETECTION_HELP_PATH = helpPagePath( 'user/application_security/secret_detection/index', ); +export const SECRET_DETECTION_CONFIG_HELP_PATH = helpPagePath( + 'user/application_security/secret_detection/index', + { anchor: 'configuration' }, +); export const DEPENDENCY_SCANNING_NAME = __('Dependency Scanning'); export const DEPENDENCY_SCANNING_DESCRIPTION = __( @@ -46,6 +59,10 @@ export const DEPENDENCY_SCANNING_DESCRIPTION = __( export const DEPENDENCY_SCANNING_HELP_PATH = helpPagePath( 'user/application_security/dependency_scanning/index', ); +export const DEPENDENCY_SCANNING_CONFIG_HELP_PATH = helpPagePath( + 'user/application_security/dependency_scanning/index', + { anchor: 'configuration' }, +); export const CONTAINER_SCANNING_NAME = __('Container Scanning'); export const CONTAINER_SCANNING_DESCRIPTION = __( @@ -54,6 +71,10 @@ export const CONTAINER_SCANNING_DESCRIPTION = __( export const CONTAINER_SCANNING_HELP_PATH = helpPagePath( 'user/application_security/container_scanning/index', ); +export const CONTAINER_SCANNING_CONFIG_HELP_PATH = helpPagePath( + 'user/application_security/container_scanning/index', + { anchor: 'configuration' }, +); export const COVERAGE_FUZZING_NAME = __('Coverage Fuzzing'); export const COVERAGE_FUZZING_DESCRIPTION = __( @@ -136,6 +157,83 @@ export const scanners = [ }, ]; +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, + }, + { + name: CONTAINER_SCANNING_NAME, + description: CONTAINER_SCANNING_DESCRIPTION, + helpPath: CONTAINER_SCANNING_HELP_PATH, + configurationHelpPath: CONTAINER_SCANNING_CONFIG_HELP_PATH, + type: REPORT_TYPE_CONTAINER_SCANNING, + }, + { + name: SECRET_DETECTION_NAME, + description: SECRET_DETECTION_DESCRIPTION, + helpPath: SECRET_DETECTION_HELP_PATH, + configurationHelpPath: SECRET_DETECTION_CONFIG_HELP_PATH, + type: REPORT_TYPE_SECRET_DETECTION, + available: true, + }, + { + 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, + type: REPORT_TYPE_COVERAGE_FUZZING, + }, +]; + +export const complianceFeatures = [ + { + name: LICENSE_COMPLIANCE_NAME, + description: LICENSE_COMPLIANCE_DESCRIPTION, + helpPath: LICENSE_COMPLIANCE_HELP_PATH, + type: REPORT_TYPE_LICENSE_COMPLIANCE, + }, +]; + export const featureToMutationMap = { [REPORT_TYPE_SAST]: { mutationId: 'configureSast', diff --git a/app/assets/javascripts/security_configuration/components/redesigned_app.vue b/app/assets/javascripts/security_configuration/components/redesigned_app.vue new file mode 100644 index 00000000000..9f3f7f2f703 --- /dev/null +++ b/app/assets/javascripts/security_configuration/components/redesigned_app.vue @@ -0,0 +1,76 @@ + + + diff --git a/app/assets/javascripts/security_configuration/index.js b/app/assets/javascripts/security_configuration/index.js index 1134a1ffb44..a74bc5163d0 100644 --- a/app/assets/javascripts/security_configuration/index.js +++ b/app/assets/javascripts/security_configuration/index.js @@ -2,6 +2,9 @@ import Vue from 'vue'; import VueApollo from 'vue-apollo'; import createDefaultClient from '~/lib/graphql'; import SecurityConfigurationApp from './components/app.vue'; +import { securityFeatures, complianceFeatures } from './components/constants'; +import RedesignedSecurityConfigurationApp from './components/redesigned_app.vue'; +import { augmentFeatures } from './utils'; export const initStaticSecurityConfiguration = (el) => { if (!el) { @@ -14,8 +17,32 @@ export const initStaticSecurityConfiguration = (el) => { defaultClient: createDefaultClient(), }); - const { projectPath, upgradePath } = el.dataset; + const { projectPath, upgradePath, features, latestPipelinePath } = el.dataset; + if (gon.features.securityConfigurationRedesign) { + const { augmentedSecurityFeatures } = augmentFeatures( + securityFeatures, + complianceFeatures, + features ? JSON.parse(features) : [], + ); + + return new Vue({ + el, + apolloProvider, + provide: { + projectPath, + upgradePath, + }, + render(createElement) { + return createElement(RedesignedSecurityConfigurationApp, { + props: { + augmentedSecurityFeatures, + latestPipelinePath, + }, + }); + }, + }); + } return new Vue({ el, apolloProvider, diff --git a/app/assets/javascripts/security_configuration/utils.js b/app/assets/javascripts/security_configuration/utils.js new file mode 100644 index 00000000000..071ebff4f21 --- /dev/null +++ b/app/assets/javascripts/security_configuration/utils.js @@ -0,0 +1,24 @@ +export const augmentFeatures = (securityFeatures, complianceFeatures, features = []) => { + const featuresByType = features.reduce((acc, feature) => { + acc[feature.type] = feature; + return acc; + }, {}); + + const augmentFeature = (feature) => { + const augmented = { + ...feature, + ...featuresByType[feature.type], + }; + + if (augmented.secondary) { + augmented.secondary = { ...augmented.secondary, ...featuresByType[feature.secondary.type] }; + } + + return augmented; + }; + + return { + augmentedSecurityFeatures: securityFeatures.map((feature) => augmentFeature(feature)), + augmentedComplianceFeatures: complianceFeatures.map((feature) => augmentFeature(feature)), + }; +}; diff --git a/app/assets/javascripts/vue_merge_request_widget/mr_widget_options.vue b/app/assets/javascripts/vue_merge_request_widget/mr_widget_options.vue index 7b99286d2ee..95804e11b4a 100644 --- a/app/assets/javascripts/vue_merge_request_widget/mr_widget_options.vue +++ b/app/assets/javascripts/vue_merge_request_widget/mr_widget_options.vue @@ -435,9 +435,7 @@ export default {