2019-05-21 00:06:47 +00:00
# Read more about this feature here: https://docs.gitlab.com/ee/user/application_security/dast/
2019-03-08 03:39:35 +00:00
2021-05-25 15:10:33 +00:00
# Configure DAST with CI/CD variables (https://docs.gitlab.com/ee/ci/variables/README.html).
# List of available variables: https://docs.gitlab.com/ee/user/application_security/dast/#available-variables
2019-03-08 03:39:35 +00:00
stages :
- build
- test
- deploy
- dast
2020-01-16 12:08:32 +00:00
variables :
2021-06-15 06:10:17 +00:00
DAST_VERSION : 2
2020-05-11 18:09:55 +00:00
# Setting this variable will affect all Security templates
# (SAST, Dependency Scanning, ...)
SECURE_ANALYZERS_PREFIX : "registry.gitlab.com/gitlab-org/security-products/analyzers"
2020-01-16 12:08:32 +00:00
2019-03-08 03:39:35 +00:00
dast :
2019-04-06 16:02:04 +00:00
stage : dast
2019-05-21 00:06:47 +00:00
image :
2020-05-11 18:09:55 +00:00
name : "$SECURE_ANALYZERS_PREFIX/dast:$DAST_VERSION"
2019-04-06 16:02:04 +00:00
variables :
2020-02-21 06:08:58 +00:00
GIT_STRATEGY : none
2019-04-06 16:02:04 +00:00
allow_failure : true
script :
- export DAST_WEBSITE=${DAST_WEBSITE:-$(cat environment_url.txt)}
2020-04-14 21:09:52 +00:00
- if [ -z "$DAST_WEBSITE$DAST_API_SPECIFICATION" ]; then echo "Either DAST_WEBSITE or DAST_API_SPECIFICATION must be set. See https://docs.gitlab.com/ee/user/application_security/dast/#configuration for more details." && exit 1; fi
2020-04-06 12:10:44 +00:00
- /analyze
2019-04-06 16:02:04 +00:00
artifacts :
reports :
dast : gl-dast-report.json
2020-05-12 18:07:54 +00:00
rules :
- if : $DAST_DISABLED
when : never
- if : $DAST_DISABLED_FOR_DEFAULT_BRANCH &&
$CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
when : never
- if : $CI_DEFAULT_BRANCH != $CI_COMMIT_REF_NAME &&
$REVIEW_DISABLED && $DAST_WEBSITE == null &&
$DAST_API_SPECIFICATION == null
when : never
- if : $CI_COMMIT_BRANCH &&
2020-07-01 09:09:30 +00:00
$CI_KUBERNETES_ACTIVE &&
2020-05-12 18:07:54 +00:00
$GITLAB_FEATURES =~ /\bdast\b/
2020-07-01 09:09:30 +00:00
- if : $CI_COMMIT_BRANCH &&
$GITLAB_FEATURES =~ /\bdast\b/ &&
$DAST_WEBSITE
- if : $CI_COMMIT_BRANCH &&
$GITLAB_FEATURES =~ /\bdast\b/ &&
$DAST_API_SPECIFICATION