-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (73 loc) · 2.45 KB
/
Copy pathsecurity-scan.yml
File metadata and controls
88 lines (73 loc) · 2.45 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
# Runs OWASP Dependency-Check and SpotBugs SARIF upload every Monday at
# 03:00 UTC and on manual dispatch.
#
# SpotBugs results are uploaded to GitHub Code Scanning so findings appear
# in the Security tab and as PR diff annotations.
#
# MethodAtlas AI self-analysis runs separately on every push to main via
# pages.yml → methodatlas-analysis.yml using GitHub Models (no secrets needed).
name: Security scan
on:
schedule:
- cron: '0 3 * * 1' # Every Monday at 03:00 UTC
workflow_dispatch:
permissions:
contents: read
security-events: write # required to upload SARIF to Code Scanning
jobs:
dependency-check:
name: OWASP Dependency-Check
runs-on: ubuntu-latest
env:
NVD_API_KEY: ${{ secrets.NVD_API_KEY }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 21 (Temurin)
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Cache NVD database
uses: actions/cache@v4
with:
path: ~/.gradle/dependency-check-data
key: nvd-db-${{ runner.os }}-${{ github.run_id }}
restore-keys: nvd-db-${{ runner.os }}-
- name: Run OWASP Dependency-Check
if: ${{ env.NVD_API_KEY != '' }}
run: ./gradlew dependencyCheckAnalyze
- name: Upload Dependency-Check report
uses: actions/upload-artifact@v4
if: ${{ env.NVD_API_KEY != '' }}
with:
name: dependency-check-report
path: build/reports/dependency-check-report.*
retention-days: 30
code-scanning:
name: Code scanning (SpotBugs)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 21 (Temurin)
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
# SpotBugs is configured to emit SARIF alongside HTML (build.gradle).
- name: Run SpotBugs (produces SARIF)
run: ./gradlew spotbugsMain
- name: Upload SpotBugs SARIF to Code Scanning
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: build/reports/spotbugs/main.sarif
category: spotbugs