Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a GitHub Action to automatically scan for vulnerable dependencies #209

Merged
merged 2 commits into from
Oct 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/scan_dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: OWASP Dependency-Check

on:
push:
branches:
- main
pull_request:
branches:
- "*"

jobs:
dependency-check:
name: Run OWASP Dependency-Check with GraalVM Java 21
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Set up GraalVM Java 21
uses: graalvm/setup-graalvm@v1
with:
java-version: '21'

- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper/
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-

- name: Build Project
run: ./gradlew build --no-daemon

- name: Run OWASP Dependency-Check
run: ./gradlew dependencyCheckAnalyze

- name: Upload Dependency-Check Report
uses: actions/upload-artifact@v3
with:
name: dependency-check-report
path: build/reports/dependency-check-report/dependency-check-report.html

- name: Fail if high vulnerabilities found
if: failure()
run: echo "High severity vulnerabilities found! Check the Dependency-Check report."
5 changes: 5 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,11 @@ dependencies {
testImplementation("com.squareup.okhttp3:mockwebserver:5.0.0-alpha.14")
}

dependencyCheck {
format = 'HTML'
outputDirectory = 'build/reports/dependency-check-report' // Change to match expected location
}

// Apply a specific Java toolchain to ease working on different environments.
java {
toolchain {
Expand Down
Loading