Skip to main content

Java Dependency Vulnerability Scanning: OWASP Dependency-Check vs Trivy vs OSV-Scanner

One Maven project scanned by OWASP Dependency-Check 13.0.0, Trivy 0.76.2 and OSV-Scanner 2.7.1: 35, 33 and 28 findings, why they differ, the false positives I could verify, suppression with expiry, CI gating and SBOM-based scanning. Real output from a real run.

One pipeline step says 35 known vulnerabilities, another says 33, a third says 28, and all three are looking at the same project. Which one do you believe? This page runs the three scanners Java teams actually choose between, OWASP Dependency-Check, Trivy and OSV-Scanner, on one small Maven project, and then explains every difference: which findings are real, which are false positives, which are gaps, and how to turn the result into a build gate you can live with. You do not need to know any of the tools. The first sections explain what a dependency scanner does and run each tool once. The middle sections compare the answers and trace each disagreement to a cause. The later sections cover ignore rules, CI gating, scanning an SBOM instead of the project, and what each tool costs to run. If you have already generated an SBOM, the SBOM article covers producing, reading and checking one; this page is about what happens when you point real scanners at the project, and it uses the SBOM as one of three inputs.
Tested with: OSV-Scanner 2.7.1 (osv-scalibr 0.5.3), Trivy 0.76.2 with a vulnerability database published 2026-11-28 19:00 UTC, OWASP Dependency-Check 13.0.0 (Maven plugin, the latest release on Maven Central; its NVD data was downloaded on 2026-11-29), JDK Temurin 25.0.5.1 (the latest LTS), Maven 3.9.11, cyclonedx-maven-plugin 2.9.3. Every number below comes from scripts/run-all.sh in java-devops-demo/vuln-scan, which writes the files under output/. These tools report against databases that change daily, so rerun it and your totals will differ; the causes of the differences will not. What was not run: Dependency-Check with an NVD API key (I had none, see below), Trivy image scanning, and the CI file on a real CI runner.

A scanner turns your dependencies into questions for a database

A dependency scanner does two things and nothing else. It works out which libraries at which versions you use, then asks a database which of those versions have a published advisory. Everything that makes the tools differ sits in those two steps: what they read to build the list, and which database they ask.
Three tools, three ways to turn your project into a database question OSV-Scanner 2.7.1pom.xml, SBOM or jars(jars need a plugin flag) Trivy 0.76.2pom.xml, SBOM or jars(all three out of the box) Dependency-Check 13.0.0jars (Maven plugin)no SBOM goal package coordinatespkg:maven/group/name@ver package coordinatespkg:maven/group/name@ver a guessed CPE product namecpe:2.3:a:apache:log4j:2.14.1 OSV databaseasked over HTTPS, nothing stored Trivy DBdownloaded, 1.8 GB on disk NVD data in a local H2 filebuilt once, 246 MB on disk Two tools look a package up by its exact coordinates. One recognises a jar by evidence and matches a product name, which is where its false positives come from.
The diagram shows the split. OSV-Scanner and Trivy turn the project into exact package coordinates (the pkg:maven/group/name@version form) and look those up. Dependency-Check works from jar files and has to recognise each one from evidence inside it, then match a product name from the NVD’s CPE list. You will see in the false-positive sections that this single difference explains most of the findings that only Dependency-Check reports and most of the ones it misses. Going deeper:

The project: eight jars, five of them chosen to be bad

The test subject is a tiny Maven application with deliberately old dependencies, so the scanners have something to find. The versions are Log4Shell-era log4j-core, Text4Shell-era commons-text, an old jackson-databind and snakeyaml, plus a vulnerable commons-collections in test scope. Never copy them. The relevant parts of pom.xml, first the versions (the fixed profile used later overrides them) and then the dependencies:
    <!-- Default (vulnerable) versions. The "fixed" profile below overrides them. -->
    <log4j.version>2.14.1</log4j.version>
    <commons-text.version>1.9</commons-text.version>
    <jackson.version>2.13.4</jackson.version>
    <snakeyaml.version>1.30</snakeyaml.version>
    <commons-lang3.version>3.11</commons-lang3.version>
    <!-- Log4Shell era. log4j-api 2.14.1 arrives transitively. -->
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-core</artifactId>
      <version>${log4j.version}</version>
    </dependency>
    <!-- Text4Shell era. commons-lang3 arrives transitively. -->
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-text</artifactId>
      <version>${commons-text.version}</version>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <version>${jackson.version}</version>
    </dependency>
    <!-- Declared but never called from the code: reachability is not what these tools measure. -->
    <dependency>
      <groupId>org.yaml</groupId>
      <artifactId>snakeyaml</artifactId>
      <version>${snakeyaml.version}</version>
    </dependency>
    <!-- test scope: never ships in the jar. -->
    <dependency>
      <groupId>commons-collections</groupId>
      <artifactId>commons-collections</artifactId>
      <version>3.2.1</version>
      <scope>test</scope>
    </dependency>
