OSV-Scanner

A command-line tool from Google that reads your project's dependencies and checks them against the OSV.dev vulnerability database.

cat osv-scanner/meta.ymlChecked on 2026-10-24

Safety

Impact Local onlyStays on your machine and sends nothing out
Admin rights
Not required
Test lab
Not required

Usage

Purpose
Defense
Difficulty
Beginner
Type
Command line
Platforms
Linux / macOS / Windows / Docker

Trust

Repository
google/osv-scanner
License
PermissiveApache-2.0
GitHub
stars11,2642026-10-25
Maintenance
Actively updatedLast update 2026-10-24
Contents
  1. Introduction
  2. What OSV-Scanner does
  3. What it sends to OSV.dev
  4. Try it safely on your own project
  5. Common tasks
  6. How it differs from Trivy
  7. Cautions
  8. Read next
  9. Sources

OSV-Scanner reads the dependency list from files such as package-lock.json and go.mod and tells you which packages have known vulnerabilities. Point it at your project folder and run it once to get results.

This review is for people who build software with npm, pip, and other package managers. After reading it, you can do the following:

  • Check your project’s dependencies for known vulnerabilities
  • Understand what OSV-Scanner sends outside and run it offline if needed
  • Check dependencies automatically before you commit (pre-commit)

What OSV-Scanner does

OSV-Scanner works in two steps. First, it extracts the packages used in your project or container image. Then it matches them against OSV.dev, a vulnerability database.

Subcommand What it scans
scan source A source code folder. Plain scan does the same
scan image A container image
fix Suggests version upgrades that fix vulnerabilities (experimental)

Supported languages include C/C++, Go, Java, JavaScript, Python, and Rust. Supported package managers include npm, pip, yarn, Maven, Go modules, and Cargo. The official documentation lists every supported lockfile.

What it doesn’t doOSV-Scanner reports vulnerable packages but does not fix them for you, except when you use the fix command. It only matches known vulnerabilities in the database. It does not find bugs in code you wrote yourself.

What it sends to OSV.dev

According to the README, a normal run sends the following to the OSV.dev API:

  • Package names
  • Versions
  • Ecosystems (npm, PyPI, and so on)
  • File hashes, when it scans C/C++ code

It also uses the deps.dev API for dependency resolution and license checks, and sends package names, versions, and ecosystems there. In neither case does it send your source code.

If you don’t want your dependency list to leave your network, use offline mode. With --offline, OSV-Scanner matches against a database you downloaded earlier and sends no project or dependency information anywhere.

Try it safely on your own project

  1. Download the file for your operating system from the releases page. On Windows, winget install Google.OSVScanner also works. On macOS, use brew install osv-scanner.

  2. Run it on your project folder. With -r, it scans subfolders too.

    osv-scanner scan source -r ./my-project
  3. Read the result table. The OSV URL column links to each vulnerability, and FIXED VERSION shows the version that fixes it. -- means no fix is available yet.

To try it without sending anything, run the following. The first run downloads the database, and later runs use only local data.

osv-scanner --offline --download-offline-databases ./my-project

Common tasks

Task Command
Scan a single lockfile osv-scanner scan -L package-lock.json
Output results as JSON osv-scanner scan -L package-lock.json --format json
Save results to a file osv-scanner scan -L package-lock.json --output-file scan-results.txt
View results as HTML in a browser osv-scanner scan -L package-lock.json --serve
Scan a container image osv-scanner scan image my-image-name:tag
Check dependency licenses osv-scanner --licenses path/to/repository

--serve shows the HTML report locally on port 8000.

The exit code is 0 when there are no vulnerabilities, 1 when it finds some, and 128 when it finds no files to scan. You can use this to fail CI builds.

OSV-Scanner also supports pre-commit. Add the osv-scanner hook from https://github.com/google/osv-scanner/ to .pre-commit-config.yaml to check dependencies before each commit.

How it differs from Trivy

Trivy can also check dependencies for vulnerabilities. The main differences are how matching works and how much it covers.

OSV-Scanner Trivy
Matching Queries the OSV.dev API by default. Uses a local database with --offline Downloads its vulnerability database (trivy-db) and matches locally
Coverage Mainly dependency vulnerabilities and licenses Vulnerabilities plus misconfigurations, secrets, and licenses

Use OSV-Scanner for a quick dependency check. Use Trivy when you also want to scan containers and configuration files.

Cautions

  • Only scan projects you own or have permission to scan.
  • Don’t run the fix command on projects you don’t trust. The documentation warns that the package manager may run scripts or connect to external registries that the project specifies.
  • For confidential projects, keep in mind that package names and versions go to OSV.dev. Use --offline if you don’t want to send them.

Sources

  1. Official repository README (Data Sources and Privacy)github.com/google/osv-scanner
  2. Docs: Installationgoogle.github.io/osv-scanner/installation/
  3. Docs: Usagegoogle.github.io/osv-scanner/usage/
  4. Docs: Offline Modegoogle.github.io/osv-scanner/usage/offline-mode/
  5. Docs: Outputgoogle.github.io/osv-scanner/output/
  6. Trivy official repository READMEgithub.com/aquasecurity/trivy
  7. Trivy docs: Databasestrivy.dev/docs/latest/guide/configuration/db/

Checked on 2026-10-24

Similar tools

Gitleaks

Impact Local only
gitleaks/gitleaks

A command-line tool that finds passwords, API keys, and tokens that have slipped into Git repositories and files.

Purpose
Defense
Type
Command line
Difficulty
Beginner
License
PermissiveMIT
Category
Vulnerability scanning
Actively updatedstars30,315Last update 2026-10-23
Read the Gitleaks review

Trivy

Impact Local only
aquasecurity/trivy

A scanner that finds vulnerabilities, misconfigurations, and embedded secrets in container images, code, and Kubernetes.

Purpose
Defense
Type
Command line
Difficulty
Beginner
License
PermissiveApache-2.0
Category
Vulnerability scanning / Containers and cloud
Actively updatedstars38,703Last update 2026-10-23
Read the Trivy review

Vuls

Impact Reaches others
future-architect/vuls

An agentless vulnerability scanner that checks the packages installed on a server and lists the ones affected by known CVEs.

Purpose
Defense
Type
Command line
Difficulty
Intermediate
License
CopyleftGPL-3.0
Category
Vulnerability scanning
Actively updatedstars12,302Last update 2026-10-21
Read the Vuls review