Contents
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.
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
-
Download the file for your operating system from the releases page. On Windows,
winget install Google.OSVScanneralso works. On macOS, usebrew install osv-scanner. -
Run it on your project folder. With
-r, it scans subfolders too.osv-scanner scan source -r ./my-project -
Read the result table. The
OSV URLcolumn links to each vulnerability, andFIXED VERSIONshows 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
fixcommand 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
--offlineif you don’t want to send them.
Read next
Sources
- Official repository README (Data Sources and Privacy)github.com/google/osv-scanner
- Docs: Installationgoogle.github.io/osv-scanner/installation/
- Docs: Usagegoogle.github.io/osv-scanner/usage/
- Docs: Offline Modegoogle.github.io/osv-scanner/usage/offline-mode/
- Docs: Outputgoogle.github.io/osv-scanner/output/
- Trivy official repository READMEgithub.com/aquasecurity/trivy
- Trivy docs: Databasestrivy.dev/docs/latest/guide/configuration/db/
Checked on 2026-10-24
Similar tools
Gitleaks
Impact Local onlyA 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
Trivy
Impact Local onlyA 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
Vuls
Impact Reaches othersAn 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