osv-scanner
Vulnerability scanner written in Go which uses the data provided by https://osv.dev
Top Related Projects
A vulnerability scanner for container images and filesystems
Find vulnerabilities, misconfigurations, secrets, SBOM in containers, Kubernetes, code repositories, clouds and more
OWASP dependency-check is a software composition analysis utility that detects publicly disclosed vulnerabilities in application dependencies.
Snyk CLI scans and monitors your projects for security vulnerabilities.
🤖 Dependabot's core logic for creating update PRs.
Quick Overview
OSV-Scanner is a vulnerability scanner that uses the Open Source Vulnerability (OSV) database to identify known vulnerabilities in open source dependencies. It supports multiple ecosystems and package formats, providing developers with a tool to check their projects for potential security issues.
Pros
- Supports multiple ecosystems (Go, npm, PyPI, Maven, etc.)
- Uses the comprehensive OSV database for vulnerability information
- Integrates easily with CI/CD pipelines
- Provides detailed vulnerability reports with remediation suggestions
Cons
- May produce false positives in some cases
- Requires regular updates to maintain an up-to-date vulnerability database
- Limited to known vulnerabilities in the OSV database
- Can be resource-intensive for large projects with many dependencies
Getting Started
To install OSV-Scanner, run:
go install github.com/google/osv-scanner/cmd/osv-scanner@v1
To scan a directory:
osv-scanner /path/to/your/project
To scan specific files:
osv-scanner --file=/path/to/requirements.txt --file=/path/to/package-lock.json
For CI/CD integration, add this to your workflow:
- name: Run OSV-Scanner
uses: google/osv-scanner-action@v1
with:
path: "."
Competitor Comparisons
A vulnerability scanner for container images and filesystems
Pros of Grype
- Supports scanning a wide range of package types and ecosystems
- Provides detailed vulnerability information, including severity and fix versions
- Offers flexible output formats (JSON, SARIF, table) for easy integration
Cons of Grype
- Limited to scanning for known vulnerabilities in packages
- May have a larger resource footprint compared to OSV-Scanner
Code Comparison
OSV-Scanner:
osv-scanner /path/to/project
Grype:
grype /path/to/project
Key Differences
- OSV-Scanner focuses on scanning source code and dependencies against the OSV database
- Grype is designed for scanning container images and filesystems for known vulnerabilities
- OSV-Scanner has native integration with Git repositories and commit ranges
- Grype offers more comprehensive package ecosystem coverage
Use Cases
OSV-Scanner is ideal for:
- Continuous integration pipelines for open-source projects
- Developers looking for a lightweight, fast vulnerability scanner
Grype is better suited for:
- Container image scanning in DevSecOps workflows
- Comprehensive vulnerability assessment of complex applications with multiple package types
Both tools contribute to improving software security, but their specific strengths make them suitable for different scenarios in the software development lifecycle.
Find vulnerabilities, misconfigurations, secrets, SBOM in containers, Kubernetes, code repositories, clouds and more
Pros of Trivy
- Broader scanning capabilities: Trivy can scan container images, filesystems, git repositories, and more, while OSV-Scanner primarily focuses on scanning source code and dependencies.
- Built-in database: Trivy includes a vulnerability database, reducing reliance on external sources for vulnerability information.
- Faster scanning: Trivy is generally known for its quick scanning speed, especially for container images.
Cons of Trivy
- Higher resource usage: Trivy may require more system resources due to its comprehensive scanning capabilities.
- Steeper learning curve: With more features and options, Trivy can be more complex to set up and use effectively.
Code Comparison
Trivy:
trivy image python:3.4-alpine
OSV-Scanner:
osv-scanner --lockfile=/path/to/requirements.txt
Both tools offer command-line interfaces for scanning, but Trivy's command is more focused on container images, while OSV-Scanner is geared towards dependency files.
OWASP dependency-check is a software composition analysis utility that detects publicly disclosed vulnerabilities in application dependencies.
Pros of DependencyCheck
- More mature project with a longer history and larger community
- Supports a wider range of programming languages and package ecosystems
- Offers more detailed reporting options and integration with CI/CD tools
Cons of DependencyCheck
- Slower scan times, especially for large projects
- Requires more system resources and setup compared to OSV-Scanner
- Less frequent updates to vulnerability database
Code Comparison
DependencyCheck CLI usage:
dependency-check --project "My Project" --scan /path/to/source-code
OSV-Scanner CLI usage:
osv-scanner /path/to/source-code
Both tools can be integrated into CI/CD pipelines, but DependencyCheck offers more configuration options:
DependencyCheck in Jenkins:
dependencyCheck additionalArguments: '--format HTML --format XML',
odcInstallation: 'OWASP Dependency-Check'
OSV-Scanner in GitHub Actions:
- uses: google/osv-scanner@v1
with:
path: "."
DependencyCheck provides more comprehensive reports but requires more setup, while OSV-Scanner offers a simpler, faster solution with a focus on known vulnerabilities in open-source packages. The choice between them depends on project requirements, available resources, and desired level of detail in vulnerability reporting.
Snyk CLI scans and monitors your projects for security vulnerabilities.
Pros of Snyk CLI
- Broader ecosystem support, covering more languages and package managers
- Offers remediation advice and automatic fix pull requests
- Integrates with Snyk's vulnerability database and additional security features
Cons of Snyk CLI
- Requires an account and potentially a paid subscription for full functionality
- May have a steeper learning curve due to more extensive features
- Can be slower for large projects due to its comprehensive analysis
Code Comparison
OSV Scanner:
osv-scanner /path/to/project
Snyk CLI:
snyk test /path/to/project
snyk monitor /path/to/project
OSV Scanner focuses on simplicity and ease of use, with a straightforward command to scan a project. Snyk CLI offers more options, including the ability to test and continuously monitor projects for vulnerabilities.
Both tools aim to identify vulnerabilities in open-source dependencies, but they differ in their approach and feature set. OSV Scanner is a lightweight, open-source tool that leverages the OSV database, while Snyk CLI is part of a larger commercial platform with additional security features and integrations.
🤖 Dependabot's core logic for creating update PRs.
Pros of Dependabot-core
- Broader ecosystem support, covering multiple package managers and languages
- Automated pull request creation for dependency updates
- Integration with GitHub's native features and workflows
Cons of Dependabot-core
- More complex setup and configuration compared to OSV-scanner
- Focused primarily on dependency updates rather than comprehensive vulnerability scanning
- May require more resources to run and maintain
Code Comparison
OSV-scanner:
func ScanArtifact(ctx context.Context, a *artifact.Artifact) ([]*osv.Entry, error) {
// Scanning logic
}
Dependabot-core:
def create_pull_request(dependency, version_to_update, updated_version)
# Pull request creation logic
end
While OSV-scanner focuses on direct vulnerability scanning, Dependabot-core emphasizes dependency update automation. OSV-scanner provides a more straightforward approach to identifying vulnerabilities, while Dependabot-core offers a comprehensive solution for managing dependencies within the GitHub ecosystem. The choice between the two depends on specific project needs, with OSV-scanner being more suitable for quick vulnerability checks and Dependabot-core for ongoing dependency management.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
OSV-Scanner
Use OSV-Scanner to find existing vulnerabilities affecting your project's dependencies.
OSV-Scanner provides an officially supported frontend to the OSV database that connects a projectâs list of dependencies with the vulnerabilities that affect them. Since the OSV.dev database is open source and distributed, it has several benefits in comparison with closed source advisory databases and scanners:
- Each advisory comes from an open and authoritative source (e.g. the RustSec Advisory Database)
- Anyone can suggest improvements to advisories, resulting in a very high quality database
- The OSV format unambiguously stores information about affected versions in a machine-readable format that precisely maps onto a developerâs list of packages
The above all results in fewer, more actionable vulnerability notifications, which reduces the time needed to resolve them. Check out our announcement blog post for more details!
Documentation
Read our detailed documentation to learn how to use OSV-Scanner.
Go toolchain compatibility policy
We aim to keep the osv-scanner library packages compatible with supported versions of Go (last 2 Go releases), while always building osv-scanner binaries with the latest version of Go.
Contribute
Report Problems
If you have what looks like a bug, please use the GitHub issue tracking system. Before you file an issue, please search existing issues to see if your issue is already covered.
Contributing code to osv-scanner
See CONTRIBUTING.md for documentation on how to contribute code.
Star History
Top Related Projects
A vulnerability scanner for container images and filesystems
Find vulnerabilities, misconfigurations, secrets, SBOM in containers, Kubernetes, code repositories, clouds and more
OWASP dependency-check is a software composition analysis utility that detects publicly disclosed vulnerabilities in application dependencies.
Snyk CLI scans and monitors your projects for security vulnerabilities.
🤖 Dependabot's core logic for creating update PRs.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot