Skip to content

Commit 20d316c

Browse files
committed
update dependecy-check to 9.0.4 and refactor it to own workflow
1 parent 527e8af commit 20d316c

File tree

3 files changed

+58
-4
lines changed

3 files changed

+58
-4
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ jobs:
1717
if: startsWith(github.ref, 'refs/tags/')
1818
shell: bash
1919
run: |
20-
mvn versions:set --file ./pom.xml -DnewVersion=${GITHUB_REF##*/}
20+
mvn -B versions:set --file ./pom.xml -DnewVersion=${GITHUB_REF##*/}
2121
- name: Build and Test
2222
id: buildAndTest
23-
run: mvn -B clean install -Pdependency-check
23+
run: mvn -B clean install
2424
- uses: actions/upload-artifact@v3
2525
with:
2626
name: artifacts
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: OWASP Maven Dependency Check
2+
on:
3+
schedule:
4+
- cron: '0 7 * * 0'
5+
push:
6+
branches:
7+
- 'release/**'
8+
workflow_dispatch:
9+
10+
11+
jobs:
12+
check-dependencies:
13+
name: Check dependencies
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
show-progress: false
19+
- name: Setup Java
20+
uses: actions/setup-java@v4
21+
with:
22+
distribution: 'temurin'
23+
java-version: 21
24+
cache: 'maven'
25+
- name: Run org.owasp:dependency-check plugin
26+
id: dependency-check
27+
continue-on-error: true
28+
run: mvn -B verify -Pdependency-check -DskipTests
29+
env:
30+
NVD_API_KEY: ${{ secrets.NVD_API_KEY }}
31+
- name: Upload report on failure
32+
if: steps.dependency-check.outcome == 'failure'
33+
uses: actions/upload-artifact@v3
34+
with:
35+
name: dependency-check-report
36+
path: target/dependency-check-report.html
37+
if-no-files-found: error
38+
- name: Slack Notification on regular check
39+
if: github.event_name == 'schedule' && steps.dependency-check.outcome == 'failure'
40+
uses: rtCamp/action-slack-notify@v2
41+
env:
42+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
43+
SLACK_USERNAME: 'Cryptobot'
44+
SLACK_ICON: false
45+
SLACK_ICON_EMOJI: ':bot:'
46+
SLACK_CHANNEL: 'cryptomator-desktop'
47+
SLACK_TITLE: "Vulnerabilities in ${{ github.event.repository.name }} detected."
48+
SLACK_MESSAGE: "Download the <https://github.com/${{ github.repository }}/actions/run/${{ github.run_id }}|report> for more details."
49+
SLACK_FOOTER: false
50+
MSG_MINIMAL: true
51+
- name: Failing workflow on release branch
52+
if: github.event_name == 'push' && steps.dependency-check.outcome == 'failure'
53+
shell: bash
54+
run: exit 1

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
<junit.version>5.10.1</junit.version>
5151

5252
<!-- build plugin dependencies -->
53-
<dependency-check.version>8.4.2</dependency-check.version>
53+
<dependency-check.version>9.0.4</dependency-check.version>
5454
<nexus-staging.version>1.6.8</nexus-staging.version>
5555
</properties>
5656

@@ -211,11 +211,11 @@
211211
<artifactId>dependency-check-maven</artifactId>
212212
<version>${dependency-check.version}</version>
213213
<configuration>
214-
<cveValidForHours>24</cveValidForHours>
215214
<failBuildOnCVSS>0</failBuildOnCVSS>
216215
<skipTestScope>true</skipTestScope>
217216
<detail>true</detail>
218217
<suppressionFile>suppression.xml</suppressionFile>
218+
<nvdApiKey>${env.NVD_API_KEY}</nvdApiKey>
219219
</configuration>
220220
<executions>
221221
<execution>

0 commit comments

Comments
 (0)