The Java class OrderApp.java uses log4j, commons-text and jackson, and never touches snakeyaml. That is on purpose: it gives us a library that is declared, shipped and flagged but never called. Here is what Maven resolves and what ships, from output/02-project.txt:
$ mvn dependency:tree
[INFO] com.ankurm.vulnscan:orders:jar:1.0.0
[INFO] +- org.apache.logging.log4j:log4j-core:jar:2.14.1:compile
[INFO] |  \- org.apache.logging.log4j:log4j-api:jar:2.14.1:compile
[INFO] +- org.apache.commons:commons-text:jar:1.9:compile
[INFO] |  \- org.apache.commons:commons-lang3:jar:3.11:compile
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.13.4:compile
[INFO] |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.13.4:compile
[INFO] |  \- com.fasterxml.jackson.core:jackson-core:jar:2.13.4:compile
[INFO] +- org.yaml:snakeyaml:jar:1.30:compile
[INFO] \- commons-collections:commons-collections:jar:3.2.1:test
And the jars that ship (output/02-project.txt):
$ ls target/lib   (what ships: runtime scope only)
commons-lang3-3.11.jar
commons-text-1.9.jar
jackson-annotations-2.13.4.jar
jackson-core-2.13.4.jar
jackson-databind-2.13.4.jar
log4j-api-2.14.1.jar
log4j-core-2.14.1.jar
snakeyaml-1.30.jar
Two things to remember for later. commons-collections has scope test, so it is not in the jar. And log4j-api, commons-lang3, jackson-core and jackson-annotations arrive transitively: you never wrote them, but they ship.

Run OSV-Scanner: the smallest thing that works

OSV-Scanner is a single binary with nothing to download first. One command reads the pom.xml, resolves the transitive dependencies, asks the OSV database and prints a table. It also exits with code 1 when it finds anything. I installed it with go install; the output is in output/03-osv-scanner.txt, abridged here to the summary and the first rows:
$ osv-scanner scan source -L pom.xml
Starting filesystem walk for root: /
Scanned <module>/pom.xml file and found 5 packages
End status: 0 dirs visited, 1 inodes visited, 1 Extract calls, 458.484µs elapsed, 458.536µs wall time
Warning: enricher transitivedependency/pomxml may be risky when run on untrusted artifacts. Please ensure you trust the source code and artifacts.

Total 8 packages affected by 35 known vulnerabilities (4 Critical, 12 High, 18 Medium, 0 Low, 1 Unknown) from 1 ecosystem.
35 vulnerabilities can be fixed.

+-------------------------------------+------+-----------+-----------------------------------------------+---------+---------------+---------+
| OSV URL                             | CVSS | ECOSYSTEM | PACKAGE                                       | VERSION | FIXED VERSION | SOURCE  |
+-------------------------------------+------+-----------+-----------------------------------------------+---------+---------------+---------+
| https://osv.dev/GHSA-3wrr-7qpf-2prh | 7.5  | Maven     | com.fasterxml.jackson.core:jackson-databind   | 2.13.4  | 2.14.0        | pom.xml |
… (rows omitted, the exit code is in output/03-osv-scanner.txt):
exit code: 1
Thirty-five findings across 8 packages. Notice that the file declares only five packages (the second line), so three of the eight affected packages came from resolution. Turn resolution off with --no-resolve and the answer changes (same file, output/03-osv-scanner.txt):
$ osv-scanner scan source -L pom.xml --no-resolve   (direct dependencies only)
Scanned <module>/pom.xml file and found 5 packages
Total 5 packages affected by 30 known vulnerabilities (4 Critical, 9 High, 16 Medium, 0 Low, 1 Unknown) from 1 ecosystem.
Five packages, 30 findings: the transitive dependencies (log4j-api, commons-lang3 and jackson-core) account for five findings you would never see by reading only what you declared. Keep that in mind when a scanner says it supports a “manifest”: ask whether it resolves the tree.
Going deeper: the whole OSV table The complete table is output/03-osv-scanner.txt. Each row is one advisory id (a GitHub Security Advisory, GHSA-...), its CVSS score, the package, the installed version and the first fixed version. The (dev) label on commons-collections is how OSV-Scanner marks the test-scope dependency; you will see below that the other two tools drop it.

Run Trivy: same idea, bigger database, test scope ignored

