1+ # Read more about this feature here: https://docs.gitlab.com/ee/user/application_security/sast/
2+ #
3+ # Configure the scanning tool through the environment variables.
4+ # List of the variables: https://gitlab.com/gitlab-org/security-products/sast#settings
5+ # How to set: https://docs.gitlab.com/ee/ci/yaml/#variables
6+
7+ variables :
8+ # Setting this variable will affect all Security templates
9+ # (SAST, Dependency Scanning, ...)
10+ SECURE_ANALYZERS_PREFIX : " registry.gitlab.com/gitlab-org/security-products/analyzers"
11+ SAST_DEFAULT_ANALYZERS : " nodejs-scan, eslint, mobsf, semgrep"
12+ SAST_EXCLUDED_ANALYZERS : " "
13+ SAST_EXCLUDED_PATHS : " spec, test, tests, tmp"
14+ SAST_ANALYZER_IMAGE_TAG : 2
15+ SCAN_KUBERNETES_MANIFESTS : " false"
16+
17+ sast :
18+ stage : test
19+ artifacts :
20+ paths :
21+ - gl-sast-report.json
22+ reports :
23+ sast : gl-sast-report.json
24+ rules :
25+ - when : never
26+ variables :
27+ SEARCH_MAX_DEPTH : 4
28+ script :
29+ - echo "$CI_JOB_NAME is used for configuration only, and its script should not be executed"
30+ - exit 1
31+
32+ .sast-analyzer :
33+ extends : sast
34+ allow_failure : false
35+ # `rules` must be overridden explicitly by each child job
36+ # see https://gitlab.com/gitlab-org/gitlab/-/issues/218444
37+ script :
38+ - /analyzer run
39+ - if [ "`which node | grep '/bin/node$'`" == "" ]; then apk add nodejs npm; fi
40+ - if [ "$SAST_FAILURE_ALLOWED" == "false" ]; then npm install simplify-security; fi
41+ - if [ "$SAST_FAILURE_ALLOWED" == "false" ]; then node node_modules/simplify-security/entrypoint.js report -i gl-sast-report.json; fi
42+
43+ eslint-sast :
44+ extends : .sast-analyzer
45+ image :
46+ name : " $SAST_ANALYZER_IMAGE"
47+ variables :
48+ # SAST_ANALYZER_IMAGE is an undocumented variable used internally to allow QA to
49+ # override the analyzer image with a custom value. This may be subject to change or
50+ # breakage across GitLab releases.
51+ SAST_ANALYZER_IMAGE : " $SECURE_ANALYZERS_PREFIX/eslint:$SAST_ANALYZER_IMAGE_TAG"
52+ SAST_FAILURE_ALLOWED : " $ESLINT_FAILURE_ALLOWED"
53+ rules :
54+ - if : $SAST_DISABLED
55+ when : never
56+ - if : $SAST_EXCLUDED_ANALYZERS =~ /eslint/
57+ when : never
58+ - if : $CI_COMMIT_BRANCH &&
59+ $SAST_DEFAULT_ANALYZERS =~ /eslint/
60+ exists :
61+ - ' **/*.html'
62+ - ' **/*.js'
63+ - ' **/*.jsx'
64+ - ' **/*.ts'
65+ - ' **/*.tsx'
0 commit comments