Skip to content

Commit cd95517

Browse files
authored
Add OWASP dependency check (open-telemetry#6978)
See comment in the github action that explains why I think this is helpful: > the benefit of this over dependabot is that this also analyzes transitive dependencies > while dependabot (at least currently) only analyzes top-level dependencies
1 parent 56229fb commit cd95517

File tree

4 files changed

+48
-0
lines changed

4 files changed

+48
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# the benefit of this over dependabot is that this also analyzes transitive dependencies
2+
# while dependabot (at least currently) only analyzes top-level dependencies
3+
name: OWASP dependency check (daily)
4+
5+
on:
6+
schedule:
7+
- cron: '30 1 * * *'
8+
workflow_dispatch:
9+
10+
jobs:
11+
analyze:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v3
16+
17+
- name: Set up Java 11
18+
uses: actions/setup-java@v3
19+
with:
20+
distribution: temurin
21+
java-version: 11
22+
23+
- uses: gradle/gradle-build-action@v2
24+
with:
25+
arguments: ":javaagent:dependencyCheckAnalyze"
26+
27+
- name: Upload report
28+
if: always()
29+
uses: actions/upload-artifact@v3
30+
with:
31+
path: javaagent/build/reports
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<suppressions xmlns="https://jeremylong.github.io/DependencyCheck/dependency-suppression.1.3.xsd">
3+
<suppress>
4+
<!-- this suppresses opentelemetry instrumentation modules and artifacts which get misidentified
5+
as real dependencies like dubbo and prometheus -->
6+
<packageUrl regex="true">^pkg:maven/io\.opentelemetry[./].*</packageUrl>
7+
<vulnerabilityName regex="true">^CVE-.*</vulnerabilityName>
8+
</suppress>
9+
</suppressions>

conventions/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ dependencies {
4646
implementation("org.ow2.asm:asm-tree:9.4")
4747
implementation("org.apache.httpcomponents:httpclient:4.5.13")
4848
implementation("org.gradle:test-retry-gradle-plugin:1.4.1")
49+
implementation("org.owasp:dependency-check-gradle:7.3.0")
4950
implementation("ru.vyarus:gradle-animalsniffer-plugin:1.6.0")
5051
// When updating, also update dependencyManagement/build.gradle.kts
5152
implementation("net.bytebuddy:byte-buddy-gradle-plugin:1.12.18")

conventions/src/main/kotlin/otel.java-conventions.gradle.kts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ plugins {
1313

1414
id("otel.errorprone-conventions")
1515
id("otel.spotless-conventions")
16+
id("org.owasp.dependencycheck")
1617
}
1718

1819
val otelJava = extensions.create<OtelJavaExtension>("otelJava")
@@ -355,6 +356,12 @@ checkstyle {
355356
maxWarnings = 0
356357
}
357358

359+
dependencyCheck {
360+
skipConfigurations = listOf("errorprone", "checkstyle", "annotationProcessor")
361+
suppressionFile = "buildscripts/dependency-check-suppressions.xml"
362+
failBuildOnCVSS = 7.0f // fail on high or critical CVE
363+
}
364+
358365
idea {
359366
module {
360367
isDownloadJavadoc = false

0 commit comments

Comments
 (0)