Trivy ships as a container image, which is also how I ran it. The first run downloads its vulnerability database (and a separate Java database used for jar files). On this machine that is 1.8 GB and 1.5 GB on disk, shown in output/12-footprint.txt. After that, a scan of pom.xml is quick. From output/04-trivy.txt:
$ trivy fs --scanners vuln pom.xml    (table output, summary lines only)
pom.xml (pom)
Total: 33 (UNKNOWN: 0, LOW: 0, MEDIUM: 19, HIGH: 11, CRITICAL: 3)
Thirty-three findings, three of them CRITICAL. Trivy also resolved the transitives. The one thing it did not report is the test-scope commons-collections, which OSV-Scanner did; the comparison below comes back to it.
Going deeper: every Trivy finding One line per finding from output/04-trivy.txt:
com.fasterxml.jackson.core:jackson-core:2.13.4  CVE-2025-52999  HIGH
com.fasterxml.jackson.core:jackson-core:2.13.4  CVE-2026-68494  HIGH
com.fasterxml.jackson.core:jackson-core:2.13.4  CVE-2026-89425  HIGH
com.fasterxml.jackson.core:jackson-databind:2.13.4  CVE-2022-42003  HIGH
com.fasterxml.jackson.core:jackson-databind:2.13.4  CVE-2026-19032  MEDIUM
com.fasterxml.jackson.core:jackson-databind:2.13.4  CVE-2026-50193  MEDIUM
com.fasterxml.jackson.core:jackson-databind:2.13.4  CVE-2026-54512  HIGH
com.fasterxml.jackson.core:jackson-databind:2.13.4  CVE-2026-54513  HIGH
com.fasterxml.jackson.core:jackson-databind:2.13.4  CVE-2026-54514  MEDIUM
com.fasterxml.jackson.core:jackson-databind:2.13.4  CVE-2026-54515  MEDIUM
com.fasterxml.jackson.core:jackson-databind:2.13.4  CVE-2026-59889  MEDIUM
com.fasterxml.jackson.core:jackson-databind:2.13.4  CVE-2026-77310  MEDIUM
com.fasterxml.jackson.core:jackson-databind:2.13.4  CVE-2026-83557  MEDIUM
com.fasterxml.jackson.core:jackson-databind:2.13.4  CVE-2026-91776  HIGH
com.fasterxml.jackson.core:jackson-databind:2.13.4  CVE-2026-91777  HIGH
org.apache.commons:commons-lang3:3.11  CVE-2025-48924  MEDIUM
org.apache.commons:commons-text:1.9  CVE-2022-42889  CRITICAL
org.apache.logging.log4j:log4j-api:2.14.1  CVE-2026-49844  MEDIUM
org.apache.logging.log4j:log4j-core:2.14.1  CVE-2021-44228  CRITICAL
org.apache.logging.log4j:log4j-core:2.14.1  CVE-2021-44832  MEDIUM
org.apache.logging.log4j:log4j-core:2.14.1  CVE-2021-45046  CRITICAL
org.apache.logging.log4j:log4j-core:2.14.1  CVE-2021-45105  HIGH
org.apache.logging.log4j:log4j-core:2.14.1  CVE-2025-68161  MEDIUM
org.apache.logging.log4j:log4j-core:2.14.1  CVE-2026-34477  MEDIUM
org.apache.logging.log4j:log4j-core:2.14.1  CVE-2026-34479  MEDIUM
org.apache.logging.log4j:log4j-core:2.14.1  CVE-2026-34480  MEDIUM
org.yaml:snakeyaml:1.30  CVE-2022-1471  HIGH
org.yaml:snakeyaml:1.30  CVE-2022-25857  HIGH
org.yaml:snakeyaml:1.30  CVE-2022-38749  MEDIUM
org.yaml:snakeyaml:1.30  CVE-2022-38750  MEDIUM
org.yaml:snakeyaml:1.30  CVE-2022-38751  MEDIUM
org.yaml:snakeyaml:1.30  CVE-2022-38752  MEDIUM
org.yaml:snakeyaml:1.30  CVE-2022-41854  MEDIUM

Run Dependency-Check: the one that needs a database before it can start

