Skip to content

Commit a7f24a5

Browse files
coopernetesclaude
andcommitted
feat: add OWASP dependency-check CVE scanning workflow
Adds CVE scanning via the org.owasp.dependencycheck Gradle plugin (v12.2.0) and a GitHub Actions workflow. - dependencyCheckAggregate task scans all subproject dependencies - NVD API key passed via secret, scoped to the scan step only - NVD database cached per run_id with restore-keys fallback to keep the cached DB incrementally up to date across runs - Suppression file and failOnCVSS=5 configured in build.gradle - CI/CVE status badges added to README Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 4549555 commit a7f24a5

4 files changed

Lines changed: 39 additions & 13 deletions

File tree

.github/workflows/cve.yml

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,29 @@ jobs:
1010
steps:
1111
- name: Checkout
1212
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # ratchet:actions/checkout@v6
13+
- uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # ratchet:actions/setup-java@v5
14+
with:
15+
distribution: temurin
16+
java-version: 21
17+
cache: gradle
1318
- name: Build project with Gradle
1419
run: ./gradlew clean testClasses
15-
- name: Depcheck
16-
uses: dependency-check/Dependency-Check_Action@1e54355a8b4c8abaa8cc7d0b70aa655a3bb15a6c
17-
id: Depcheck
20+
- name: Cache CVE data
21+
id: cache-cve
22+
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # ratchet:actions/cache@v5
1823
with:
19-
project: 'jgit-proxy'
20-
path: '.'
21-
format: 'HTML'
22-
out: 'reports' # this is the default, no need to specify unless you wish to override it
23-
args: >
24-
--suppression gradle-suppressions.xml
25-
--failOnCVSS 5
26-
--enableRetired
24+
path: ~/.gradle/dependency-check-data/
25+
key: depcheck-db-${{ github.run_id }}
26+
restore-keys: depcheck-db-
27+
- name: Depcheck
28+
run: ./gradlew dependencyCheckAggregate --info
29+
timeout-minutes: 180
30+
env:
31+
NVD_API_KEY: ${{ secrets.NVD_API_KEY }}
2732

2833
- name: Upload Test results
2934
if: ${{ always() }}
3035
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # ratchet:actions/upload-artifact@v7
3136
with:
3237
name: Depcheck report
33-
path: ${{ github.workspace }}/reports
38+
path: ${{ github.workspace }}/build/reports/dependency-check*

CLAUDE.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,16 @@ Configured via `database.type` in YAML. Supported: `memory`, `h2-mem`, `h2-file`
9090

9191
Always use fully qualified image names (e.g. `docker.io/eclipse-temurin:21-jre`). Podman on Fedora enforces short-name resolution and will error without a TTY if bare names are used.
9292

93+
## GitHub Actions workflows
94+
95+
All action steps must be pinned to a commit hash. After adding or updating any action reference in `.github/workflows/`, run:
96+
97+
```bash
98+
ratchet pin .github/workflows/<file>.yml
99+
```
100+
101+
This rewrites version tags (e.g. `@v5`) to their resolved commit SHA and adds a `# ratchet:` comment preserving the original tag for readability.
102+
93103
## Branch / PR target
94104

95105
Default branch for PRs: **`jetty`**

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
[![CI](https://github.com/coopernetes/jgit-proxy/actions/workflows/ci.yml/badge.svg)](https://github.com/coopernetes/jgit-proxy/actions/workflows/ci.yml)
2+
[![CVE Scanning](https://github.com/coopernetes/jgit-proxy/actions/workflows/cve.yml/badge.svg)](https://github.com/coopernetes/jgit-proxy/actions/workflows/cve.yml)
3+
14
# git-proxy in Java
25
This is a simple implementation of a git proxy in Java. This is a possible successor to [finos/git-proxy](https://github.com/finos/git-proxy) which is written in Node.
36

build.gradle

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
plugins {
22
id 'com.diffplug.spotless' version '8.4.0' apply false
3+
id 'org.owasp.dependencycheck' version '12.2.0'
34
}
45

56
ext {
@@ -16,8 +17,15 @@ allprojects {
1617
url 'https://repo.eclipse.org/content/groups/releases/'
1718
}
1819
}
20+
dependencyCheck {
21+
nvd.apiKey = System.getenv("NVD_API_KEY")
22+
failBuildOnCVSS = 5
23+
suppressionFile = rootProject.file('gradle-suppressions.xml').toString()
24+
25+
}
1926
}
2027

28+
2129
subprojects {
2230
apply plugin: 'com.diffplug.spotless'
2331

@@ -42,4 +50,4 @@ subprojects {
4250
finalizedBy jacocoTestReport
4351
}
4452
}
45-
}
53+
}

0 commit comments

Comments
 (0)