-
Notifications
You must be signed in to change notification settings - Fork 86
92 lines (74 loc) · 2.37 KB
/
devsecops.yml
File metadata and controls
92 lines (74 loc) · 2.37 KB
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
name: DevSecOps Pipeline
on:
push:
# ⚠️ PRODUCTION ONLY — security scans run on main only
branches: ["main"]
jobs:
security-scans:
name: Security & Quality Scans
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies for SAST
run: |
pip install bandit
- name: Bandit - SAST Scan
run: bandit -r . -f custom || echo "Bandit scan completed"
continue-on-error: true
- name: Gitleaks - Hardcoded Secrets Detection
uses: gitleaks/gitleaks-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: true
- name: Snyk - Vulnerability Scanner
uses: snyk/actions/python@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
args: --severity-threshold=high
continue-on-error: true
- name: SonarCloud - Code Quality Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
continue-on-error: true
docker-scan:
name: Container Security
runs-on: ubuntu-latest
needs: security-scans
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Build Docker Image
run: docker build -t rag-app-local .
- name: Trivy - Container Vulnerability Scan
uses: aquasecurity/trivy-action@master
with:
image-ref: 'rag-app-local'
format: 'table'
exit-code: '0'
ignore-unfixed: true
vuln-type: 'os,library'
# Note: OWASP ZAP DAST scan requires the app to be temporarily booted or continuously deployed
dast-scan:
name: OWASP ZAP DAST
runs-on: ubuntu-latest
needs: docker-scan
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Run Docker Compose Background
run: docker compose up -d
- name: Wait for App to Boot
run: sleep 15
- name: ZAP Baseline Scan
uses: zaproxy/action-baseline@v0.12.0
with:
target: 'http://localhost:5000'
continue-on-error: true