Dependency-Check works differently: it analyses jar files and matches them against the NVD. The Maven plugin has five goals, check, aggregate, update-only, purge and help (from output/01-versions.txt), and no goal that reads an SBOM. Before it can scan anything it needs a local copy of the NVD. That is where I got stuck. With no NVD API key, the plugin’s update goal fails. The request it makes returns HTTP 404 with the header message Invalid apiKey, and the plugin turns that into a confusing exception about a key of length 0 (output/05b-dc-keyless-nvd-update.txt):
[DEBUG] requesting URI: https://services.nvd.nist.gov/rest/json/cves/2.0?resultsPerPage=2000&startIndex=0
[DEBUG] Status Code: 404
[DEBUG] Reason: Not Found
[DEBUG] Key : message ,Value : Invalid apiKey.
Caused by: io.github.jeremylong.openvulnerability.client.nvd.NvdApiException: Invalid API Key, length of 0 too short to provided a masked partial key
I did not have a key, so I did not test the supported route. What worked was pointing the plugin at the NVD’s older JSON data feeds with -DnvdDatafeedUrl. They were still being served on 2026-11-28. The first build took six minutes, from output/05a-dc-database-build.txt:
[INFO] Begin database maintenance
[INFO] Updated the CPE ecosystem on 153865 NVD records
[INFO] Removed the CPE ecosystem on 5366 NVD records
[INFO] End database maintenance (41084 ms)
[INFO] Updating CISA Known Exploited Vulnerability list: https://www.cisa.gov/sites/default/files/feeds/known_exploited_vulnerabilities.json
[INFO] Begin database defrag
[INFO] End database defrag (11462 ms)
[INFO] Check for updates complete (360919 ms)
After that, the database is a 246 MB file and a scan takes seconds. The scan itself, with the database present and updates switched off (output/05-dependency-check.txt):
$ mvn org.owasp:dependency-check-maven:13.0.0:check -DautoUpdate=false -Dformats=JSON   (log, trimmed)
[INFO] Finished Jar Analyzer (0 seconds)
[INFO] Finished CPE Analyzer (2 seconds)
[INFO] Finished NVD CVE Analyzer (0 seconds)
[WARNING] Sonatype OSS Index Analyzer disabled due to missing credentials. Authentication with token is now required, and OSS Index is migrating to Sonatype Guide. See https://dependency-check.github.
[INFO] Finished Known Exploited Vulnerability Analyzer (0 seconds)
[INFO] Analysis Complete (3 seconds)
[INFO] Writing JSON report to: <module>/target/dependency-check-report.json
[INFO] BUILD SUCCESS
[INFO] Total time:  5.526 s
wall clock seconds: 7
Twenty-eight findings. Notice the warning that the Sonatype OSS Index analyser is disabled because it now needs a token.
Plan for the NVD key. On a real CI system you will have a cache for the database and an NVD API key, and the nightly job in the CI file below reads it from NVD_API_KEY. Without a key the supported update path did not work for me, and the data-feed workaround is something I would not build a process on: it depends on a legacy feed that may be retired.
Going deeper: every Dependency-Check finding One line per finding, with the label and the CVSS v3 score, from output/05-dependency-check.txt:
com.fasterxml.jackson.core:jackson-databind:2.13.4  CVE-2022-42003  HIGH:7.5
com.fasterxml.jackson.core:jackson-databind:2.13.4  CVE-2023-35116  MEDIUM:4.7
com.fasterxml.jackson.core:jackson-databind:2.13.4  CVE-2026-50193  MEDIUM:7.5
com.fasterxml.jackson.core:jackson-databind:2.13.4  CVE-2026-54512  HIGH:8.1
com.fasterxml.jackson.core:jackson-databind:2.13.4  CVE-2026-54513  HIGH:8.1
com.fasterxml.jackson.core:jackson-databind:2.13.4  CVE-2026-54514  MEDIUM:5.3
com.fasterxml.jackson.core:jackson-databind:2.13.4  CVE-2026-54515  MEDIUM:5.3
org.apache.commons:commons-lang3:3.11  CVE-2025-48924  MEDIUM:5.3
org.apache.commons:commons-text:1.9  CVE-2022-42889  CRITICAL:9.8
org.apache.logging.log4j:log4j-api:2.14.1  CVE-2026-34477  MEDIUM:5.9
org.apache.logging.log4j:log4j-api:2.14.1  CVE-2026-34479  MEDIUM:7.5
org.apache.logging.log4j:log4j-api:2.14.1  CVE-2026-49844  MEDIUM:5.9
org.apache.logging.log4j:log4j-core:2.14.1  CVE-2021-44228  CRITICAL:10.0
org.apache.logging.log4j:log4j-core:2.14.1  CVE-2021-44832  MEDIUM:6.6
org.apache.logging.log4j:log4j-core:2.14.1  CVE-2021-45046  CRITICAL:9.0
org.apache.logging.log4j:log4j-core:2.14.1  CVE-2021-45105  MEDIUM:5.9
org.apache.logging.log4j:log4j-core:2.14.1  CVE-2025-68161  MEDIUM:4.8
org.apache.logging.log4j:log4j-core:2.14.1  CVE-2026-34477  MEDIUM:5.9
org.apache.logging.log4j:log4j-core:2.14.1  CVE-2026-34479  MEDIUM:7.5
org.apache.logging.log4j:log4j-core:2.14.1  CVE-2026-34480  MEDIUM:7.5
org.apache.logging.log4j:log4j-core:2.14.1  CVE-2026-49844  MEDIUM:5.9
org.yaml:snakeyaml:1.30  CVE-2022-1471  CRITICAL:9.8
org.yaml:snakeyaml:1.30  CVE-2022-25857  HIGH:7.5
org.yaml:snakeyaml:1.30  CVE-2022-38749  MEDIUM:6.5
org.yaml:snakeyaml:1.30  CVE-2022-38750  MEDIUM:5.5
org.yaml:snakeyaml:1.30  CVE-2022-38751  MEDIUM:6.5
org.yaml:snakeyaml:1.30  CVE-2022-38752  MEDIUM:6.5
org.yaml:snakeyaml:1.30  CVE-2022-41854  MEDIUM:6.5

Same project, three answers: where the differences come from

I normalised each tool’s JSON report to one line per advisory per component (with scripts/normalise.py and scripts/compare.py) and compared. The summary is in output/06-compare.txt:
findings per component (advisory ids, deduplicated)
  component                                                     osv-scanner             trivy  dependency-check
  com.fasterxml.jackson.core:jackson-core:2.13.4                          3                 3                 0
  com.fasterxml.jackson.core:jackson-databind:2.13.4                     12                12                 7
  commons-collections:commons-collections:3.2.1                           2                 0                 0
  org.apache.commons:commons-lang3:3.11                                   1                 1                 1
  org.apache.commons:commons-text:1.9                                     1                 1                 1
  org.apache.logging.log4j:log4j-api:2.14.1                               1                 1                 3
  org.apache.logging.log4j:log4j-core:2.14.1                              8                 8                 9
  org.yaml:snakeyaml:1.30                                                 7                 7                 7
  TOTAL (component, id) pairs                                            35                33                28
