File tree Expand file tree Collapse file tree 1 file changed +58
-0
lines changed Expand file tree Collapse file tree 1 file changed +58
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Semgrep SAST
2
+
3
+ on :
4
+ pull_request :
5
+ branches :
6
+ - develop
7
+ - staging
8
+ - production
9
+ - stable
10
+ - main
11
+ - master
12
+
13
+ env :
14
+ # Fail workflow or not if vulnerabilities found
15
+ FAIL_ON_VULNERABILITIES : true
16
+ # List of paths (space separated) to ignore
17
+ # Supports PATTERNS
18
+ # EXCLUDE_PATHS: 'foo bar/baz file.txt dir/*.yml'
19
+ EXCLUDE_PATHS : ' '
20
+ # List of rules (space separated) to ignore
21
+ # EXCLUDE_RULES: 'generic.secrets.security.detected-aws-account-id.detected-aws-account-id'
22
+ # See https://github.com/semgrep/semgrep-rules for rules registry
23
+ EXCLUDE_RULES : ' '
24
+
25
+ jobs :
26
+ semgrep :
27
+ name : semgrep-oss/scan
28
+ runs-on : ubuntu-latest
29
+ container :
30
+ image : semgrep/semgrep
31
+ steps :
32
+ - uses : actions/checkout@v4
33
+ - name : Scan
34
+ shell : bash
35
+ run : |
36
+ EXCLUDED_PATHS=()
37
+ if [[ ! -z $EXCLUDE_PATHS ]]; then
38
+ for path in $EXCLUDE_PATHS; do
39
+ EXCLUDED_PATHS+=("--exclude $path")
40
+ done
41
+ fi
42
+
43
+ EXCLUDED_RULES=()
44
+ if [[ ! -z $EXCLUDE_RULES ]]; then
45
+ for rule in $EXCLUDE_RULES; do
46
+ EXCLUDED_RULES+=("--exclude-rule $rule")
47
+ done
48
+ fi
49
+
50
+ if [[ $FAIL_ON_VULNERABILITIES == "true" ]]; then
51
+ semgrep scan --config auto ${EXCLUDED_PATHS[@]} ${EXCLUDED_RULES[@]} --error --verbose
52
+ elif [[ $FAIL_ON_VULNERABILITIES == "false" ]]; then
53
+ semgrep scan --config auto ${EXCLUDED_PATHS[@]} ${EXCLUDED_RULES[@]} --error --verbose || true
54
+ else
55
+ echo "Bad FAIL_ON_VULNERABILITIES env var value"
56
+ exit 1
57
+ fi
58
+
You can’t perform that action at this time.
0 commit comments