Skip to content

Commit 1e08ada

Browse files
authored
Merge pull request #2255 from OWASP/depchecksettings
Fix for oss index scanning
2 parents c5e4fb9 + f9d8b0f commit 1e08ada

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed

README.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,69 @@ Want to check why something in vault is not working in kubernetes? Do `kubectl e
573573
We have CycloneDX and OWASP Dependency-check integrated to check dependencies for vulnerabilities.
574574
You can use the OWASP Dependency-checker by calling `mvn dependency-check:aggregate` and `mvn cyclonedx:makeBom` to use CycloneDX to create an SBOM.
575575

576+
### Dependency-Check Maven Plugin Configuration
577+
578+
OWASP WrongSecrets uses the [`dependency-check-maven`](https://jeremylong.github.io/DependencyCheck/dependency-check-maven/index.html) plugin to automatically scan project dependencies for known vulnerabilities (CVEs).
579+
580+
#### How It Works
581+
582+
- The plugin runs during the Maven build (`./mvnw clean install`) and checks all dependencies against public vulnerability databases.
583+
- By default, it uses the NVD (National Vulnerability Database) and can also use OSS Index for additional coverage.
584+
585+
#### Configuration Highlights
586+
587+
The plugin is configured in `pom.xml` under the `<build><plugins>` section:
588+
589+
```xml
590+
<plugin>
591+
<groupId>org.owasp</groupId>
592+
<artifactId>dependency-check-maven</artifactId>
593+
<version>${dependency-check-maven.version}</version>
594+
<configuration>
595+
<nvdApiKey>...</nvdApiKey>
596+
<assemblyAnalyzerEnabled>false</assemblyAnalyzerEnabled>
597+
<ossIndexServerId>ossindex</ossIndexServerId>
598+
<ossindexAnalyzerEnabled>true</ossindexAnalyzerEnabled> <!-- SET THIS TO FALSE IF YOU HAVE NO SONATYPE ACCOUNT! -->
599+
</configuration>
600+
<executions>
601+
<execution>
602+
<goals>
603+
<goal>check</goal>
604+
</goals>
605+
</execution>
606+
</executions>
607+
</plugin>
608+
```
609+
610+
- **nvdApiKey**: API key for accessing the NVD database (recommended for faster and more reliable scans).
611+
- **ossIndexServerId**: References credentials in your Maven `settings.xml` for OSS Index (see below).
612+
- **ossindexAnalyzerEnabled**: Set to `true` to enable OSS Index scanning. If you encounter authentication errors (401), set this to `false` to disable OSS Index.
613+
614+
#### Authenticating with OSS Index
615+
616+
To use OSS Index, you need to add your credentials to your Maven `settings.xml`:
617+
618+
```xml
619+
<servers>
620+
<server>
621+
<id>ossindex</id>
622+
<username>YOUR_OSSINDEX_USERNAME</username>
623+
<password>YOUR_OSSINDEX_API_TOKEN</password>
624+
</server>
625+
</servers>
626+
```
627+
628+
Replace `YOUR_OSSINDEX_USERNAME` and `YOUR_OSSINDEX_API_TOKEN` with your OSS Index account details.
629+
630+
#### Troubleshooting
631+
632+
- If you see `401 Unauthorized` errors for OSS Index, check your credentials or disable OSS Index by setting `<ossindexAnalyzerEnabled>false</ossindexAnalyzerEnabled>` in `pom.xml`.
633+
- You can always run the build without OSS Index if you prefer only NVD-based scanning.
634+
635+
#### More Info
636+
637+
See [Dependency-Check Maven Plugin Documentation](https://jeremylong.github.io/DependencyCheck/dependency-check-maven/index.html) for advanced configuration options.
638+
576639
### Get the project started in IntelliJ IDEA
577640

578641
Requirements: make sure you have the following tools installed: [Docker](https://www.docker.com/products/docker-desktop/), [Java23 JDK](https://jdk.java.net/23/), [NodeJS 24](https://nodejs.org/en/download/current) and [IntelliJ IDEA](https://www.jetbrains.com/idea/download).

pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,10 @@
469469
<configuration>
470470
<nvdApiKey>27a3071a-9d40-42f2-ac92-74bebbc4bdeb</nvdApiKey>
471471
<assemblyAnalyzerEnabled>false</assemblyAnalyzerEnabled>
472+
<ossIndexServerId>ossindex</ossIndexServerId>
473+
<!-- server id configured in settings.xml-->
474+
<ossindexAnalyzerEnabled>true</ossindexAnalyzerEnabled>
475+
<!--disable when getting 401 errors-->
472476
</configuration>
473477
<executions>
474478
<execution>

0 commit comments

Comments
 (0)