Skip to main content

Score whether a security finding already overlaps a published OSV/NVD advisory for a PyPI package, so scanners can skip known vulnerabilities.

Project description

osv-dedupe

Given a security finding for a PyPI package, decide whether it's already a published vulnerability before you spend time (or LLM tokens) triaging it. osv-dedupe queries OSV (and optionally NVD), then scores each candidate advisory against your finding using source reliability, package-name presence, CWE overlap, and file/function hints.

Install

pip install osv-dedupe

Library usage

from osv_dedupe import find_known_advisory_matches

finding = {"cwe": "CWE-22", "path": "demo/tarfile_utils.py"}
matches = find_known_advisory_matches("demo", "1.0.0", finding)

for m in matches:
    print(m["confidence"], m["source"], m["id"], m["url"])
    print(m["reason"])

Each match is a dict with source, id, url, confidence (0.0–1.0), reason, aliases, cwes, and summary. A confidence >= 0.70 is generally strong enough to treat the finding as already reported.

Options:

  • min_confidence (default 0.70) — threshold for returned matches.
  • include_nvd (default False) — also keyword-search NVD (slower, noisier).
  • limit (default 3) — max matches returned.

CLI

osv-dedupe requests 2.0.0 --cwe CWE-22
osv-dedupe django 3.2 --include-nvd --json

Scoring

Signal Weight
OSV returned the advisory +0.45
NVD keyword hit +0.30
Package name in advisory text +0.15
CWE matches finding +0.25
CWE differs −0.10
File/function hint appears +0.10

Confidence is clamped to [0.0, 1.0]. All network calls are best-effort: if OSV or NVD are unreachable, you get an empty list, never an exception. Results are cached in-process; call clear_cache() to reset.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

osv_dedupe-0.1.0-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file osv_dedupe-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: osv_dedupe-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for osv_dedupe-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8f131d48cbc809a98f4b6a45ff7dc0926163bda4c6dfce0014d7d7587bde41a6
MD5 d6d105c53a54e7820e5b529538e00406
BLAKE2b-256 771912695708f92332f22be93fd1a4b40361c1c3a3244cff876875de6ee7313d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page