Skip to main content

dep-scanner

Zero-dependency Python library that scans your dependency manifests for known CVEs using the free OSV.dev API.

No API key. No signup. No rate limits for normal use.

pip install osv-scan

Why

  • safety went paid in 2023
  • osv-scanner is a Go binary — not embeddable in Python
  • pip-audit is great but Python-only and pulls in several dependencies

dep-scanner fills the gap: a pure stdlib Python library that scans six ecosystems and works anywhere Python runs.


Supported manifest files

File Ecosystem
requirements.txt PyPI
package.json npm
package-lock.json npm
go.mod Go
Cargo.toml crates.io
pom.xml Maven

CLI

# auto-detect manifest in current directory
dep-scan

# scan a specific file
dep-scan requirements.txt

# multiple files
dep-scan requirements.txt package-lock.json

# JSON output (great for CI)
dep-scan --json requirements.txt

# fail CI only on HIGH or above (default: critical)
dep-scan --fail-on high requirements.txt

# quiet mode — only print findings
dep-scan -q requirements.txt

Example output

dep-scan  requirements.txt (PyPI) · 42 packages

  CRITICAL  django 3.2.1
             CVE-2023-36053
             Potential ReDoS via cached 'urlsplit' results
             Fix: upgrade to 3.2.20

  HIGH      requests 2.27.0
             CVE-2023-32681
             Unintended leak of proxy-authorization header
             Fix: upgrade to 2.31.0

  1 CRITICAL · 1 HIGH  (2 vulns · 840ms)

Python API

import dep_scanner

# scan a file on disk
result = dep_scanner.scan("requirements.txt")

print(result.highest_severity)       # 'CRITICAL'
print(result.packages_scanned)       # 42
print(len(result.findings))          # 3

for finding in result.critical:
    print(finding.package, finding.version)
    print("Fix:", finding.fix_versions[0] if finding.fix_versions else "none")

# scan content directly (no file needed)
result = dep_scanner.scan_text(
    "requests==2.27.0\ndjango==3.2.1",
    ecosystem="PyPI",
)

# convert to dict
data = result.to_dict()
# {
#   "CRITICAL": [{"package": "django", "version": "3.2.1", ...}],
#   "HIGH": [{"package": "requests", ...}],
# }

ScanResult properties

Property Type Description
source str File path or label
ecosystem str e.g. "PyPI"
packages_scanned int Total unique packages checked
findings list[PackageFinding] Packages with vulnerabilities
elapsed_ms int Wall time in milliseconds
highest_severity str | None "CRITICAL", "HIGH", "MEDIUM", "LOW"
critical list[PackageFinding] Only CRITICAL findings
high list[PackageFinding] Only HIGH findings
has_findings bool True if any vulnerabilities found

GitHub Actions

- name: Scan dependencies
  run: |
    pip install dep-scanner
    dep-scan --fail-on high requirements.txt

pre-commit hook

# .pre-commit-config.yaml
repos:
  - repo: https://github.com/SpiderCob/osv-scan
    rev: v0.1.0
    hooks:
      - id: dep-scan

How it works

  1. Parses your manifest file to extract (name, version, ecosystem) tuples
  2. Sends a single batch POST to https://api.osv.dev/v1/querybatch
  3. Parses severity from database_specific.severitycvss_score → CVSS vector
  4. Returns structured findings sorted by severity

Packages with unpinned version ranges (^1.0, >=2.0) are skipped — OSV requires exact versions.


License

Apache 2.0 — free to use in commercial projects.

Built by SpiderCob.

Download files

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

Source Distribution

osv_scan-0.1.3.tar.gz (17.3 kB view details)

Uploaded Source

Built Distribution

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

osv_scan-0.1.3-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file osv_scan-0.1.3.tar.gz.

File metadata

  • Download URL: osv_scan-0.1.3.tar.gz
  • Upload date:
  • Size: 17.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.2

File hashes

Hashes for osv_scan-0.1.3.tar.gz
Algorithm Hash digest
SHA256 c114c241ace02c16ae5e2242ea8c5e3adb076140bb78ed08a48ab57098d535fb
MD5 a5bfb24480b833509500d2a7da5fe174
BLAKE2b-256 57a42fb373cb5b912456d1ce3031494a6eca35770c9ecc0b784936fb15c1b26e

See more details on using hashes here.

File details

Details for the file osv_scan-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: osv_scan-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 17.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.2

File hashes

Hashes for osv_scan-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 65104d518ad8a8e69c7dec5322c01a3080b253201460ee2b47064ebfe51675c0
MD5 9e9840558e1bed3113ec94d3c722cfbb
BLAKE2b-256 d7157573ca2b1797ceddb528f812ced8f700d03e5af9206db9494ef5c84ca579

See more details on using hashes here.

Release history Release notifications | RSS feed

0.2.0

2 files

This release

0.1.3 This release

2 files

0.1.2

1 file

0.1.1

1 file

0.1.0

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page