forked from juice-shop/juice-shop
-
Notifications
You must be signed in to change notification settings - Fork 0
143 lines (120 loc) · 3.48 KB
/
security.yml
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
name: security-pipeline
on:
push:
branches:
- master
pull_request:
jobs:
build-and-syft:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build Docker image
run: |
docker build -t juice-shop:${{ github.sha }} .
- name: Syft SBOM Scan
uses: anchore/sbom-action@v0
with:
image: "juice-shop:${{ github.sha }}"
output-file: "sbom.spdx.json"
format: "spdx-json"
Sast-scan:
name: SAST (Semgrep)
needs: build-and-syft
runs-on: ubuntu-20.04
container: returntocorp/semgrep
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Semgrep Scan
run: semgrep ci --config=auto --sarif --output=semgrep.sarif || true
- name: Upload SARIF File (Semgrep)
uses: github/codeql-action/upload-sarif@v3
if: always()
with:
sarif_file: 'semgrep.sarif'
- name: Upload Semgrep Artifact
uses: actions/upload-artifact@v3
with:
name: semgrep-sarif
path: semgrep.sarif
Gitleaks-scan:
name: Gitleaks
needs: Sast-scan
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: SecretScan (Gitleaks)
uses: gitleaks/gitleaks-action@v2
env:
GITLEAKS_ENABLE_UPLOAD_ARTIFACT: true
GITLEAKS_ENABLE_SUMMARY: true
continue-on-error: true
- name: Upload SARIF File (Gitleaks)
uses: github/codeql-action/upload-sarif@v3
if: always()
with:
sarif_file: 'results.sarif'
- name: Rename SARIF File to gitleaks.sarif
run: |
if [ -f results.sarif ]; then
mv results.sarif gitleaks.sarif
else
echo "results.sarif bulunamadı."
fi
- name: Upload Gitleaks Artifact
uses: actions/upload-artifact@v3
with:
name: gitleaks-sarif
path: gitleaks.sarif
deploy:
name: Deploy
needs: Gitleaks-scan
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Dummy Deploy Step
run: echo "Deploying app... (This is a dummy step)"
zap_scan:
name: ZAP Full Scan
needs: deploy
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: ZAP Scan
uses: zaproxy/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
docker_name: 'ghcr.io/zaproxy/zaproxy:stable'
target: 'https://demo.owasp-juice.shop/#/'
rules_file_name: '.zap/rules.tsv'
cmd_options: '-a'
import-defectdojo:
name: Import Scans to DefectDojo
needs: [Sast-scan, Gitleaks-scan]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Download Semgrep Artifact
uses: actions/download-artifact@v3
with:
name: semgrep-sarif
path: .
- name: Download Gitleaks Artifact
uses: actions/download-artifact@v3
with:
name: gitleaks-sarif
path: .
- name: Import Semgrep SARIF to DefectDojo
run: python import_scan.py semgrep.sarif
- name: Import Gitleaks SARIF to DefectDojo
run: python import_scan.py gitleaks.sarif