The same project, three different totals (one finding = one advisory on one component) OSV-Scanner24 in all three9 + Trivy2 Trivy24 in all three9 + OSV Dependency-Check24 in all three4 only its own Green: all three agree. Blue: the two tools that match on package coordinates agree and Dependency-Check is silent (it never saw those advisories in the NVD). Amber, OSV-Scanner: 2 advisories on a test-scope dependency. Amber, Dependency-Check: 4 advisories attached to the wrong artifact or disputed. Each bar is 14 pixels per finding. The total only tells you how many rows to read, not how much risk you carry.
Twenty-four findings are reported by all three: the Log4Shell family, Text4Shell, the old snakeyaml problems. Those are the ones to fix first, and any of the three tools would have told you. The other 15 split into four causes, in this order of how much they matter. 1. Dependency-Check is blind to advisories the NVD has not analysed. It reports none of jackson-core’s three advisories and only seven of jackson-databind’s twelve. The nine it misses are missing because the NVD records have no CPE configuration for them yet. I asked the NVD about each one (output/07-false-positives.txt):
== why dependency-check misses 9 jackson advisories (3 jackson-core, 6 jackson-databind): NVD status of each id
CVE-2025-52999 status: Deferred  has CPE configurations: False
CVE-2026-68494 status: Awaiting Analysis  has CPE configurations: False
CVE-2026-89425 status: Deferred  has CPE configurations: False
CVE-2026-19032 status: Awaiting Analysis  has CPE configurations: False
CVE-2026-59889 status: Awaiting Analysis  has CPE configurations: False
CVE-2026-77310 status: Deferred  has CPE configurations: False
CVE-2026-83557 status: Awaiting Analysis  has CPE configurations: False
CVE-2026-91776 status: Deferred  has CPE configurations: False
CVE-2026-91777 status: Deferred  has CPE configurations: False
All nine are either Awaiting Analysis or Deferred, with no CPE configuration. Dependency-Check matches by CPE, so it cannot see them; OSV-Scanner and Trivy use advisory data (GitHub Security Advisories, in the findings I inspected) that names the affected package and version range directly, so they can. This is the largest gap on the page and it points in the dangerous direction: a clean Dependency-Check report can mean “no problem” or “the NVD has not got to it yet”, and the report does not say which. 2. OSV-Scanner reports a test-scope dependency. The two extra OSV-Scanner findings are in commons-collections 3.2.1, which only exists for tests. Whether that is a false positive is a policy question; the gating section shows why it matters. 3. Dependency-Check attaches advisories to the wrong artifact, or reports a disputed one. That is the next section. 4. Severity labels disagree. Three advisories that all tools report get different buckets (output/06-compare.txt):
same advisory, different severity bucket
  CVE-2026-50193   jackson-databind   osv=HIGH      trivy=MEDIUM    dc=MEDIUM
  CVE-2021-45105   log4j-core         osv=HIGH      trivy=HIGH      dc=MEDIUM
  CVE-2022-1471    snakeyaml          osv=HIGH      trivy=HIGH      dc=CRITICAL
CVE-2021-45105 is HIGH for OSV-Scanner and Trivy and MEDIUM for Dependency-Check. If you gate on “HIGH and above”, which tool you run changes whether the build fails. I did not find out why each label differs; the point is that a severity gate is a policy on top of one tool’s opinion, not a fact.
Going deeper: the whole comparison Everything in output/06-compare.txt that is not shown above:
reported by every tool: 24

reported by only some tools  (O = osv-scanner, T = trivy, D = dependency-check)
  OT-  CVE-2025-52999   com.fasterxml.jackson.core:jackson-core:2.13.4
  OT-  CVE-2026-68494   com.fasterxml.jackson.core:jackson-core:2.13.4
  OT-  CVE-2026-89425   com.fasterxml.jackson.core:jackson-core:2.13.4
  --D  CVE-2023-35116   com.fasterxml.jackson.core:jackson-databind:2.13.4
  OT-  CVE-2026-19032   com.fasterxml.jackson.core:jackson-databind:2.13.4
  OT-  CVE-2026-59889   com.fasterxml.jackson.core:jackson-databind:2.13.4
  OT-  CVE-2026-77310   com.fasterxml.jackson.core:jackson-databind:2.13.4
  OT-  CVE-2026-83557   com.fasterxml.jackson.core:jackson-databind:2.13.4
  OT-  CVE-2026-91776   com.fasterxml.jackson.core:jackson-databind:2.13.4
  OT-  CVE-2026-91777   com.fasterxml.jackson.core:jackson-databind:2.13.4
  O--  CVE-2015-6420    commons-collections:commons-collections:3.2.1
  O--  CVE-2015-7501    commons-collections:commons-collections:3.2.1
  --D  CVE-2026-34477   org.apache.logging.log4j:log4j-api:2.14.1
  --D  CVE-2026-34479   org.apache.logging.log4j:log4j-api:2.14.1
  --D  CVE-2026-49844   org.apache.logging.log4j:log4j-core:2.14.1

The false positives, and what each one looked like

A false positive here means: the tool reports an advisory that does not apply to this project. I found three kinds, and for each I could check the claim instead of trusting it. All of the evidence is in output/07-false-positives.txt. An advisory for a different artifact. CVE-2026-34479 is about Log4j1XmlLayout, a class in the Log4j 1-to-2 bridge. All three tools report it on log4j-core, and Dependency-Check also on log4j-api. This project has neither the bridge nor the class:
== CVE-2026-34479: which artifact does the advisory describe?
$ curl -s https://api.osv.dev/v1/vulns/CVE-2026-34479 | jq -r .summary
Apache Log4j 1 to Log4j 2 bridge: Silent log event loss in Log4j1XmlLayout due to unescaped XML 1.0 forbidden characters
$ unzip -l target/lib/log4j-core-2.14.1.jar | grep -c Log4j1XmlLayout
0
$ unzip -l target/lib/log4j-api-2.14.1.jar | grep -c Log4j1XmlLayout
0
$ ls target/lib | grep -c "log4j-1.2-api"
0

