Skip to content

Commit 92abcd5

Browse files
committed
GH-247 OWASP Dependency-Checker setup
Signed-off-by: Uladzislau Kalesnikau <[email protected]>
1 parent 2d42049 commit 92abcd5

File tree

5 files changed

+489
-23
lines changed

5 files changed

+489
-23
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Original action got from https://github.com/ossf/scorecard/blob/main/.github/workflows/scorecard-analysis.yml
2+
3+
name: OWASP Dependency-Check analysis
4+
on:
5+
schedule:
6+
# Weekly on Tuesdays at 08:00 PM UTC
7+
- cron: '0 20 * * 2'
8+
workflow_dispatch:
9+
10+
# Visible only for the repository members
11+
permissions:
12+
contents: read
13+
actions: read
14+
security-events: write
15+
16+
jobs:
17+
dependency-check:
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
22+
- name: Set up JDK
23+
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
24+
with:
25+
java-version: '21'
26+
distribution: 'jetbrains'
27+
28+
- name: Run dependency check
29+
env:
30+
NVD_API_KEY: ${{ secrets.NVD_API_KEY }}
31+
run: ./gradlew dependencyCheckAnalyze -Dnvd.api.key=$NVD_API_KEY
32+
33+
- name: Upload Dependency Check Report
34+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
35+
if: always() # Load even if there are vulnerabilities
36+
with:
37+
name: dependency-check-report
38+
path: |
39+
${{ github.workspace }}/build/reports/dependency-check-report.html
40+
${{ github.workspace }}/build/reports/dependency-check-report.json
41+
${{ github.workspace }}/build/reports/dependency-check-report.xml
42+
retention-days: 5
43+
44+
# Upload the results to GitHub's code scanning dashboard (optional).
45+
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
46+
- name: Upload to GitHub Security Tab
47+
uses: github/codeql-action/upload-sarif@39edc492dbe16b1465b0cafca41432d857bdb31a # v3.29.1
48+
if: always() && hashFiles('${{ github.workspace }}/build/reports/dependency-check-report.sarif') != ''
49+
with:
50+
sarif_file: ${{ github.workspace }}/build/reports/dependency-check-report.sarif
51+
category: dependency-check

.github/workflows/scorecard.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,5 @@ jobs:
6767
- name: "Upload to code-scanning"
6868
uses: github/codeql-action/upload-sarif@39edc492dbe16b1465b0cafca41432d857bdb31a # v3.29.1
6969
with:
70-
sarif_file: results.sarif
70+
sarif_file: results.sarif
71+
category: scorecard

build.gradle.kts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,16 @@ kover {
214214
}
215215

216216
dependencyCheck {
217+
analyzers.apply {
218+
// Analyze only first-level dependencies, not internal JARs
219+
archiveEnabled = false
220+
}
221+
formats = listOf(
222+
"HTML",
223+
"SARIF",
224+
"JSON",
225+
"XML"
226+
)
217227
suppressionFiles = listOf("$projectDir/owasp-dependency-check-suppression.xml")
218228
}
219229

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ kotlinJvm = "1.9.22"
1919
sonarqube = "6.3.1.5724"
2020
changelog = "2.2.1"
2121
kover = "0.9.1"
22-
dependencycheck = "12.0.0"
22+
dependencycheck = "12.1.6"
2323

2424
[libraries]
2525
# build deps

0 commit comments

Comments
 (0)