Safeguard
Security Guides•

How do I check one package version for known vulnerabilities?

Query an advisory database with the ecosystem, package name and exact version. OSV.dev answers this with one API call that returns matching advisories.

Safeguard Security Team
3 min read

To check one package version, query an advisory database with three facts: the ecosystem, the package name and the exact version. OSV.dev, an aggregator of vulnerability databases, answers this through its query endpoint, which returns the advisories whose affected ranges include that version. An empty result means nothing matched at that moment.

Definitions

Ecosystem. The package registry family, such as PyPI, npm or RubyGems. Names are case sensitive in the OSV API.

Advisory record. An OSV entry with an identifier, summary, references and affected ranges.

Package URL. A standard identifier that can carry the ecosystem, name and version in one string.

What OSV.dev is

OSV.dev aggregates vulnerability databases that use the OpenSSF vulnerability format. It also checks that affected versions are recorded accurately, using bisection and version analysis. Its API includes a query endpoint, a batch query endpoint and a lookup by identifier.

The query request

The query endpoint accepts a package and a version. You may give the name with the ecosystem, or a package URL. You must not put the version in both places. The API returns a list of advisory records, and a page token if results are paginated.

curl -s -X POST https://api.osv.dev/v1/query -d '{"package": {"name": "jinja2", "ecosystem": "PyPI"}, "version": "3.1.4"}'
curl -s -X POST https://api.osv.dev/v1/query -d '{"package": {"purl": "pkg:pypi/jinja2@3.1.4"}}'

Ways to check, compared

MethodBest forLimit
Advisory API queryOne package, scriptsYou supply name and version
Scanner on a lockfileWhole projectNeeds a lockfile
Registry audit commandDay to dayTied to one ecosystem
Reading advisories by handUnderstanding impactSlow, easy to miss one

Steps

  1. Confirm the exact resolved version from your lockfile, not the range in your manifest.
  2. Run the query with the right ecosystem name and case.
  3. Read each returned record for affected ranges, fixed version and any mitigations.
  4. Check aliases, since one flaw can appear under several identifiers.
  5. If results are empty, note the date. New advisories can change the answer tomorrow.

Common mistakes

  • Using a version range instead of an exact version.
  • Getting the ecosystem name case wrong, which returns nothing.
  • Treating an empty answer as a permanent all clear.

Try it yourself

Click through it at your own pace, or open it full screen.

Open a finding and compare its affected range with the version in use.

Quick check

Does the query work for commit hashes?

Yes. The API accepts a commit hash in place of a version, and you then omit the version field.

Is an empty result proof the version is safe?

No. It means no advisory matched at that time. Re-check on a schedule.

Safeguard checks dependency versions against advisory data and flags newly published matches through continuous monitoring. Try a free scan.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.