== where each tool attached CVE-2026-34479
osv  org.apache.logging.log4j:log4j-core:2.14.1
trivy  org.apache.logging.log4j:log4j-core:2.14.1
dc  org.apache.logging.log4j:log4j-api:2.14.1
dc  org.apache.logging.log4j:log4j-core:2.14.1
The class name is in neither jar and the bridge artifact is not on the classpath, so the advisory does not apply here. The tools disagree about where to attach it, and the same pattern shows up in a second advisory: CVE-2026-49844 is a log4j-api advisory (OSV lists only that artifact), and Dependency-Check also puts it on log4j-core. The cause is CPE naming: the product name apache:log4j covers every Log4j artifact, so the NVD record cannot say which one is affected. A disputed advisory. CVE-2023-35116 is reported only by Dependency-Check. Its own NVD description (output/07-false-positives.txt) says, in a note, that the vendor’s position is that this is not a valid vulnerability report:
== CVE-2023-35116 (reported only by dependency-check): the NVD description
jackson-databind-2.13.4.jar CVE-2023-35116 MEDIUM
jackson-databind through 2.15.2 allows attackers to cause a denial of service or other unspecified impact via a crafted object that uses cyclic dependencies. NOTE: the vendor's perspective is that this is not a valid vulnerability report, because the steps of constructing a cyclic data structure and trying to serialize it cannot be achieved by an external attacker.
Trivy and OSV-Scanner do not report it. A real advisory for code you never call. snakeyaml 1.30 has seven findings in all three reports, including a CRITICAL-rated one in Dependency-Check. It is a true positive in the sense that the version is vulnerable. But no source file imports org.yaml (output/02-project.txt):
$ grep -rl org.yaml src/main/java || echo "no source file imports org.yaml"
no source file imports org.yaml
None of the three tools can tell you that. OSV-Scanner’s own help lists call analysis only for Go and Rust, so for Java every finding means “this version is in your tree”, never “your code can reach it”. Deciding about reachability is your job.
The three kinds need three different responses. A wrong-artifact match gets a suppression with a written reason. A disputed advisory gets a suppression too, because it will keep coming back. A true advisory in unused code gets an upgrade or a removal, not a suppression: the library is on your classpath whether or not you call it, and removing an unused dependency is usually the cheapest fix.

Ignore rules that expire

Once you have decided that a finding does not apply, every tool lets you say so in a file. The useful feature is an expiry date, so that a suppression you wrote today is questioned again in three months instead of lasting for ever. All three files are in config/. The Dependency-Check one:
  <!-- CVE-2026-34479 is in the Log4j 1-to-2 bridge (Log4j1XmlLayout). This project has neither
       log4j-1.2-api nor that class (see output/07-false-positives.txt). Review again on 2027-03-01. -->
  <suppress until="2027-03-01Z">
    <notes>Advisory is for the log4j-1.2-api bridge, which this project does not use.</notes>
    <packageUrl regex="true">^pkg:maven/org\.apache\.logging\.log4j/log4j-(api|core)@.*$</packageUrl>
    <cve>CVE-2026-34479</cve>
  </suppress>
Each tool has a second file with a review date already in the past, so I could check that expiry really brings the finding back (output/08-suppression.txt):
osv-scanner: 35 findings with no config
osv-scanner: 34 with config/osv-scanner.toml (ignoreUntil 2027-03-01)
osv-scanner: 35 with config/osv-scanner-expired.toml (ignoreUntil 2026-01-01, already past)

trivy: 33 findings with no ignore file
trivy: 32 with config/trivyignore.yaml
trivy: 33 with config/trivyignore-expired.yaml

dependency-check: 28 findings with no suppression file
dependency-check: 25 with config/dc-suppressions.xml
dependency-check: 28 with config/dc-suppressions-expired.xml
dependency-check suppressed (kept in the report, not counted): ['CVE-2023-35116', 'CVE-2026-34479']
Dependency-Check went from 28 to 25 with the live file (three rows, because the log4j advisory is suppressed on two artifacts and the disputed jackson one on one) and back to 28 with the expired file. OSV-Scanner and Trivy behave the same way: one finding suppressed, then back when the date passes. The three file formats are different, so a team that runs more than one tool maintains more than one list; the reason and the date are what keep them honest. Going deeper:

Turn the scan into a build gate

