The cli tool for checking the security of the packages.
Project description
SafePackages
SafePackages is a powerful Python CLI tool designed to scan your project's dependencies for known vulnerabilities. It leverages the OSV (Open Source Vulnerabilities) database to provide accurate and up-to-date security information for a wide range of ecosystems.
Features
- Multi-Mode Scanning:
- Single Package: Scan a specific package version.
- Manifest File: Parse and scan dependency files (e.g.,
requirements.txt,package.json). - Batch Mode: Scan a list of packages from a JSON input.
- Broad Ecosystem Support: Supports npm, PyPI, Maven, NuGet, Go, Rust, PHP (Composer), Ruby (Gems), and more.
- Flexible Output: Generate reports in Table, JSON, or CSV formats.
- CI/CD Ready:
- Set failure thresholds (e.g., fail only on
CRITICALorHIGHseverity). - Exit codes for pipeline integration.
- Set failure thresholds (e.g., fail only on
- Dev Dependency Control: Option to include or exclude development dependencies.
Installation
You can install SafePackages using pip:
pip install safe-packages
Or using uv:
uv pip install safe-packages
Usage
After installation, the safepackages command will be available. You can see the help message by running:
safepackages --help
Commands
SafePackages provides three main commands:
1. scan - Scan a Single Package
Scan a specific package version for vulnerabilities.
Usage:
safepackages scan [OPTIONS] NAME
Arguments:
NAME: The name of the package to scan (Required).
Options:
-e, --ecosystem TEXT: Package ecosystem (e.g., npm, PyPI, Maven, NuGet) (Required).-v, --version TEXT: Package version to check.-f, --format [table|json|csv]: Output format (Default: table).-o, --output TEXT: Write output to a file.--fail-on [low|medium|high|critical]: Exit with error code 1 if vulnerabilities of this severity or higher are found (Default: high).
Example:
safepackages scan requests --version 2.20.0 --ecosystem PyPI
2. file - Scan a Manifest File
Scan a dependency manifest file. The file type is automatically detected.
Usage:
safepackages file [OPTIONS] FILE_PATH
Arguments:
FILE_PATH: Path to the manifest file (Required).
Options:
--include-dev: Include development dependencies in the scan.-f, --format [table|json|csv]: Output format (Default: table).-o, --output TEXT: Write output to a file.--fail-on [low|medium|high|critical]: Exit with error code 1 if vulnerabilities of this severity or higher are found (Default: high).
Supported Manifests:
requirements.txt,poetry.lock,Pipfile.lock(Python)package.json,package-lock.json(npm)yarn.lock(yarn)pom.xml(Maven)go.mod(Go)Cargo.lock(Rust)Gemfile.lock(Ruby)composer.lock(PHP)packages.config,*.csproj(NuGet)
Example:
safepackages file requirements.txt --include-dev --format json
3. batch - Batch Scan
Scan a list of packages from a JSON input string or file.
Usage:
safepackages batch [OPTIONS] JSON_INPUT
Arguments:
JSON_INPUT: A JSON string array of packages or a path to a JSON file (Required).- Format:
[{"name": "pkg_name", "version": "1.0.0", "ecosystem": "PyPI"}, ...]
- Format:
Options:
-f, --format [table|json|csv]: Output format (Default: table).-o, --output TEXT: Write output to a file.--fail-on [low|medium|high|critical]: Exit with error code 1 if vulnerabilities of this severity or higher are found (Default: high).
Example:
# From JSON string
safepackages batch '[{"name":"django","version":"3.0.0","ecosystem":"PyPI"}]'
# From JSON file
safepackages batch packages.json
Development
We use uv and poethepoet for development.
- Install
uv: https://github.com/astral-sh/uv - Run tasks:
uv run poe check- Run full verification (lint, test, build).uv run poe list- List all available tasks.
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file safe_packages-0.1.1.tar.gz.
File metadata
- Download URL: safe_packages-0.1.1.tar.gz
- Upload date:
- Size: 21.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c99b8628e7eb1c6e9414186bb146df26f95e84f6c65c4c003461b1e8457768f9
|
|
| MD5 |
19faf0bdae8de24ce3816e583cd2d6b4
|
|
| BLAKE2b-256 |
1ab2430b36806dd41d8463e4d748099293c6ce1750d5741affce8048a324d307
|
Provenance
The following attestation bundles were made for safe_packages-0.1.1.tar.gz:
Publisher:
release.yml on thedevappsecguy/safe-packages
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
safe_packages-0.1.1.tar.gz -
Subject digest:
c99b8628e7eb1c6e9414186bb146df26f95e84f6c65c4c003461b1e8457768f9 - Sigstore transparency entry: 753658305
- Sigstore integration time:
-
Permalink:
thedevappsecguy/safe-packages@0f1d84d5bbfa2fde6243e4227098658f86f5e086 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/thedevappsecguy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0f1d84d5bbfa2fde6243e4227098658f86f5e086 -
Trigger Event:
release
-
Statement type:
File details
Details for the file safe_packages-0.1.1-py3-none-any.whl.
File metadata
- Download URL: safe_packages-0.1.1-py3-none-any.whl
- Upload date:
- Size: 31.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a0155beb793fc24821ebb5b62d4169f61c394b031ffac6eb58a2d732978db16
|
|
| MD5 |
91c58d225e962ed23956cd81617eb347
|
|
| BLAKE2b-256 |
6b29ae5b42215565bcc49f915e9ab5c43ec03909572e4e74d1e7d931d3909ce4
|
Provenance
The following attestation bundles were made for safe_packages-0.1.1-py3-none-any.whl:
Publisher:
release.yml on thedevappsecguy/safe-packages
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
safe_packages-0.1.1-py3-none-any.whl -
Subject digest:
1a0155beb793fc24821ebb5b62d4169f61c394b031ffac6eb58a2d732978db16 - Sigstore transparency entry: 753658322
- Sigstore integration time:
-
Permalink:
thedevappsecguy/safe-packages@0f1d84d5bbfa2fde6243e4227098658f86f5e086 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/thedevappsecguy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0f1d84d5bbfa2fde6243e4227098658f86f5e086 -
Trigger Event:
release
-
Statement type: