Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Secret-Detection.gitlab-ci.yml « Security « templates « ci « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 441a57048e11e7f51767db155ce441e8c1d40e6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# 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"

.secret-analyzer:
  stage: test
  image: "$SECURE_ANALYZERS_PREFIX/secrets:$SECRETS_ANALYZER_VERSION"
  services: []
  artifacts:
    reports:
      secret_detection: gl-secret-detection-report.json

secret_detection_default_branch:
  extends: .secret-analyzer
  rules:
    - if: $SECRET_DETECTION_DISABLED
      when: never
    - if: $CI_DEFAULT_BRANCH == $CI_COMMIT_BRANCH &&
          $GITLAB_FEATURES =~ /\bsecret_detection\b/
  script:
    - /analyzer run

secret_detection:
  extends: .secret-analyzer
  rules:
    - if: $SECRET_DETECTION_DISABLED
      when: never
    - if: $CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH &&
          $GITLAB_FEATURES =~ /\bsecret_detection\b/
  script:
    - git fetch origin $CI_DEFAULT_BRANCH $CI_BUILD_REF_NAME
    - export SECRET_DETECTION_COMMIT_TO=$(git log --left-right --cherry-pick --pretty=format:"%H" refs/remotes/origin/$CI_DEFAULT_BRANCH...refs/remotes/origin/$CI_BUILD_REF_NAME | tail -n 1)
    - export SECRET_DETECTION_COMMIT_FROM=$CI_COMMIT_SHA
    - /analyzer run