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 the ability to perform a dependency check scan. #37

Merged
merged 8 commits into from
Oct 27, 2023
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
41 changes: 41 additions & 0 deletions .github/workflows/dependency-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Dependency Check

on:
schedule:
- cron: "34 14 * * 2"
workflow_dispatch:

jobs:
dep-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/cache@v3
with:
path: ~/.gradle
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-

- uses: ruby/setup-ruby@v1
with:
ruby-version: .tool-versions
bundler-cache: true
- run: |
bundle install
gem install bundler-audit
bundle-audit update

- uses: actions/setup-java@v3
with:
distribution: "temurin"
marcantoinefortier marked this conversation as resolved.
Show resolved Hide resolved
java-version: "17"

- run: chmod +x gradlew

- run: ./gradlew dependencyCheckAggregate

- uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: reports/dependency-check-report.sarif
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ started:
| Declarative UI framework | [`trikot-viewmodels-declarative-flow`](https://github.com/mirego/trikot/tree/master/trikot-viewmodels-declarative-flow) |
| Date & time | [`kotlinx-datetime`](https://github.com/Kotlin/kotlinx-datetime) |

## OWASP Dependency-Check

[OWASP Dependency-Check](http://jeremylong.github.io/DependencyCheck/index.html) is installed as a Gradle plugin to scan your project to identify the use of known vulnerable components. It mainly checks for vulnerabilities in Gradle dependencies, but if [bundle-audit](https://github.com/rubysec/bundler-audit) is present on the system, it will also scan the Ruby Gems dependencies. It also has the capabiligh to scan for Cocoapods/Swift Package Manager dependencies if executed on a macOS system.

## License

Kmp Boilerplate is © 2023 [Mirego](https://www.mirego.com) and may be freely distributed under
Expand Down
4 changes: 4 additions & 0 deletions boilerplate-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ header "Removing boilerplate license → https://choosealicense.com"
run rm -fr LICENSE.md
success "Done!\n"

header "Changing the Dependency-Check report format to HTML"
run sed -i '' 's/SARIF/HTML/' build.gradle.kts
success "Done!\n"

header "Removing boilerplate setup script..."
run rm -fr boilerplate-setup.sh
success "Done!\n"
13 changes: 13 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,21 @@ plugins {
alias(libs.plugins.kotlin.native.cocoapods) apply false
alias(libs.plugins.serialization) apply false
alias(libs.plugins.ktlint) apply false

alias(libs.plugins.owasp.dependencycheck)
}

tasks.register("clean", Delete::class) {
delete(rootProject.buildDir)
}

dependencyCheck {
format = "SARIF"
outputDirectory = "reports"

analyzers.apply {
assemblyEnabled = false
experimentalEnabled = true
knownExploitedEnabled = true
}
}
3 changes: 2 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ android-library = { id = "com.android.library", version.ref = "androidGradlePlug
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
kotlin-native-cocoapods = { id = "org.jetbrains.kotlin.native.cocoapods", version.ref = "kotlin" }
serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlint" }
owasp-dependencycheck = { id = "org.owasp.dependencycheck", version = "8.4.2" }
serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }

[bundles]

Loading