Skip to content

Commit e0c0d02

Browse files
committed
Add OWASP DB Cache
1 parent c96edd0 commit e0c0d02

File tree

2 files changed

+54
-1
lines changed

2 files changed

+54
-1
lines changed

.github/workflows/fosstars-report.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ jobs:
2222
distribution: "temurin"
2323
java-version: ${{ env.JAVA_VERSION }}
2424
cache: 'maven'
25-
25+
- name: Restore CVE Database
26+
uses: actions/cache/restore@v4
27+
with:
28+
path: ~/.m2/repository/org/owasp/dependency-check-data
29+
key: cve-db
30+
fail-on-cache-miss: true
2631
- name: "Build SDK"
2732
run: |
2833
MVN_ARGS="${{ env.MVN_MULTI_THREADED_ARGS }} clean install -DskipTests -DskipFormatting"
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Update Vulnerability Database
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: '17 5 * * *' # use a somewhat random time to avoid producing load spikes on the GH actions infrastructure
7+
8+
env:
9+
CVE_CACHE_REF: refs/heads/main
10+
CVE_CACHE_KEY: cve-db
11+
CVE_CACHE_DIR: ~/.m2/repository/org/owasp/dependency-check-data
12+
13+
jobs:
14+
update-vulnerability-database:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: write
18+
steps:
19+
- uses: actions/checkout@v4
20+
with:
21+
ref: ${{ env.CVE_CACHE_REF }}
22+
- name: Restore Existing Cache
23+
uses: actions/cache/restore@v4
24+
with:
25+
path: ${{ env.CVE_CACHE_DIR }}
26+
key: ${{ env.CVE_CACHE_KEY }}
27+
28+
- name: Run Maven Plugin
29+
run: |
30+
mvn org.owasp:dependency-check-maven:10.0.4:update-only -DnvdMaxRetryCount=10 -DnvdApiDelay=15000 -DconnectionTimeout=60000
31+
env:
32+
NVD_API_KEY: ${{ secrets.NVD_API_KEY }}
33+
34+
- name: Delete Cache
35+
run: |
36+
CACHE_IDS=$(gh cache list --key "${{ env.CVE_CACHE_KEY }}" --ref "${{ env.CVE_CACHE_REF }}" --json id | jq -r '.[] | .id')
37+
for CACHE_ID in $CACHE_IDS; do
38+
echo "Deleting cache with ID: $CACHE_ID"
39+
gh cache delete "${CACHE_ID}"
40+
done
41+
env:
42+
GH_TOKEN: ${{ secrets.CLOUD_SDK_AT_SAP_ALL_ACCESS_PAT }}
43+
44+
- name: Cache CVE Database
45+
uses: actions/cache/save@v4
46+
with:
47+
path: ${{ env.CVE_CACHE_DIR }}
48+
key: ${{ env.CVE_CACHE_KEY }}

0 commit comments

Comments
 (0)