Skip to content

Commit c02dd2a

Browse files
authored
Merge pull request #282 from marklogic/feature/dependency-check
Added support for detecting dependency vulnerabilities
2 parents 7772ae7 + 248fc0d commit c02dd2a

File tree

6 files changed

+53
-4
lines changed

6 files changed

+53
-4
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,7 @@ logs
1616
.ipynb_checkpoints
1717
venv
1818
.venv
19-
docker
19+
docker/marklogic
20+
docker/sonarqube/data
21+
docker/sonarqube/logs
2022
export

CONTRIBUTING.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ you've introduced on the feature branch you're working on. You can then click on
8383
Note that if you only need results on code smells and vulnerabilities, you can repeatedly run `./gradlew sonar`
8484
without having to re-run the tests.
8585

86+
Our Sonar instance is also configured to scan for dependency vulnerabilities
87+
[via the dependency-check plugin](https://github.com/dependency-check/dependency-check-sonar-plugin). For more
88+
information, see the `dependencyCheck` block in this project's `build.gradle` file.
89+
8690
## Accessing MarkLogic logs in Grafana
8791

8892
This project's `docker-compose-3nodes.yaml` file includes

build.gradle

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ plugins {
77
id 'signing'
88
id "jacoco"
99
id "org.sonarqube" version "4.4.1.3373"
10+
id "org.owasp.dependencycheck" version "10.0.3"
1011
}
1112

1213
group 'com.marklogic'
@@ -88,6 +89,16 @@ dependencies {
8889
testImplementation "org.skyscreamer:jsonassert:1.5.1"
8990
}
9091

92+
// See https://jeremylong.github.io/DependencyCheck/dependency-check-gradle/configuration.html for more information.
93+
dependencyCheck {
94+
// Need a JSON report to integrate with Sonar. And HTML is easier for humans to read.
95+
formats = ["HTML", "JSON"]
96+
// We don't include compileOnly since that includes Spark, and Spark and its dependencies are not actual dependencies
97+
// of our connector.
98+
scanConfigurations = ["shadowDependencies"]
99+
suppressionFile = "config/dependency-check-suppressions.xml"
100+
}
101+
91102
test {
92103
useJUnitPlatform()
93104
finalizedBy jacocoTestReport
@@ -106,6 +117,8 @@ sonar {
106117
properties {
107118
property "sonar.projectKey", "marklogic-spark"
108119
property "sonar.host.url", "http://localhost:9000"
120+
// See https://github.com/dependency-check/dependency-check-sonar-plugin for more information.
121+
property "sonar.dependencyCheck.jsonReportPath", "build/reports/dependency-check-report.json"
109122
}
110123
}
111124

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<suppressions xmlns="https://jeremylong.github.io/DependencyCheck/dependency-suppression.1.3.xsd">
3+
<suppress>
4+
<notes><![CDATA[
5+
file name: jackson-databind-2.14.3.jar
6+
7+
See https://nvd.nist.gov/vuln/detail/CVE-2023-35116 and https://github.com/FasterXML/jackson-databind/issues/3972 .
8+
The Jackson team heartily refutes that this is a vulnerability, and we agree.
9+
]]></notes>
10+
<packageUrl regex="true">^pkg:maven/com\.fasterxml\.jackson\.core/jackson-databind@.*$</packageUrl>
11+
<cve>CVE-2023-35116</cve>
12+
</suppress>
13+
<suppress>
14+
<notes><![CDATA[
15+
file name: commons-compress-1.24.0.jar
16+
This is brought in by Jena 4.10. It's a medium, and we don't want to interfere with Jena dependencies.
17+
]]></notes>
18+
<packageUrl regex="true">^pkg:maven/org\.apache\.commons/commons-compress@.*$</packageUrl>
19+
<cve>CVE-2024-25710</cve>
20+
</suppress>
21+
<suppress>
22+
<notes><![CDATA[
23+
file name: commons-compress-1.24.0.jar
24+
This is brought in by Jena 4.10. It's a medium, and we don't want to interfere with Jena dependencies.
25+
]]></notes>
26+
<packageUrl regex="true">^pkg:maven/org\.apache\.commons/commons-compress@.*$</packageUrl>
27+
<cve>CVE-2024-26308</cve>
28+
</suppress>
29+
</suppressions>

docker-compose.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@ services:
2828
SONAR_JDBC_USERNAME: sonar
2929
SONAR_JDBC_PASSWORD: sonar
3030
volumes:
31-
- sonarqube_data:/opt/sonarqube/data
32-
- sonarqube_extensions:/opt/sonarqube/extensions
33-
- sonarqube_logs:/opt/sonarqube/logs
31+
- ./docker/sonarqube/data:/opt/sonarqube/data
32+
- ./docker/sonarqube/logs:/opt/sonarqube/logs
33+
# Allows for Sonar plugins to be installed by including plugin jar files in this directory.
34+
- ./docker/sonarqube/extensions:/opt/sonarqube/extensions
3435
ports:
3536
- "9000:9000"
3637

Binary file not shown.

0 commit comments

Comments
 (0)