A report nobody reads does not protect you; a build that fails does. Each tool can fail the build, in a different way. Here are the exit codes on the vulnerable project, from output/11-gating-and-fix.txt:
== exit codes on the vulnerable project
osv-scanner (no flag):                          exit 1
4 finding(s) with CVSS >= 9.0
osv-scanner + scripts/gate.py 9.0:               exit 1
trivy --exit-code 1 --severity CRITICAL:        exit 1
trivy (no --exit-code):                         exit 0
dependency-check -DfailBuildOnCVSS=9:           exit 1
[ERROR] Failed to execute goal org.owasp:dependency-check-maven:13.0.0:check (default-cli) on project orders: 
[ERROR] One or more dependencies were identified with vulnerabilities that have a CVSS score greater than or equal to '9.0': 
dependency-check -DfailBuildOnCVSS=11:          exit 0
OSV-Scanner exits 1 on any finding and has no severity flag, so I wrote a short scripts/gate.py that applies a CVSS threshold to its JSON. Trivy needs --exit-code 1 (without it, Trivy exits 0 whatever it finds) and filters by --severity. Dependency-Check fails the build with -DfailBuildOnCVSS or -DfailBuildOnAnyVulnerability. The last line shows that setting the threshold above the maximum score disables the gate, which is the usual way a gate gets switched off by accident. A gate must also be passable. The same project with the fixed profile, which moves each flagged dependency to a current release, goes green in all three (output/11-gating-and-fix.txt):
== the same project with -Pfixed (all flagged dependencies moved to current releases)
runtime jars: commons-lang3-3.22.0.jar commons-text-1.15.0.jar jackson-annotations-2.23.jar jackson-core-2.23.0.jar jackson-databind-2.23.0.jar log4j-api-2.26.1.jar log4j-core-2.26.1.jar snakeyaml-2.7.jar 
osv-scanner on the SBOM: exit 0; findings: 0
trivy sbom --exit-code 1: exit 0; findings: 0
dependency-check -Pfixed -DfailBuildOnAnyVulnerability=true: exit 0
dependency-check findings: 0
Zero findings, and all three exit 0. So the whole loop works: the scan fails, you upgrade, the scan passes. Here is the CI file that arranges this so that pull requests stay fast and the slow scan runs overnight. It was not run on a CI runner; its commands are the ones above:
A gate that is fast on pull requests and thorough overnight every pull requestmvn package + SBOMtrivy sbom –exit-code 1–severity CRITICAL every pull requestosv-scanner on the SBOMscripts/gate.py 9.0(a second database) nightlydependency-check:check-DfailBuildOnCVSS=9cached DB, NVD API key config/trivyignore.yaml config/osv-scanner.toml config/dc-suppressions.xml Every ignore rule lives in the repository with a reason and an expiry date. This file is not run on a CI runner here; its commands are the ones that produced the exit codes below.
The diagram shows the shape: two quick scans of the SBOM on each pull request, from two different databases, and the slow jar scan nightly, where its database can be cached and refreshed. The ignore files are shared by all stages. The nightly run matters even when the code has not changed, because the databases change: a build that passed on Friday can fail on Saturday with no commit between.
Going deeper: the CI file From ci/vuln-scan.yml:
name: vuln-scan
on:
  pull_request:
  schedule:
    - cron: "17 3 * * *"        # nightly re-scan: the database changes even when the code does not

jobs:
  scan:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-java@v4
        with: { distribution: temurin, java-version: "25" }

      # 1. Build, and write the SBOM next to the artifact.
      - run: mvn -B package cyclonedx:makeAggregateBom

      # 2. Fast gate on every pull request: Trivy reads the SBOM, fails only on CRITICAL.
      - run: >
          docker run --rm -v "$PWD":/src:ro ghcr.io/aquasecurity/trivy:0.76.2
          sbom --exit-code 1 --severity CRITICAL --ignorefile /src/config/trivyignore.yaml /src/target/bom.json

      # 3. Second opinion from a different database. osv-scanner has no severity flag, so scripts/gate.py applies one.
      - run: |
          osv-scanner scan source -L target/bom.json --config config/osv-scanner.toml --format json --output-file osv.json || true
          python3 scripts/gate.py osv.json 9.0

      # 4. Slow, nightly only: Dependency-Check against the jars, with the NVD database cached between runs.
      - if: github.event_name == 'schedule'
        run: >
          mvn -B org.owasp:dependency-check-maven:13.0.0:check
          -DfailBuildOnCVSS=9 -DsuppressionFiles=config/dc-suppressions.xml
          -DnvdApiKeyEnvironmentVariable=NVD_API_KEY
        env:
          NVD_API_KEY: ${{ secrets.NVD_API_KEY }}
Going deeper: the OSV-Scanner threshold script OSV-Scanner has no severity option, so scripts/gate.py reads the JSON report and exits 1 if any finding is at or above a CVSS score:
limit = float(sys.argv[2])
bad = []
for line in out.splitlines():
    _, comp, vid, score = line.split("\t")
    if score and float(score) >= limit:
        bad.append((score, vid, comp))
for score, vid, comp in sorted(bad, reverse=True)[:5]:
    print(f"  {score:>5} {vid} {comp}")
print(f"{len(bad)} finding(s) with CVSS >= {limit}")
sys.exit(1 if bad else 0)

Scan an SBOM instead of the project

So far the tools read pom.xml or jars. A third input is an SBOM, the list of components the build resolved. The cyclonedx-maven-plugin writes one (output/09-sbom.txt):
bomFormat CycloneDX specVersion 1.6
components: 8
   pkg:maven/org.apache.logging.log4j/[email protected]?type=jar
   pkg:maven/org.apache.logging.log4j/[email protected]?type=jar
   pkg:maven/org.apache.commons/[email protected]?type=jar
   pkg:maven/org.apache.commons/[email protected]?type=jar
   pkg:maven/com.fasterxml.jackson.core/[email protected]?type=jar
   pkg:maven/com.fasterxml.jackson.core/[email protected]?type=jar
   pkg:maven/com.fasterxml.jackson.core/[email protected]?type=jar
   pkg:maven/org.yaml/[email protected]?type=jar
Both Trivy and OSV-Scanner accept it, and the answer is the same as scanning the manifest (output/09-sbom.txt):
$ trivy sbom target/bom.json
findings: 33   (same scan from the manifest: 33)

