-
Notifications
You must be signed in to change notification settings - Fork 329
108 lines (93 loc) · 3.02 KB
/
Copy pathci.yml
File metadata and controls
108 lines (93 loc) · 3.02 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: CI - Security Scanning
on:
workflow_call:
permissions:
contents: read
security-events: write
jobs:
# ============================================================
# GATE 1: SECRET SCANNING (Gitleaks)
# ============================================================
gitleaks:
name: Secret Scan - Gitleaks
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Gitleaks needs full history to scan all commits
- name: Run Gitleaks
uses: gitleaks/gitleaks-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# ============================================================
# GATE 2: LINT - Java Checkstyle
# ============================================================
lint:
name: Lint - Checkstyle
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: maven
- name: Run Checkstyle
run: mvn checkstyle:check || true # Audit mode for now to avoid blocking on style
# ============================================================
# GATE 3: SAST - Static Application Security Testing
# ============================================================
sast:
name: SAST - Semgrep
runs-on: ubuntu-latest
needs: [gitleaks, lint]
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Run Semgrep SAST Scan
uses: semgrep/semgrep-action@v1
with:
config: >-
p/java
p/owasp-top-ten
p/secrets
# ============================================================
# GATE 4: SCA - Software Composition Analysis
# ============================================================
sca:
name: SCA - OWASP Dependency Check
runs-on: ubuntu-latest
needs: [gitleaks, lint]
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: maven
- name: Cache OWASP NVD Database
uses: actions/cache@v4
with:
path: ~/.m2/repository/org/owasp/dependency-check-data
key: owasp-nvd-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
restore-keys: |
owasp-nvd-${{ runner.os }}-
- name: Run OWASP Dependency Check
env:
NVD_API_KEY: ${{ secrets.NVD_API_KEY }}
run: |
mvn org.owasp:dependency-check-maven:check \
-DfailBuildOnCVSS=7 \
-DnvdApiKey="${NVD_API_KEY}" \
-DsuppressionFile=suppression.xml
- name: Upload Dependency Check Report
uses: actions/upload-artifact@v4
if: always()
with:
name: owasp-dependency-check-report
path: target/dependency-check-report.html