debian-mirror-gitlab/lib/gitlab/ci/templates/Security/Secret-Detection.gitlab-ci.yml

45 lines
1.6 KiB
YAML
Raw Normal View History

2020-06-23 00:09:42 +05:30
# Read more about this feature here: https://docs.gitlab.com/ee/user/application_security/secret_detection
#
# Configure the scanning tool through the environment variables.
# List of the variables: https://gitlab.com/gitlab-org/security-products/secret_detection#available-variables
# How to set: https://docs.gitlab.com/ee/ci/yaml/#variables
variables:
SECURE_ANALYZERS_PREFIX: "registry.gitlab.com/gitlab-org/security-products/analyzers"
SECRETS_ANALYZER_VERSION: "3"
2020-10-24 23:57:45 +05:30
SECRET_DETECTION_EXCLUDED_PATHS: ""
2020-06-23 00:09:42 +05:30
2020-07-28 23:09:34 +05:30
.secret-analyzer:
2020-06-23 00:09:42 +05:30
stage: test
image: "$SECURE_ANALYZERS_PREFIX/secrets:$SECRETS_ANALYZER_VERSION"
services: []
2021-02-22 17:27:13 +05:30
allow_failure: true
# `rules` must be overridden explicitly by each child job
# see https://gitlab.com/gitlab-org/gitlab/-/issues/218444
2020-06-23 00:09:42 +05:30
artifacts:
reports:
secret_detection: gl-secret-detection-report.json
2020-07-28 23:09:34 +05:30
secret_detection_default_branch:
extends: .secret-analyzer
rules:
- if: $SECRET_DETECTION_DISABLED
when: never
2020-10-24 23:57:45 +05:30
- if: $CI_DEFAULT_BRANCH == $CI_COMMIT_BRANCH
2020-07-28 23:09:34 +05:30
script:
- /analyzer run
secret_detection:
extends: .secret-analyzer
rules:
- if: $SECRET_DETECTION_DISABLED
when: never
2020-10-24 23:57:45 +05:30
- if: $CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
2020-06-23 00:09:42 +05:30
script:
2021-01-03 14:25:43 +05:30
- git fetch origin $CI_DEFAULT_BRANCH $CI_COMMIT_REF_NAME
- git log --left-right --cherry-pick --pretty=format:"%H" refs/remotes/origin/$CI_DEFAULT_BRANCH...refs/remotes/origin/$CI_COMMIT_REF_NAME > "$CI_COMMIT_SHA"_commit_list.txt
2020-11-24 15:15:51 +05:30
- export SECRET_DETECTION_COMMITS_FILE="$CI_COMMIT_SHA"_commit_list.txt
2020-06-23 00:09:42 +05:30
- /analyzer run
2020-11-24 15:15:51 +05:30
- rm "$CI_COMMIT_SHA"_commit_list.txt