$ osv-scanner scan source -L target/bom.json
Scanned <module>/target/bom.json file and found 8 packages
findings: 33   (same scan from pom.xml: 35)
What you point the scanner at decides what it can be wrong about pom.xml (what you declared)OSV-Scanner: 35Trivy: 33transitives are resolvedby the scanner, not by Maventest scope: OSV yes, Trivy no SBOM (what the build resolved)OSV-Scanner: 33Trivy: 33trusted as written:edit one purl and thefindings change jars (what is on disk)Trivy: 33, OSV-Scanner: 33Dependency-Check: 28OSV-Scanner needs–x-plugins java/archiveor it opens no jar at all Left to right the input gets closer to what actually runs, and further from what you wrote down. Counts are from the vulnerable build; the thin application jar alone contains none of the dependencies, so scanning it finds nothing.
Trivy found 33 from the SBOM and 33 from the manifest. OSV-Scanner found 33 from the SBOM and 35 from pom.xml. The two missing are exactly the commons-collections advisories, because the SBOM contains only what ships, not the test dependency. That is a reason to prefer the SBOM for a release gate: it describes the artifact, not the build file. The trade-off is trust. An SBOM is taken as written. I edited one entry (log4j-core 2.14.1 to 2.26.1) and scanned again, and Trivy did not open any jar to object (output/09-sbom.txt):
$ the same SBOM with one component edited by hand (log4j-core 2.14.1 -> 2.26.1 in version and purl)
trivy findings on the edited SBOM: 25  (log4j-core findings: 0)
Eight findings fewer, and no log4j-core findings left, from a file I changed by hand. So the SBOM gate is only as good as the process that writes the SBOM and the place where it is stored. If you want to know about the files themselves, scan the files. Trivy and Dependency-Check do that by default. OSV-Scanner does not: its default plugins opened no jar at all until I switched on the Java archive plugin (output/10-artifacts.txt):
$ osv-scanner scan source -r --no-ignore target/lib       (default plugins)
Starting filesystem walk for root: /
End status: 1 dirs visited, 9 inodes visited, 0 Extract calls, 132.787µs elapsed, 132.871µs wall time
No package sources found, --help for usage information.

$ osv-scanner scan source -r --no-ignore --x-plugins java/archive target/lib
End status: 1 dirs visited, 9 inodes visited, 8 Extract calls, 7.273061ms elapsed, 7.273144ms wall time
findings: 33
Without the flag, the scan of a directory of jars finds no package sources. With it, 33 findings, the same as the others. Scanning only the application’s own thin jar finds nothing, because the dependencies are not inside it (output/10-artifacts.txt):
$ osv-scanner scan source --no-ignore --x-plugins java/archive target/orders-1.0.0.jar   (the thin application jar)

No issues found
A clean scan of the wrong thing is the worst result. This one is easy to get: point a scanner at a jar that does not contain its dependencies and you get “No issues found”. Check that the number of packages the scanner reports roughly matches the number of dependencies you expect.
How the SBOM is produced and read is the subject of Spring Boot SBOM in Practice; that article generates it from a Spring Boot jar and checks where the document and the jar disagree.

What each tool costs to run

Wall-clock time with warm caches on this two-core sandbox, and disk use, from output/12-footprint.txt:
== what each tool keeps on disk
dependency-check H2 database: 246M
trivy cache: 3.2G  (db 1.8G, java-db 1.5G)
osv-scanner: nothing, it queries api.osv.dev (unless --offline-vulnerabilities)

== wall clock seconds, warm caches, this 2-vCPU sandbox
osv-scanner scan source -L pom.xml:       1.3
trivy fs pom.xml (docker run):            1.3
trivy sbom bom.json (docker run):         0.3
dependency-check:check (DB present):      5.7
OSV-Scanner stores nothing and asks the network, which is why it is the lightest to add to a pipeline. It also has an offline mode: you download the Maven database once (11 MB here) and scan from it, getting the same 35 findings; I did not cut the network while testing that. Trivy needs its database cached between runs, or it downloads it again (3.2 GB on disk here). Dependency-Check needs the longest warm-up, six minutes for the first database, and then runs in a few seconds. The times are indicative; the shape is what matters: a gate that adds two seconds per build survives, and one that adds six minutes on a cold cache needs a cache.

Which one should you use?

Use OSV-Scanner or Trivy for the gate, and treat Dependency-Check as optional. On this project the two tools that match by package coordinates agreed with each other on 33 findings, missed nothing that Dependency-Check found except a disputed advisory and wrong-artifact matches, and found nine advisories Dependency-Check could not see. Dependency-Check is still worth running if you must satisfy a requirement that names the NVD, or you want its independent view of jars with no clean coordinates, but it is the one that needs a key and a database, and the only one that reported the disputed advisory and attached two advisories to the wrong Log4j artifact. Whichever you choose, run it on a schedule as well as on pull requests, gate on a severity you have decided on rather than on a default, give every suppression a reason and an expiry date, and remember what none of them tell you: whether your code can reach the vulnerable function.
Two limits of this comparison. It is one project with eight jars, so the counts are an illustration and not a benchmark of detection quality; I did not measure how many real vulnerabilities each tool misses beyond the cases above. And the databases move daily, so the specific CVE numbers will change when you rerun it.

Further reading

No Comments yet!

This site uses Akismet to reduce spam. Learn how your comment data is processed.