1+ name : SDLE Scans
2+
3+ on :
4+ workflow_dispatch :
5+ inputs :
6+ PR_number :
7+ description : ' Pull request number'
8+ required : true
9+ push :
10+ branches : [ main ]
11+ pull_request :
12+ types : [opened, synchronize, reopened, ready_for_review]
13+
14+ concurrency :
15+ group : sdle-${{ github.event.pull_request.number || github.ref }}
16+ cancel-in-progress : true
17+
18+ jobs :
19+
20+ # -----------------------------
21+ # 1) Trivy Scan (fixed)
22+ # -----------------------------
23+ trivy_scan :
24+ name : Trivy Vulnerability Scan
25+ runs-on : ubuntu-latest
26+ env :
27+ TRIVY_REPORT_FORMAT : table
28+ TRIVY_SCAN_TYPE : fs
29+ TRIVY_SCAN_PATH : .
30+ TRIVY_EXIT_CODE : ' 1'
31+ TRIVY_VULN_TYPE : os,library
32+ TRIVY_SEVERITY : CRITICAL,HIGH
33+ steps :
34+ - uses : actions/checkout@v4
35+
36+ - name : Create report directory
37+ run : mkdir -p trivy-reports
38+
39+ - name : Run Trivy FS Scan
40+ uses : aquasecurity/trivy-action@0.24.0
41+ with :
42+ scan-type : ' fs'
43+ scan-ref : ' .'
44+ scanners : ' vuln,misconfig,secret,license'
45+ ignore-unfixed : true
46+ format : ' table'
47+ exit-code : ' 1'
48+ output : ' trivy-reports/trivy_scan_report.txt'
49+ vuln-type : ' os,library'
50+ severity : ' CRITICAL,HIGH'
51+
52+ - name : Upload Trivy Report
53+ uses : actions/upload-artifact@v4
54+ with :
55+ name : trivy-report
56+ path : trivy-reports/trivy_scan_report.txt
57+ - name : Show Trivy Report in Logs
58+ if : failure()
59+ run : |
60+ echo "========= TRIVY FINDINGS ========="
61+ cat trivy-reports/trivy_scan_report.txt
62+ echo "================================="
63+
64+ # -----------------------------
65+ # 2) Bandit Scan
66+ # -----------------------------
67+ bandit_scan :
68+ name : Bandit security scan
69+ runs-on : ubuntu-latest
70+ steps :
71+ - name : Checkout
72+ uses : actions/checkout@v4
73+ with :
74+ submodules : ' recursive'
75+ fetch-depth : 0
76+ - uses : actions/setup-python@v5
77+ with :
78+ python-version : " 3.x"
79+ - name : Install Bandit
80+ run : pip install bandit
81+ - name : Create Bandit configuration
82+ run : |
83+ cat > .bandit << 'EOF'
84+ [bandit]
85+ exclude_dirs = tests,test,venv,.venv,node_modules
86+ skips = B101
87+ EOF
88+ shell : bash
89+ - name : Run Bandit scan
90+ run : |
91+ bandit -r . -ll -iii -f screen
92+ bandit -r . -ll -iii -f html -o bandit-report.html
93+ - name : Upload Bandit Report
94+ uses : actions/upload-artifact@v4
95+ with :
96+ name : bandit-report
97+ path : bandit-report.html
98+ retention-days : 30
0 commit comments