diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-24 18:10:19 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-24 18:10:19 +0000 |
commit | 9b14160725d91f8824b35223f16bf073a97bf7de (patch) | |
tree | 121f5165f80d2c921b4135566b3c9e620531434d /.gitlab | |
parent | 27622f7417713cbd2057a7f642e9ce128d9fc169 (diff) | |
download | gitlab-ce-9b14160725d91f8824b35223f16bf073a97bf7de.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to '.gitlab')
-rw-r--r-- | .gitlab/ci/dast.gitlab-ci.yml | 201 | ||||
-rw-r--r-- | .gitlab/ci/reports.gitlab-ci.yml | 42 | ||||
-rw-r--r-- | .gitlab/ci/review.gitlab-ci.yml | 5 | ||||
-rw-r--r-- | .gitlab/ci/rules.gitlab-ci.yml | 3 | ||||
-rw-r--r-- | .gitlab/issue_templates/QA Failure.md | 8 | ||||
-rw-r--r-- | .gitlab/merge_request_templates/Security Release.md | 1 |
6 files changed, 213 insertions, 47 deletions
diff --git a/.gitlab/ci/dast.gitlab-ci.yml b/.gitlab/ci/dast.gitlab-ci.yml new file mode 100644 index 00000000000..1b45fff7ec7 --- /dev/null +++ b/.gitlab/ci/dast.gitlab-ci.yml @@ -0,0 +1,201 @@ +.dast_conf: + tags: + - prm + # For scheduling dast job + extends: + - .reports:schedule-dast + image: + name: "registry.gitlab.com/gitlab-org/security-products/dast:$DAST_VERSION" + resource_group: dast_scan + variables: + DAST_USERNAME_FIELD: "user[login]" + DAST_PASSWORD_FIELD: "user[password]" + DAST_FULL_SCAN_ENABLED: "true" + DAST_SPIDER_MINS: 0 + # TBD pin to a version + DAST_VERSION: 1.22.1 + # -Xmx is used to set the JVM memory to 6GB to prevent DAST OutOfMemoryError. + DAST_ZAP_CLI_OPTIONS: "-Xmx6144m" + DAST_RULES: "41,42,43,10027,10032,10041,10042,10045,10047,10052,10053,10057,10061,10096,10097,10104,10106,20012,20014,20015,20016,20017,20018,40019,40020,40021,40024,40025,40027,40029,40032,90001,90019,10109,10026,10028,10029,10030,10031,10033,10034,10035,10036,10038,10039,10043,10044,10048,10050,10051,10058,10062,10095,10107,10108,30003,40013,40022,40023,40028,90021,90023,90024,90025,90027,90028,10003,50003,0,2,3,6,7,10010,10011,10015,10017,10019,10020,10021,10023,10024,10025,10037,10040,10054,10055,10056,10098,10105,10202,20019,30001,30002,40003,40008,40009,40012,40014,40016,40017,40018,50000,50001,90011,90020,90022,90033" + before_script: + - 'export DAST_WEBSITE="${DAST_WEBSITE:-$(cat environment_url.txt)}"' + - 'export DAST_AUTH_URL="${DAST_WEBSITE}/users/sign_in"' + - 'export DAST_PASSWORD="${REVIEW_APPS_ROOT_PASSWORD}"' + # Below three lines can be removed once https://gitlab.com/gitlab-org/gitlab/-/issues/230687 is fixed + - mkdir -p /zap/xml + - 'sed -i "84 s/true/false/" /zap/xml/config.xml' + - cat /zap/xml/config.xml + # Help pages are excluded from scan as they are static pages. + # profile/two_factor_auth is excluded from scan to prevent 2FA from being turned on from user profile, which will reduce coverage. + - 'export DAST_AUTH_EXCLUDE_URLS="${DAST_WEBSITE}/help/.*,${DAST_WEBSITE}/profile/two_factor_auth,${DAST_WEBSITE}/users/sign_out"' + - enable_rule () { read all_rules; rule=$1; echo $all_rules | sed -r "s/(,)?$rule(,)?/\1-1\2/" ; } + # Sort ids in DAST_RULES ascendingly, which is required when using DAST_RULES as argument to enable_rule + - 'DAST_RULES=$(echo $DAST_RULES | tr "," "\n" | sort -n | paste -sd ",")' + needs: ["review-deploy"] + stage: dast + # Default job timeout set to 90m and dast rules needs 2h to so that it won't timeout. + timeout: 2h + artifacts: + paths: + - gl-dast-report.json # GitLab-specific + reports: + dast: gl-dast-report.json + expire_in: 1 week # GitLab-specific + +# DAST scan with a subset of Release scan rules. +DAST-fullscan-ruleset1: + extends: + - .dast_conf + variables: + DAST_USERNAME: "user1" + script: + - export DAST_EXCLUDE_RULES=$(echo $DAST_RULES | enable_rule 10019 | enable_rule 10020 | enable_rule 10021 | enable_rule 10023 | enable_rule 10024 | enable_rule 10025 | enable_rule 10037 | enable_rule 10040 | enable_rule 10054 | enable_rule 10055 | enable_rule 10056) + - echo $DAST_EXCLUDE_RULES + - /analyze -t $DAST_WEBSITE -d + +# DAST scan with a subset of Release scan rules. +DAST-fullscan-ruleset2: + extends: + - .dast_conf + variables: + DAST_USERNAME: "user2" + script: + - export DAST_EXCLUDE_RULES=$(echo $DAST_RULES | enable_rule 90011 | enable_rule 90020 | enable_rule 90022 | enable_rule 90033) + - echo $DAST_EXCLUDE_RULES + - /analyze -t $DAST_WEBSITE -d + +# DAST scan with a subset of Release scan rules. +DAST-fullscan-ruleset3: + extends: + - .dast_conf + variables: + DAST_USERNAME: "user3" + script: + - export DAST_EXCLUDE_RULES=$(echo $DAST_RULES | enable_rule 40016 | enable_rule 40017 | enable_rule 50000 | enable_rule 50001) + - echo $DAST_EXCLUDE_RULES + - /analyze -t $DAST_WEBSITE -d + +# DAST scan with a subset of Release scan rules. +DAST-fullscan-ruleset4: + extends: + - .dast_conf + variables: + DAST_USERNAME: "user4" + script: + - export DAST_EXCLUDE_RULES=$(echo $DAST_RULES | enable_rule 0 | enable_rule 2 | enable_rule 3 | enable_rule 7 ) + - echo $DAST_EXCLUDE_RULES + - /analyze -t $DAST_WEBSITE -d + +# DAST scan with a subset of Release scan rules. +DAST-fullscan-ruleset5: + extends: + - .dast_conf + variables: + DAST_USERNAME: "user5" + script: + - export DAST_EXCLUDE_RULES=$(echo $DAST_RULES | enable_rule 10010 | enable_rule 10011 | enable_rule 10015 | enable_rule 10017 | enable_rule 10019) + - echo $DAST_EXCLUDE_RULES + - /analyze -t $DAST_WEBSITE -d + +# DAST scan with a subset of Release scan rules. +DAST-fullscan-ruleset6: + extends: + - .dast_conf + variables: + DAST_USERNAME: "user6" + script: + - export DAST_EXCLUDE_RULES=$(echo $DAST_RULES | enable_rule 30001 | enable_rule 40009) + - echo $DAST_EXCLUDE_RULES + - /analyze -t $DAST_WEBSITE -d + +# Enable when https://gitlab.com/gitlab-org/gitlab/-/merge_requests/39749 is fixed +# DAST scan with a subset of Beta scan rules. +# DAST-fullscan-ruleset7: +# extends: +# - .dast_conf +# variables: +# DAST_USERNAME: "user7" +# script: +# - export DAST_EXCLUDE_RULES=$(echo $DAST_RULES | enable_rule 10098 | enable_rule 10105 | enable_rule 10202 | enable_rule 30002 | enable_rule 40003 | enable_rule 40008 | enable_rule 40009) +# - echo $DAST_EXCLUDE_RULES +# - /analyze -t $DAST_WEBSITE -d + +# Enable when https://gitlab.com/gitlab-org/gitlab/-/merge_requests/39749 is fixed +# Below jobs runs DAST scans with one time consuming scan rule. These scan rules are disabled in above jobs so that those jobs won't timeout. +# DAST scan with rule - 20019 External Redirect +# DAST-fullscan-rule-20019: +# extends: +# - .dast_conf +# variables: +# DAST_USERNAME: "user8" +# script: +# - export DAST_EXCLUDE_RULES=$(echo $DAST_RULES | enable_rule 20019) +# - echo $DAST_EXCLUDE_RULES +# - /analyze -t $DAST_WEBSITE -d + +# Enable when https://gitlab.com/gitlab-org/gitlab/-/merge_requests/39749 is fixed +# DAST scan with rule - 10107 Httpoxy - Proxy Header Misuse - Active/beta +# DAST-fullscan-rule-10107: +# extends: +# - .dast_conf +# variables: +# DAST_USERNAME: "user9" +# script: +# - export DAST_EXCLUDE_RULES=$(echo $DAST_RULES | enable_rule 10107) +# - echo $DAST_EXCLUDE_RULES +# - /analyze -t $DAST_WEBSITE -d + +# DAST scan with rule - 90020 Remote OS Command Injection +DAST-fullscan-rule-90020: + extends: + - .dast_conf + variables: + DAST_USERNAME: "user10" + script: + - export DAST_EXCLUDE_RULES=$(echo $DAST_RULES | enable_rule 90020) + - echo $DAST_EXCLUDE_RULES + - /analyze -t $DAST_WEBSITE -d + +# DAST scan with rule - 40018 SQL Injection - Active/release +DAST-fullscan-rule-40018: + extends: + - .dast_conf + variables: + DAST_USERNAME: "user11" + script: + - export DAST_EXCLUDE_RULES=$(echo $DAST_RULES | enable_rule 40018) + - echo $DAST_EXCLUDE_RULES + - /analyze -t $DAST_WEBSITE -d + +# DAST scan with rule - 40014 Cross Site Scripting (Persistent) - Active/release +DAST-fullscan-rule-40014: + extends: + - .dast_conf + variables: + DAST_USERNAME: "user12" + script: + - export DAST_EXCLUDE_RULES=$(echo $DAST_RULES | enable_rule 40014) + - echo $DAST_EXCLUDE_RULES + - /analyze -t $DAST_WEBSITE -d + +# DAST scan with rule - 6 Path travesal +DAST-fullscan-rule-6: + extends: + - .dast_conf + variables: + DAST_USERNAME: "user13" + script: + - export DAST_EXCLUDE_RULES=$(echo $DAST_RULES | enable_rule 6) + - echo $DAST_EXCLUDE_RULES + - /analyze -t $DAST_WEBSITE -d + +# DAST scan with rule - 40012 Cross Site Scripting (Reflected) +DAST-fullscan-rule-40012: + extends: + - .dast_conf + variables: + DAST_USERNAME: "user14" + script: + - export DAST_EXCLUDE_RULES=$(echo $DAST_RULES | enable_rule 40012) + - echo $DAST_EXCLUDE_RULES + - /analyze -t $DAST_WEBSITE -d diff --git a/.gitlab/ci/reports.gitlab-ci.yml b/.gitlab/ci/reports.gitlab-ci.yml index b9f81f2eb0f..54b6b1f47eb 100644 --- a/.gitlab/ci/reports.gitlab-ci.yml +++ b/.gitlab/ci/reports.gitlab-ci.yml @@ -145,45 +145,3 @@ dependency_scanning: reports: dependency_scanning: gl-dependency-scanning-report.json expire_in: 1 week # GitLab-specific - -# Temporarily disabling review apps -## We need to duplicate this job's definition because it seems it's impossible to -## override an included `only.refs`. -## See https://gitlab.com/gitlab-org/gitlab/issues/31371. -# dast: -# extends: -# - .default-retry -# - .reports:rules:dast -# # This is needed so that manual jobs with needs don't block the pipeline. -# # See https://gitlab.com/gitlab-org/gitlab/-/issues/199979. -# dependencies: ["review-deploy"] -# stage: qa # GitLab-specific -# image: -# name: "registry.gitlab.com/gitlab-org/security-products/dast:$DAST_VERSION" -# variables: -# # To be done in a later iteration -# # DAST_USERNAME: "root" -# # DAST_USERNAME_FIELD: "user[login]" -# # DAST_PASSWORD_FIELD: "user[passowrd]" -# DAST_VERSION: 1 -# script: -# - 'export DAST_WEBSITE="${DAST_WEBSITE:-$(cat environment_url.txt)}"' -# # To be done in a later iteration -# # - 'export DAST_AUTH_URL="${DAST_WEBSITE}/users/sign_in"' -# # - 'export DAST_PASSWORD="${REVIEW_APPS_ROOT_PASSWORD}"' -# - /analyze -t $DAST_WEBSITE -# timeout: 4h -# artifacts: -# paths: -# - gl-dast-report.json # GitLab-specific -# reports: -# dast: gl-dast-report.json -# expire_in: 1 week # GitLab-specific - -# To be done in a later iteration: https://gitlab.com/gitlab-org/gitlab/issues/31160#note_278188255 -# schedule:dast: -# extends: -# - dast -# - .reports:schedule-dast -# variables: -# DAST_FULL_SCAN_ENABLED: "true" diff --git a/.gitlab/ci/review.gitlab-ci.yml b/.gitlab/ci/review.gitlab-ci.yml index 4e3a80372a6..006956457aa 100644 --- a/.gitlab/ci/review.gitlab-ci.yml +++ b/.gitlab/ci/review.gitlab-ci.yml @@ -77,6 +77,11 @@ review-deploy: # to have to manually start the jobs in sequence, so we do it for them. - '[ -z $CI_JOB_MANUAL ] || play_job "review-qa-smoke"' - '[ -z $CI_JOB_MANUAL ] || play_job "review-performance"' + after_script: + # Run seed-dast-test-data.sh only when DAST_RUN is set to true. This is to pupulate review app with data for DAST scan. + # Set DAST_RUN to true when jobs are manually scheduled. + - if [ "$DAST_RUN" == "true" ]; then source scripts/review_apps/seed-dast-test-data.sh; TRACE=1 trigger_proj_user_creation; fi + artifacts: paths: [environment_url.txt] expire_in: 2 days diff --git a/.gitlab/ci/rules.gitlab-ci.yml b/.gitlab/ci/rules.gitlab-ci.yml index 5a0e9025bce..d6538600e3b 100644 --- a/.gitlab/ci/rules.gitlab-ci.yml +++ b/.gitlab/ci/rules.gitlab-ci.yml @@ -645,6 +645,7 @@ - if: '$DAST_DISABLED || $GITLAB_FEATURES !~ /\bdast\b/' when: never - <<: *if-dot-com-gitlab-org-schedule + allow_failure: true ################ # Review rules # @@ -665,6 +666,8 @@ .review:rules:mr-and-schedule-auto-if-frontend-manual-otherwise: rules: + - if: '$DAST_RUN == "true"' # Skip this job when DAST is run + when: never - <<: *if-not-ee when: never - <<: *if-dot-com-gitlab-org-merge-request diff --git a/.gitlab/issue_templates/QA Failure.md b/.gitlab/issue_templates/QA Failure.md index 772f363ae31..9751b40cb91 100644 --- a/.gitlab/issue_templates/QA Failure.md +++ b/.gitlab/issue_templates/QA Failure.md @@ -68,10 +68,10 @@ a nightly pipeline, select ~"found:nightly". <!-- https://about.gitlab.com/handbook/engineering/quality/guidelines/#priorities: -- ~P::1: Tests that are needed to verify fundamental GitLab functionality. -- ~P::2: Tests that deal with external integrations which may take a longer time to debug and fix. +- ~"priority::1": Tests that are needed to verify fundamental GitLab functionality. +- ~"priority::2": Tests that deal with external integrations which may take a longer time to debug and fix. --> -/label ~P:: +/label ~priority:: -<!-- Select the current milestone if ~P::1 or the next milestone if ~P::2. --> +<!-- Select the current milestone if ~"priority::1" or the next milestone if ~"priority::2". --> /milestone % diff --git a/.gitlab/merge_request_templates/Security Release.md b/.gitlab/merge_request_templates/Security Release.md index bdf26041e62..eda16747c13 100644 --- a/.gitlab/merge_request_templates/Security Release.md +++ b/.gitlab/merge_request_templates/Security Release.md @@ -23,7 +23,6 @@ See [the general developer security release guidelines](https://gitlab.com/gitla - [ ] Ensure it's approved by an AppSec engineer. - If you're unsure who should approve, find the AppSec engineer associated to the issue in the [Canonical repository], or ask #sec-appsec on Slack. - Trigger the [`package-and-qa` build]. The docker image generated will be used by the AppSec engineer to validate the security vulnerability has been remediated. - - [ ] Merge request _must_ close the corresponding security issue. - [ ] For a backport MR targeting a versioned stable branch (`X-Y-stable-ee`) - [ ] Ensure it's approved by a maintainer. |