Dependency vulnerabilities remain one of the most common attack vectors in modern software. A single outdated library with a known CVE can expose your entire application to exploitation. Self-hosted dependency vulnerability scanning lets you detect these risks early — before they reach production — without sending your dependency tree to third-party SaaS platforms.
In this guide, we compare three leading open-source dependency scanners: pip-audit (the official Python Packaging Authority tool), Safety (the most comprehensive Python-focused scanner), and OSV-Scanner (Google’s multi-language vulnerability scanner). Each tool takes a different approach to finding and reporting vulnerable packages, and understanding their strengths helps you build a robust software supply chain security pipeline.
For organizations already building a comprehensive security posture, dependency scanning complements container image scanning and license compliance checks as essential layers in your self-hosted security stack.
Why Self-Host Dependency Vulnerability Scanning
Running dependency scanning on your own infrastructure offers several advantages over cloud-based alternatives:
- Data privacy: Your dependency tree — which reveals your tech stack, versions, and architecture — never leaves your network. For regulated industries (healthcare, finance, government), this is often a compliance requirement.
- No rate limits or API quotas: Self-hosted scanners can run unlimited scans without hitting SaaS API restrictions, making them ideal for high-frequency CI/CD pipelines.
- Offline capability: Air-gapped environments with no internet access can still perform vulnerability checks using locally mirrored databases.
- Cost control: Open-source scanners eliminate per-scan or per-developer licensing fees, which can grow significantly for large teams.
- Customization: You control the vulnerability severity thresholds, ignore rules, and reporting formats to match your organization’s risk tolerance.
Tool Overview and Comparison
pip-audit
Maintained by: Python Packaging Authority (PyPA) / Trail of Bits
GitHub: pypa/pip-audit
Stars: 1,270 | Language: Python | Last updated: April 2026
pip-audit is the official Python dependency vulnerability scanner endorsed by the Python packaging community. It reads requirements.txt files and installed package environments, checking each dependency against the PyPI Advisory Database. It integrates natively with pip’s caching system and can emit CycloneDX SBOMs for downstream consumption.
Safety (Safety CLI)
Maintained by: SafetyCLI (formerly pyup.io)
GitHub: pyupio/safety
Stars: 1,976 | Language: Python | Last updated: March 2026
Safety is a Python dependency vulnerability scanner with access to one of the most comprehensive Python vulnerability databases available. It offers both a free tier with the open-source database and a paid tier with real-time updates, including malicious package detection. Safety supports system-wide scans, CI/CD integration via GitHub Actions, and automated fix suggestions.
OSV-Scanner
Maintained by: Google
GitHub: google/osv-scanner
Stars: 9,830 | Language: Go | Last updated: April 2026
OSV-Scanner is Google’s open-source vulnerability scanner built on top of the OSV.dev database. Unlike pip-audit and Safety, OSV-Scanner is multi-language — it supports Go, Java, JavaScript, Python, Ruby, Rust, PHP, Dart, and more. It can scan lockfiles, source directories, and even container images for vulnerabilities. Its call analysis feature determines whether a vulnerable function is actually being used in your code, reducing false positives significantly.
Feature Comparison Table
| Feature | pip-audit | Safety | OSV-Scanner |
|---|---|---|---|
| Languages | Python only | Python only | 11+ (Go, Java, JS, Python, Ruby, Rust, PHP, etc.) |
| Vulnerability Database | PyPI Advisory DB | Safety DB (commercial + free) | OSV.dev (aggregates GitHub, RustSec, Ubuntu, etc.) |
| Input Types | requirements.txt, installed env | requirements.txt, pyproject.toml, system-wide | Lockfiles, source dirs, container images, SBOMs |
| SBOM Output | CycloneDX (XML/JSON) | SBOM (JSON) | CycloneDX, SPDX, custom formats |
| Auto-Fix | Yes (--fix) | Yes (--apply-fixes) | No (guided remediation recommendations) |
| Call Analysis | No | No | Yes (reduces false positives) |
| CI/CD Integration | GitHub Action, pre-commit | GitHub Action, CLI | GitHub Action, GitLab CI, CLI |
| Offline / Air-Gapped | Yes (local PyPI cache) | Limited (requires auth for full DB) | Yes (local OSV database mirror) |
| License | Apache 2.0 | Mixed (core open, full DB commercial) | Apache 2.0 |
| Docker Image | Community | Official | Official |
| Container Scanning | No | No | Yes (layer-aware) |
| C/C++ Support | No | No | Yes (vendored code detection) |
Installation Guide
Installing pip-audit
pip-audit requires Python 3.10 or newer. Install it via pip:
| |
Alternatively, install via conda:
| |
Verify the installation:
| |
Installing Safety
Safety installs as a standard Python package:
| |
For the full commercial database, you’ll need to authenticate:
| |
This will prompt you to log in or create a SafetyCLI account. The free tier provides access to a subset of the vulnerability database.
Verify the installation:
| |
Installing OSV-Scanner
OSV-Scanner is distributed as a precompiled Go binary. Download the latest release:
| |
Or install via Go:
| |
For macOS:
| |
Verify the installation:
| |
Usage Examples
Scanning a Python Project with pip-audit
Scan a requirements.txt file:
| |
Scan the current installed environment:
| |
Output results in JSON format for CI/CD parsing:
| |
Generate a CycloneDX SBOM alongside the scan:
| |
Automatically fix vulnerable dependencies:
| |
This will upgrade packages to non-vulnerable versions where possible and update the requirements file accordingly.
Scanning with Safety
Run a basic scan in your project directory:
| |
Scan a specific requirements file:
| |
Output in JSON for automation:
| |
Generate an HTML report for management review:
| |
Apply automated fixes:
| |
Run a system-wide scan to check all installed Python packages:
| |
Scanning with OSV-Scanner
Scan a source directory recursively:
| |
Scan a specific lockfile:
| |
Scan a Docker container image:
| |
Output in CycloneDX format:
| |
Use call analysis to reduce false positives (Go projects):
| |
CI/CD Pipeline Integration
GitHub Actions: pip-audit
Add this workflow to .github/workflows/dependency-audit.yml:
| |
GitHub Actions: Safety
| |
GitHub Actions: OSV-Scanner
| |
GitLab CI: OSV-Scanner
For teams using GitLab, OSV-Scanner integrates cleanly:
| |
Choosing the Right Tool
The decision between these three tools depends on your technology stack and security requirements:
Choose pip-audit if:
- You work exclusively with Python projects
- You want an officially endorsed PyPA tool with no commercial strings attached
- You need CycloneDX SBOM generation as part of your supply chain security
- You prefer a simple, zero-configuration scanner that works with standard
requirements.txtfiles
Choose Safety if:
- You need the most comprehensive Python vulnerability database available
- Your team wants automated fix suggestions with policy-based version pinning
- You require HTML reports for non-technical stakeholders
- You’re willing to use a freemium model for access to the full vulnerability database
Choose OSV-Scanner if:
- Your organization uses multiple programming languages (polyglot stack)
- You need container image scanning alongside dependency scanning
- False positive reduction through call analysis is important for your workflow
- You want the most comprehensive vulnerability database (OSV aggregates from GitHub, RustSec, Ubuntu, Alpine, and more)
- You need C/C++ vendored code detection
For teams building a comprehensive self-hosted security pipeline, consider combining OSV-Scanner for multi-language coverage with a dedicated Python scanner for deeper Python-specific analysis. Pair your dependency scanning with SBOM tracking tools for end-to-end supply chain visibility.
FAQ
What is the difference between pip-audit and Safety?
pip-audit is the official PyPA tool that uses the open PyPI Advisory Database, while Safety uses SafetyCLI’s proprietary database which is more comprehensive but requires authentication for the full dataset. pip-audit is completely free with no account required, whereas Safety’s free tier is limited. Both support requirements.txt scanning and auto-fix capabilities, but Safety additionally supports system-wide scans and HTML report generation.
Can OSV-Scanner replace pip-audit for Python projects?
OSV-Scanner supports Python lockfiles (requirements.txt, Pipfile.lock, poetry.lock), so it can replace pip-audit for basic scanning. However, pip-audit has deeper Python-specific features like automatic environment scanning (pip-audit with no arguments scans installed packages) and the --fix flag for automatic remediation. For pure Python teams, pip-audit or Safety may be preferable. For polyglot teams, OSV-Scanner’s multi-language support makes it the better choice.
How often are vulnerability databases updated?
The PyPI Advisory Database (used by pip-audit) is updated continuously as new advisories are submitted. OSV.dev (used by OSV-Scanner) aggregates from multiple sources and updates in near real-time. Safety’s free database updates less frequently than its commercial tier, which provides real-time updates including malicious package detection. For production use, running scans on a weekly schedule (via cron or CI/CD) ensures timely detection of new vulnerabilities.
Do these tools work in air-gapped environments?
pip-audit can work offline if you have a local PyPI mirror (e.g., using devpi or bandersnatch). OSV-Scanner supports offline mode by downloading a local copy of the OSV database (osv-scanner download osv or using the --offline flag with a cached database). Safety requires network access for the commercial database, though the free tier has limited offline capability. For fully air-gapped environments, pip-audit and OSV-Scanner are the best options.
Can I integrate these tools with dependency update automation?
Yes. Tools like Renovate and Dependabot can automatically create pull requests for dependency updates. You can configure these tools to only open PRs for vulnerabilities flagged by your scanner, or use the scanner as a CI check to block PRs that introduce vulnerable dependencies. This creates a closed-loop system: the scanner detects vulnerabilities, and the automation tool fixes them.
Which tool has the lowest false positive rate?
OSV-Scanner generally has the lowest false positive rate, especially for Go projects where its call analysis feature determines whether vulnerable functions are actually invoked in your code. pip-audit and Safety report all known vulnerabilities for detected packages regardless of whether your code uses the affected functionality. For teams overwhelmed by false positives, OSV-Scanner’s call analysis can significantly reduce noise.