OWASP Dependency-Check per Maven
Warum?
Finde bekannte CVEs in deinen JARs frühzeitig im Build. Erstlauf lädt die NVD-Daten (kann dauern), danach inkrementell.
Aktuellste Version & Doku
- Neueste Plugin-Version: siehe MvnRepository (Stand heute: 12.1.3).
- Offizielle Plugin-Doku (Ziele/Konfiguration): GitHub Pages.
- Projektseite (OWASP): Überblick/Downloads.
pom.xml ergänzen (minimal)
<build>
<plugins>
<plugin>
<groupId>org.owasp</groupId>
<artifactId>dependency-check-maven</artifactId>
<version>12.1.3</version>
<executions>
<execution>
<id>owasp-check</id>
<phase>verify</phase>
<goals><goal>check</goal></goals>
</execution>
</executions>
<!-- Optional: Reportformate/Output -->
<configuration>
<formats>
<format>HTML</format>
<format>XML</format>
</formats>
<!-- Standard ist 'target'; hier nur explizit gesetzt -->
<outputDirectory>${project.build.directory}</outputDirectory>
<nvdApiKey>${nvdApiKey}</nvdApiKey>
</configuration>
</plugin>
</plugins>
</build>
NVD API-Key besorgen
- Key kostenlos beantragen: NVD „Request an API Key“.
Variante A: settings.xml (empfohlen)
~/.m2/settings.xml:
<settings>
<profiles>
<profile>
<id>owasp-dependency-check</id>
<properties>
<nvdApiKey>DEIN_API_KEY</nvdApiKey>
</properties>
</profile>
</profiles>
<activeProfiles>
<activeProfile>owasp-dependency-check</activeProfile>
</activeProfiles>
</settings>
pom.xml wie oben (liest ${nvdApiKey}).
Variante B: Umgebungsvariable
- Linux/macOS:
export NVD_API_KEY=DEIN_API_KEY - Windows (PowerShell):
$env:NVD_API_KEY="DEIN_API_KEY"
pom.xml:
<nvdApiKey>${env.NVD_API_KEY}</nvdApiKey>
Check starten
mvn clean verify -DskipTests
- Ziel
verifytriggert das Plugin-Goalcheck. -DskipTestsoptional, beschleunigt Builds.
Wo liegt der Report? Wie lesen?
- Standardpfad:
target/dependency-check-report.html(+.xml/.jsonwenn konfiguriert).
Der Ausgabepfad ist peroutputDirectorykonfigurierbar; Default isttarget.
Interpretation (HTML-Report):
- Severity / CVSS je Fund, verlinkte CVE-IDs.
- Dependency, zugeordnete CPEs, Evidenzen.
Was tun bei Treffern?
- Upgrade auf gefixte Version.
- Transitive Abhängigkeit: Version übersteuern/excluden.
- False Positive: Suppression file nutzen (
suppressionFile/suppressionFilesin der Plugin-Konfiguration).
Optional: Build bei hohen Risiken bremsen
<configuration>
<failBuildOnCVSS>7.0</failBuildOnCVSS> <!-- ab High/7.0 failen -->
<!-- oder granular mit <failOnError>false</failOnError> etc. -->
</configuration>
Kurzfazit
- Einmal Plugin einbauen, NVD-Key hinterlegen → reproduzierbare, schnelle CVE-Checks im
verify. - Report in
target/…prüfen, Dependencies aktualisieren, Suppressions sparsam verwenden.
Nachtrag: Sonatype OSS Index
Account anlegen auf: https://ossindex.sonatype.org/
In den User Settings kann man dann den API-Key auslesen.
~/.m2/settings.xml:
<settings>
<servers>
<server>
<id>ossindex</id>
<username>your.email@example.com</username>
<password>2ab4c0de-1234-5678-90ff-abcdefabcdef</password>
</server>
</servers>
</settings>
pom.xml:
<plugin>
<groupId>org.owasp</groupId>
<artifactId>dependency-check-maven</artifactId>
<version>12.1.3</version>
<configuration>
<ossIndexServerId>ossindex</ossIndexServerId>
</configuration>
</plugin>



























































