Repository navigation
86 lines (74 loc) · 2.78 KB
/
Copy pathsecurity.yml
File metadata and controls
86 lines (74 loc) · 2.78 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
name: Security
on:
pull_request:
branches: [main]
push:
branches: [main]
schedule:
- cron: '17 5 * * 1' # weekly, Monday 05:17 UTC (new CVEs appear without code changes)
workflow_dispatch:
permissions:
contents: read
concurrency:
group: security-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
dependency-check:
name: OWASP dependency-check
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v7
- uses: ./.github/actions/setup-java-maven
# The NVD database is ~GBs to build from scratch; keep it between runs (refreshed weekly).
- name: Cache NVD data
uses: actions/cache@v6
with:
path: ~/.m2/repository/org/owasp/dependency-check-data
key: nvd-${{ runner.os }}-${{ github.run_id }}
restore-keys: nvd-${{ runner.os }}-
# The aggregate goal resolves every module's dependencies, so the inter-module SNAPSHOT
# artifacts must be in ~/.m2 first.
- name: Install modules (no tests)
run: mvn install -DskipTests
# ADVISORY until #131 (pre-existing high-severity transitive CVEs) is cleared: findings are
# reported (artifact) but never block a PR. To make it a gate: remove `continue-on-error`
# and add `-DfailBuildOnCVSS=8` to the command below.
- name: Run dependency-check (aggregate)
continue-on-error: true
env:
NVD_API_KEY: ${{ secrets.NVD_API_KEY }} # optional; without it NVD updates are slow
run: >-
mvn org.owasp:dependency-check-maven:aggregate
-Dformats=HTML,JSON,SARIF
${NVD_API_KEY:+-DnvdApiKey=$NVD_API_KEY}
- name: Upload dependency-check report
if: always()
uses: actions/upload-artifact@v7
with:
name: dependency-check-report
path: target/dependency-check-report.*
if-no-files-found: ignore
retention-days: 14
codeql:
name: CodeQL (java-kotlin)
runs-on: ubuntu-latest
timeout-minutes: 30
# Fork PRs cannot upload results (no security-events: write on their token).
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
permissions:
contents: read
security-events: write
steps:
- uses: actions/checkout@v7
# build-mode: none extracts Java without compiling, so it is independent of the JDK 25
# toolchain and needs no Maven build.
- name: Initialize CodeQL
uses: github/codeql-action/init@v4
with:
languages: java-kotlin
build-mode: none
- name: Analyze
uses: github/codeql-action/analyze@v4
with:
category: /language:java-kotlin