Skip to content

Commit d4abd9d

Browse files
chore: [DevOps] Update OWASP Workflow (#190)
* Update workflow * Updated CVE Check Process * update schedule * Add missing API key * Update .github/workflows/fosstars-report.yml Co-authored-by: Charles Dubois <[email protected]> * Update .github/workflows/fosstars-report.yml Co-authored-by: Charles Dubois <[email protected]> * Exclude provided scope --------- Co-authored-by: Charles Dubois <[email protected]>
1 parent 104dff0 commit d4abd9d

File tree

3 files changed

+43
-70
lines changed

3 files changed

+43
-70
lines changed

.github/workflows/fosstars-report.yml

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@ name: "Fosstars (Security)"
22
on:
33
workflow_dispatch:
44
schedule:
5-
- cron: "0 0 * * *" # every day at midnight
5+
- cron: '42 03 * * MON-FRI' # 03:42 on weekdays, a somewhat random time to avoid producing load spikes on the GH actions infrastructure
66

77
env:
88
MVN_MULTI_THREADED_ARGS: --batch-mode --no-transfer-progress --fail-at-end --show-version --threads 1C
99
JAVA_VERSION: 17
10+
CVE_CACHE_KEY: cve-db
11+
CVE_CACHE_DIR: ~/.m2/repository/org/owasp/dependency-check-data
12+
CVE_CACHE_REF: refs/heads/main
1013

1114
jobs:
1215
create_fosstars_report:
@@ -22,29 +25,47 @@ jobs:
2225
distribution: "temurin"
2326
java-version: ${{ env.JAVA_VERSION }}
2427
cache: 'maven'
28+
2529
- name: Restore CVE Database
2630
uses: actions/cache/restore@v4
2731
with:
2832
path: ${{ env.CVE_CACHE_DIR }}
2933
key: ${{ env.CVE_CACHE_KEY }}
30-
fail-on-cache-miss: true
34+
# fail-on-cache-miss: true
3135

3236
- name: "Build SDK"
3337
run: |
3438
MVN_ARGS="${{ env.MVN_MULTI_THREADED_ARGS }} clean install -DskipTests -DskipFormatting"
3539
mvn $MVN_ARGS
3640
37-
- name: "OWASP Dependency check"
38-
run: mvn org.owasp:dependency-check-maven:10.0.4:check -DnvdApiKey=$NVD_API_KEY -DfailBuildOnCVSS=7 -DskipProvidedScope=true -DsuppressionFile=.pipeline/dependency-check-suppression.xml
39-
env:
40-
NVD_API_KEY: ${{ secrets.NVD_API_KEY }}
41-
42-
- name: "Fosstars rating"
41+
- name: "Fosstars Rating"
4342
4443
with:
4544
report-branch: fosstars-report
4645
token: ${{ secrets.GITHUB_TOKEN }}
4746

47+
- name: "CVE Scan"
48+
env:
49+
NVD_API_KEY: ${{ secrets.NVD_API_KEY }}
50+
run: |
51+
mvn -T1 --no-transfer-progress dependency-check:check
52+
53+
- name: Delete Old CVE Cache
54+
run: |
55+
CACHE_IDS=$(gh cache list --key "${{ env.CVE_CACHE_KEY }}" --ref "${{ env.CVE_CACHE_REF }}" --json id | jq -r '.[] | .id')
56+
for CACHE_ID in $CACHE_IDS; do
57+
echo "Deleting cache with ID: $CACHE_ID"
58+
gh cache delete "${CACHE_ID}"
59+
done
60+
env:
61+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62+
63+
- name: Create Updated CVE Cache
64+
uses: actions/cache/save@v4
65+
with:
66+
path: ${{ env.CVE_CACHE_DIR }}
67+
key: ${{ env.CVE_CACHE_KEY }}
68+
4869
- name: "Slack Notification"
4970
if: failure()
5071
uses: slackapi/[email protected]

.github/workflows/update-vulnerability-database.yaml

Lines changed: 0 additions & 62 deletions
This file was deleted.

pom.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,20 @@ https://gitbox.apache.org/repos/asf?p=maven-pmd-plugin.git;a=blob_plain;f=src/ma
587587
<artifactId>maven-resources-plugin</artifactId>
588588
<version>3.3.1</version>
589589
</plugin>
590+
<plugin>
591+
<groupId>org.owasp</groupId>
592+
<artifactId>dependency-check-maven</artifactId>
593+
<version>11.1.0</version>
594+
<configuration>
595+
<connectionTimeout>60000</connectionTimeout>
596+
<nvdMaxRetryCount>10</nvdMaxRetryCount>
597+
<failBuildOnCVSS>7</failBuildOnCVSS>
598+
<nvdApiKeyEnvironmentVariable>NVD_API_KEY</nvdApiKeyEnvironmentVariable>
599+
<suppressionFile>${project.rootdir}/.pipeline/dependency-check-suppression.xml</suppressionFile>
600+
<nvdValidForHours>46</nvdValidForHours>
601+
<skipProvidedScope>true</skipProvidedScope>
602+
</configuration>
603+
</plugin>
590604
<plugin>
591605
<groupId>org.codehaus.mojo</groupId>
592606
<artifactId>license-maven-plugin</artifactId>

0 commit comments

Comments
 (0)