pysentry-rs 0.1.5__tar.gz → 0.2.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of pysentry-rs might be problematic. Click here for more details.
- pysentry_rs-0.2.1/.github/FUNDING.yml +1 -0
- {pysentry_rs-0.1.5 → pysentry_rs-0.2.1}/.github/workflows/ci.yml +12 -10
- {pysentry_rs-0.1.5 → pysentry_rs-0.2.1}/Cargo.lock +1 -1
- {pysentry_rs-0.1.5 → pysentry_rs-0.2.1}/Cargo.toml +1 -1
- {pysentry_rs-0.1.5 → pysentry_rs-0.2.1}/PKG-INFO +85 -34
- {pysentry_rs-0.1.5 → pysentry_rs-0.2.1}/README.md +84 -33
- pysentry_rs-0.2.1/python/pysentry/__init__.py +292 -0
- pysentry_rs-0.2.1/src/main.rs +1117 -0
- {pysentry_rs-0.1.5 → pysentry_rs-0.2.1}/src/output/report.rs +292 -0
- {pysentry_rs-0.1.5 → pysentry_rs-0.2.1}/src/parsers/lock.rs +155 -182
- {pysentry_rs-0.1.5 → pysentry_rs-0.2.1}/src/parsers/mod.rs +4 -3
- pysentry_rs-0.2.1/src/parsers/poetry_lock.rs +365 -0
- {pysentry_rs-0.1.5 → pysentry_rs-0.2.1}/src/parsers/pyproject.rs +87 -36
- {pysentry_rs-0.1.5 → pysentry_rs-0.2.1}/src/providers/osv.rs +286 -21
- {pysentry_rs-0.1.5 → pysentry_rs-0.2.1}/src/python.rs +56 -12
- {pysentry_rs-0.1.5 → pysentry_rs-0.2.1}/src/types.rs +1 -0
- pysentry_rs-0.2.1/src/vulnerability/database.rs +439 -0
- pysentry_rs-0.1.5/python/pysentry/__init__.py +0 -167
- pysentry_rs-0.1.5/src/main.rs +0 -707
- pysentry_rs-0.1.5/src/vulnerability/database.rs +0 -163
- {pysentry_rs-0.1.5 → pysentry_rs-0.2.1}/.github/dependabot.yml +0 -0
- {pysentry_rs-0.1.5 → pysentry_rs-0.2.1}/.github/workflows/release.yml +0 -0
- {pysentry_rs-0.1.5 → pysentry_rs-0.2.1}/.gitignore +0 -0
- {pysentry_rs-0.1.5 → pysentry_rs-0.2.1}/.pre-commit-config.yaml +0 -0
- {pysentry_rs-0.1.5 → pysentry_rs-0.2.1}/LICENSE +0 -0
- {pysentry_rs-0.1.5 → pysentry_rs-0.2.1}/fixtures/requirements-tests/requirements-dev.txt +0 -0
- {pysentry_rs-0.1.5 → pysentry_rs-0.2.1}/fixtures/requirements-tests/requirements.txt +0 -0
- {pysentry_rs-0.1.5 → pysentry_rs-0.2.1}/fixtures/requirements-tests-vulnerable/requirements.txt +0 -0
- {pysentry_rs-0.1.5 → pysentry_rs-0.2.1}/pyproject.toml +0 -0
- {pysentry_rs-0.1.5 → pysentry_rs-0.2.1}/python/pysentry/__main__.py +0 -0
- {pysentry_rs-0.1.5 → pysentry_rs-0.2.1}/src/cache/audit.rs +0 -0
- {pysentry_rs-0.1.5 → pysentry_rs-0.2.1}/src/cache/mod.rs +0 -0
- {pysentry_rs-0.1.5 → pysentry_rs-0.2.1}/src/cache/storage.rs +0 -0
- {pysentry_rs-0.1.5 → pysentry_rs-0.2.1}/src/dependency/mod.rs +0 -0
- {pysentry_rs-0.1.5 → pysentry_rs-0.2.1}/src/dependency/resolvers/mod.rs +0 -0
- {pysentry_rs-0.1.5 → pysentry_rs-0.2.1}/src/dependency/resolvers/pip_tools.rs +0 -0
- {pysentry_rs-0.1.5 → pysentry_rs-0.2.1}/src/dependency/resolvers/uv.rs +0 -0
- {pysentry_rs-0.1.5 → pysentry_rs-0.2.1}/src/dependency/scanner.rs +0 -0
- {pysentry_rs-0.1.5 → pysentry_rs-0.2.1}/src/error.rs +0 -0
- {pysentry_rs-0.1.5 → pysentry_rs-0.2.1}/src/lib.rs +0 -0
- {pysentry_rs-0.1.5 → pysentry_rs-0.2.1}/src/output/mod.rs +0 -0
- {pysentry_rs-0.1.5 → pysentry_rs-0.2.1}/src/output/sarif.rs +0 -0
- {pysentry_rs-0.1.5 → pysentry_rs-0.2.1}/src/parsers/requirements.rs +0 -0
- {pysentry_rs-0.1.5 → pysentry_rs-0.2.1}/src/providers/mod.rs +0 -0
- {pysentry_rs-0.1.5 → pysentry_rs-0.2.1}/src/providers/pypa.rs +0 -0
- {pysentry_rs-0.1.5 → pysentry_rs-0.2.1}/src/providers/pypi.rs +0 -0
- {pysentry_rs-0.1.5 → pysentry_rs-0.2.1}/src/vulnerability/matcher.rs +0 -0
- {pysentry_rs-0.1.5 → pysentry_rs-0.2.1}/src/vulnerability/mod.rs +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
buy_me_a_coffee: nyudenkov
|
|
@@ -4,19 +4,21 @@ on:
|
|
|
4
4
|
push:
|
|
5
5
|
branches: [main]
|
|
6
6
|
paths-ignore:
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
7
|
+
- "**.md"
|
|
8
|
+
- "LICENSE"
|
|
9
|
+
- ".gitignore"
|
|
10
|
+
- ".editorconfig"
|
|
11
|
+
- ".github/dependabot.yml"
|
|
12
|
+
- ".github/FUNDING.yml"
|
|
12
13
|
pull_request:
|
|
13
14
|
branches: [main]
|
|
14
15
|
paths-ignore:
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
16
|
+
- "**.md"
|
|
17
|
+
- "LICENSE"
|
|
18
|
+
- ".gitignore"
|
|
19
|
+
- ".editorconfig"
|
|
20
|
+
- ".github/dependabot.yml"
|
|
21
|
+
- ".github/FUNDING.yml"
|
|
20
22
|
|
|
21
23
|
env:
|
|
22
24
|
CARGO_TERM_COLOR: always
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pysentry-rs
|
|
3
|
-
Version: 0.1
|
|
3
|
+
Version: 0.2.1
|
|
4
4
|
Classifier: Development Status :: 4 - Beta
|
|
5
5
|
Classifier: Intended Audience :: Developers
|
|
6
6
|
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
@@ -26,30 +26,32 @@ Project-URL: Issues, https://github.com/nyudenkov/pysentry/issues
|
|
|
26
26
|
|
|
27
27
|
# 🐍 PySentry
|
|
28
28
|
|
|
29
|
+
[](https://google.github.io/osv.dev/)
|
|
30
|
+
|
|
29
31
|
[Help to test and improve](https://github.com/nyudenkov/pysentry/issues/12)
|
|
30
32
|
|
|
31
33
|
A fast, reliable security vulnerability scanner for Python projects, written in Rust.
|
|
32
34
|
|
|
33
35
|
## Overview
|
|
34
36
|
|
|
35
|
-
PySentry audits Python projects for known security vulnerabilities by analyzing dependency files (`uv.lock`, `pyproject.toml`, `requirements.txt`) and cross-referencing them against multiple vulnerability databases. It provides comprehensive reporting with support for various output formats and filtering options.
|
|
37
|
+
PySentry audits Python projects for known security vulnerabilities by analyzing dependency files (`uv.lock`, `poetry.lock`, `pyproject.toml`, `requirements.txt`) and cross-referencing them against multiple vulnerability databases. It provides comprehensive reporting with support for various output formats and filtering options.
|
|
36
38
|
|
|
37
39
|
## Key Features
|
|
38
40
|
|
|
39
|
-
- **Multiple Project Formats**: Supports `uv.lock`, `pyproject.toml`, and `requirements.txt` files
|
|
41
|
+
- **Multiple Project Formats**: Supports `uv.lock`, `poetry.lock`, `pyproject.toml`, and `requirements.txt` files
|
|
40
42
|
- **External Resolver Integration**: Leverages `uv` and `pip-tools` for accurate requirements.txt constraint solving
|
|
41
43
|
- **Multiple Data Sources**:
|
|
42
44
|
- PyPA Advisory Database (default)
|
|
43
45
|
- PyPI JSON API
|
|
44
46
|
- OSV.dev (Open Source Vulnerabilities)
|
|
45
|
-
- **Flexible Output**: Human-readable, JSON, and
|
|
47
|
+
- **Flexible Output for different workflows**: Human-readable, JSON, SARIF, and Markdown formats
|
|
46
48
|
- **Performance Focused**:
|
|
47
49
|
- Written in Rust for speed
|
|
48
50
|
- Async/concurrent processing
|
|
49
51
|
- Intelligent caching system
|
|
50
52
|
- **Comprehensive Filtering**:
|
|
51
53
|
- Severity levels (low, medium, high, critical)
|
|
52
|
-
- Dependency
|
|
54
|
+
- Dependency scopes (main only vs all [optional, dev, prod, etc] dependencies)
|
|
53
55
|
- Direct vs. transitive dependencies
|
|
54
56
|
- **Enterprise Ready**: SARIF output for IDE/CI integration
|
|
55
57
|
|
|
@@ -174,7 +176,7 @@ pip install pip-tools
|
|
|
174
176
|
```
|
|
175
177
|
- Alternatively, install resolvers globally for system-wide availability
|
|
176
178
|
|
|
177
|
-
**Auto-detection:** PySentry automatically detects and prefers: `uv` > `pip-tools`. Without a resolver, only `uv.lock` and `
|
|
179
|
+
**Auto-detection:** PySentry automatically detects and prefers: `uv` > `pip-tools`. Without a resolver, only `uv.lock` and `poetry.lock` files can be scanned.
|
|
178
180
|
|
|
179
181
|
## Quick Start
|
|
180
182
|
|
|
@@ -189,15 +191,15 @@ uvx pysentry-rs /path/to/python/project
|
|
|
189
191
|
pysentry
|
|
190
192
|
pysentry /path/to/python/project
|
|
191
193
|
|
|
192
|
-
#
|
|
194
|
+
# Automatically detects project type (uv.lock, poetry.lock, pyproject.toml, requirements.txt)
|
|
193
195
|
pysentry /path/to/project
|
|
194
196
|
|
|
195
197
|
# Force specific resolver
|
|
196
198
|
pysentry --resolver uv /path/to/project
|
|
197
199
|
pysentry --resolver pip-tools /path/to/project
|
|
198
200
|
|
|
199
|
-
# Include
|
|
200
|
-
pysentry --
|
|
201
|
+
# Include all dependencies (main + dev + optional)
|
|
202
|
+
pysentry --all-extras
|
|
201
203
|
|
|
202
204
|
# Filter by severity (only show high and critical)
|
|
203
205
|
pysentry --severity high
|
|
@@ -210,14 +212,22 @@ pysentry --format json --output audit-results.json
|
|
|
210
212
|
|
|
211
213
|
```bash
|
|
212
214
|
# Using uvx for comprehensive audit
|
|
213
|
-
uvx pysentry-rs --
|
|
215
|
+
uvx pysentry-rs --all-extras --format sarif --output security-report.sarif
|
|
216
|
+
|
|
217
|
+
# Check multiple vulnerability sources concurrently
|
|
218
|
+
uvx pysentry-rs --sources pypa,osv,pypi /path/to/project
|
|
219
|
+
uvx pysentry-rs --sources pypa --sources osv --sources pypi
|
|
220
|
+
|
|
221
|
+
# Generate markdown report
|
|
222
|
+
uvx pysentry-rs --format markdown --output security-report.md
|
|
214
223
|
|
|
215
|
-
#
|
|
216
|
-
uvx pysentry-rs --
|
|
224
|
+
# Control CI exit codes - only fail on critical vulnerabilities
|
|
225
|
+
uvx pysentry-rs --fail-on critical
|
|
217
226
|
|
|
218
227
|
# Or with installed binary
|
|
219
|
-
pysentry --
|
|
220
|
-
pysentry --direct-only
|
|
228
|
+
pysentry --all-extras --format sarif --output security-report.sarif
|
|
229
|
+
pysentry --sources pypa,osv --direct-only
|
|
230
|
+
pysentry --format markdown --output security-report.md
|
|
221
231
|
|
|
222
232
|
# Ignore specific vulnerabilities
|
|
223
233
|
pysentry --ignore CVE-2023-12345 --ignore GHSA-xxxx-yyyy-zzzz
|
|
@@ -246,26 +256,45 @@ pysentry /path/to/project
|
|
|
246
256
|
pysentry --verbose --resolver uv /path/to/project
|
|
247
257
|
```
|
|
248
258
|
|
|
259
|
+
### CI/CD Integration Examples
|
|
260
|
+
|
|
261
|
+
```bash
|
|
262
|
+
# Development environment - only fail on critical vulnerabilities
|
|
263
|
+
pysentry --fail-on critical --format json --output security-report.json
|
|
264
|
+
|
|
265
|
+
# Staging environment - fail on high+ vulnerabilities
|
|
266
|
+
pysentry --fail-on high --sources pypa,osv --format sarif --output security.sarif
|
|
267
|
+
|
|
268
|
+
# Production deployment - strict security (fail on medium+, default)
|
|
269
|
+
pysentry --sources pypa,pypi,osv --format json --output prod-security.json
|
|
270
|
+
|
|
271
|
+
# Generate markdown report for GitHub issues/PRs
|
|
272
|
+
pysentry --format markdown --output SECURITY-REPORT.md
|
|
273
|
+
|
|
274
|
+
# Comprehensive audit with all sources and full reporting
|
|
275
|
+
pysentry --sources pypa,pypi,osv --all-extras --format json --fail-on low
|
|
276
|
+
```
|
|
277
|
+
|
|
249
278
|
## Configuration
|
|
250
279
|
|
|
251
280
|
### Command Line Options
|
|
252
281
|
|
|
253
|
-
| Option | Description
|
|
254
|
-
| ---------------- |
|
|
255
|
-
| `--format` | Output format: `human`, `json`, `sarif`
|
|
256
|
-
| `--severity` | Minimum severity: `low`, `medium`, `high`, `critical`
|
|
257
|
-
| `--
|
|
258
|
-
| `--
|
|
259
|
-
| `--
|
|
260
|
-
| `--direct-only` | Check only direct dependencies
|
|
261
|
-
| `--ignore` | Vulnerability IDs to ignore (repeatable)
|
|
262
|
-
| `--output` | Output file path
|
|
263
|
-
| `--no-cache` | Disable caching
|
|
264
|
-
| `--cache-dir` | Custom cache directory
|
|
265
|
-
| `--verbose` | Enable verbose output
|
|
266
|
-
| `--quiet` | Suppress non-error output
|
|
267
|
-
| `--resolver` | Dependency resolver: `auto`, `uv`, `pip-tools`
|
|
268
|
-
| `--requirements` | Additional requirements files (repeatable)
|
|
282
|
+
| Option | Description | Default |
|
|
283
|
+
| ---------------- | ------------------------------------------------------- | ------------------- |
|
|
284
|
+
| `--format` | Output format: `human`, `json`, `sarif`, `markdown` | `human` |
|
|
285
|
+
| `--severity` | Minimum severity: `low`, `medium`, `high`, `critical` | `low` |
|
|
286
|
+
| `--fail-on` | Fail (exit non-zero) on vulnerabilities ≥ severity | `medium` |
|
|
287
|
+
| `--sources` | Vulnerability sources: `pypa`, `pypi`, `osv` (multiple) | `pypa` |
|
|
288
|
+
| `--all-extras` | Include all dependencies (main + dev + optional) | `false` |
|
|
289
|
+
| `--direct-only` | Check only direct dependencies | `false` |
|
|
290
|
+
| `--ignore` | Vulnerability IDs to ignore (repeatable) | `[]` |
|
|
291
|
+
| `--output` | Output file path | `stdout` |
|
|
292
|
+
| `--no-cache` | Disable caching | `false` |
|
|
293
|
+
| `--cache-dir` | Custom cache directory | `~/.cache/pysentry` |
|
|
294
|
+
| `--verbose` | Enable verbose output | `false` |
|
|
295
|
+
| `--quiet` | Suppress non-error output | `false` |
|
|
296
|
+
| `--resolver` | Dependency resolver: `auto`, `uv`, `pip-tools` | `auto` |
|
|
297
|
+
| `--requirements` | Additional requirements files (repeatable) | `[]` |
|
|
269
298
|
|
|
270
299
|
### Cache Management
|
|
271
300
|
|
|
@@ -293,6 +322,23 @@ PySentry has support for `uv.lock` files:
|
|
|
293
322
|
- Source tracking
|
|
294
323
|
- Dependency classification (main, dev, optional) including transitive dependencies
|
|
295
324
|
|
|
325
|
+
### poetry.lock Files
|
|
326
|
+
|
|
327
|
+
Full support for Poetry lock files:
|
|
328
|
+
|
|
329
|
+
- **Exact Version Resolution**: Scans exact dependency versions locked by Poetry
|
|
330
|
+
- **Lock-File Only Analysis**: Relies purely on the lock file structure, no pyproject.toml parsing needed
|
|
331
|
+
- **Complete Dependency Tree**: Analyzes all resolved dependencies including transitive ones
|
|
332
|
+
- **Dependency Classification**: Distinguishes between main dependencies and optional groups (dev, test, etc.)
|
|
333
|
+
- **Source Tracking**: Supports PyPI registry, Git repositories, local paths, and direct URLs
|
|
334
|
+
|
|
335
|
+
**Key Features:**
|
|
336
|
+
|
|
337
|
+
- No external tools required
|
|
338
|
+
- Fast parsing with exact version information
|
|
339
|
+
- Handles Poetry's dependency groups and optional dependencies
|
|
340
|
+
- Perfect for Poetry-managed projects with established lock files
|
|
341
|
+
|
|
296
342
|
### requirements.txt Files (External Resolution)
|
|
297
343
|
|
|
298
344
|
Advanced support for `requirements.txt` files using external dependency resolvers:
|
|
@@ -360,6 +406,10 @@ Support for projects without lock files:
|
|
|
360
406
|
|
|
361
407
|
Most comfortable to read.
|
|
362
408
|
|
|
409
|
+
### Markdown
|
|
410
|
+
|
|
411
|
+
GitHub-friendly format with structured sections and severity indicators. Perfect for documentation, GitHub issues, and security reports.
|
|
412
|
+
|
|
363
413
|
### JSON
|
|
364
414
|
|
|
365
415
|
```json
|
|
@@ -447,7 +497,7 @@ src/
|
|
|
447
497
|
|
|
448
498
|
```bash
|
|
449
499
|
# Ensure you're in a Python project directory
|
|
450
|
-
ls pyproject.toml uv.lock requirements.txt
|
|
500
|
+
ls pyproject.toml uv.lock poetry.lock requirements.txt
|
|
451
501
|
|
|
452
502
|
# Or specify the path explicitly
|
|
453
503
|
pysentry /path/to/python/project
|
|
@@ -494,8 +544,9 @@ pysentry --verbose /path/to/project
|
|
|
494
544
|
# Check network connectivity
|
|
495
545
|
curl -I https://osv-vulnerabilities.storage.googleapis.com/
|
|
496
546
|
|
|
497
|
-
# Try with different
|
|
498
|
-
pysentry --
|
|
547
|
+
# Try with different or multiple sources
|
|
548
|
+
pysentry --sources pypi
|
|
549
|
+
pysentry --sources pypa,osv
|
|
499
550
|
```
|
|
500
551
|
|
|
501
552
|
**Slow requirements.txt resolution**
|
|
@@ -524,7 +575,7 @@ pysentry /path/to/python/project
|
|
|
524
575
|
pysentry --requirements requirements-dev.txt --requirements requirements-test.txt
|
|
525
576
|
|
|
526
577
|
# Check if higher-priority files exist (they take precedence)
|
|
527
|
-
ls uv.lock pyproject.toml
|
|
578
|
+
ls uv.lock poetry.lock pyproject.toml
|
|
528
579
|
```
|
|
529
580
|
|
|
530
581
|
**Performance Issues**
|
|
@@ -1,29 +1,31 @@
|
|
|
1
1
|
# 🐍 PySentry
|
|
2
2
|
|
|
3
|
+
[](https://google.github.io/osv.dev/)
|
|
4
|
+
|
|
3
5
|
[Help to test and improve](https://github.com/nyudenkov/pysentry/issues/12)
|
|
4
6
|
|
|
5
7
|
A fast, reliable security vulnerability scanner for Python projects, written in Rust.
|
|
6
8
|
|
|
7
9
|
## Overview
|
|
8
10
|
|
|
9
|
-
PySentry audits Python projects for known security vulnerabilities by analyzing dependency files (`uv.lock`, `pyproject.toml`, `requirements.txt`) and cross-referencing them against multiple vulnerability databases. It provides comprehensive reporting with support for various output formats and filtering options.
|
|
11
|
+
PySentry audits Python projects for known security vulnerabilities by analyzing dependency files (`uv.lock`, `poetry.lock`, `pyproject.toml`, `requirements.txt`) and cross-referencing them against multiple vulnerability databases. It provides comprehensive reporting with support for various output formats and filtering options.
|
|
10
12
|
|
|
11
13
|
## Key Features
|
|
12
14
|
|
|
13
|
-
- **Multiple Project Formats**: Supports `uv.lock`, `pyproject.toml`, and `requirements.txt` files
|
|
15
|
+
- **Multiple Project Formats**: Supports `uv.lock`, `poetry.lock`, `pyproject.toml`, and `requirements.txt` files
|
|
14
16
|
- **External Resolver Integration**: Leverages `uv` and `pip-tools` for accurate requirements.txt constraint solving
|
|
15
17
|
- **Multiple Data Sources**:
|
|
16
18
|
- PyPA Advisory Database (default)
|
|
17
19
|
- PyPI JSON API
|
|
18
20
|
- OSV.dev (Open Source Vulnerabilities)
|
|
19
|
-
- **Flexible Output**: Human-readable, JSON, and
|
|
21
|
+
- **Flexible Output for different workflows**: Human-readable, JSON, SARIF, and Markdown formats
|
|
20
22
|
- **Performance Focused**:
|
|
21
23
|
- Written in Rust for speed
|
|
22
24
|
- Async/concurrent processing
|
|
23
25
|
- Intelligent caching system
|
|
24
26
|
- **Comprehensive Filtering**:
|
|
25
27
|
- Severity levels (low, medium, high, critical)
|
|
26
|
-
- Dependency
|
|
28
|
+
- Dependency scopes (main only vs all [optional, dev, prod, etc] dependencies)
|
|
27
29
|
- Direct vs. transitive dependencies
|
|
28
30
|
- **Enterprise Ready**: SARIF output for IDE/CI integration
|
|
29
31
|
|
|
@@ -148,7 +150,7 @@ pip install pip-tools
|
|
|
148
150
|
```
|
|
149
151
|
- Alternatively, install resolvers globally for system-wide availability
|
|
150
152
|
|
|
151
|
-
**Auto-detection:** PySentry automatically detects and prefers: `uv` > `pip-tools`. Without a resolver, only `uv.lock` and `
|
|
153
|
+
**Auto-detection:** PySentry automatically detects and prefers: `uv` > `pip-tools`. Without a resolver, only `uv.lock` and `poetry.lock` files can be scanned.
|
|
152
154
|
|
|
153
155
|
## Quick Start
|
|
154
156
|
|
|
@@ -163,15 +165,15 @@ uvx pysentry-rs /path/to/python/project
|
|
|
163
165
|
pysentry
|
|
164
166
|
pysentry /path/to/python/project
|
|
165
167
|
|
|
166
|
-
#
|
|
168
|
+
# Automatically detects project type (uv.lock, poetry.lock, pyproject.toml, requirements.txt)
|
|
167
169
|
pysentry /path/to/project
|
|
168
170
|
|
|
169
171
|
# Force specific resolver
|
|
170
172
|
pysentry --resolver uv /path/to/project
|
|
171
173
|
pysentry --resolver pip-tools /path/to/project
|
|
172
174
|
|
|
173
|
-
# Include
|
|
174
|
-
pysentry --
|
|
175
|
+
# Include all dependencies (main + dev + optional)
|
|
176
|
+
pysentry --all-extras
|
|
175
177
|
|
|
176
178
|
# Filter by severity (only show high and critical)
|
|
177
179
|
pysentry --severity high
|
|
@@ -184,14 +186,22 @@ pysentry --format json --output audit-results.json
|
|
|
184
186
|
|
|
185
187
|
```bash
|
|
186
188
|
# Using uvx for comprehensive audit
|
|
187
|
-
uvx pysentry-rs --
|
|
189
|
+
uvx pysentry-rs --all-extras --format sarif --output security-report.sarif
|
|
190
|
+
|
|
191
|
+
# Check multiple vulnerability sources concurrently
|
|
192
|
+
uvx pysentry-rs --sources pypa,osv,pypi /path/to/project
|
|
193
|
+
uvx pysentry-rs --sources pypa --sources osv --sources pypi
|
|
194
|
+
|
|
195
|
+
# Generate markdown report
|
|
196
|
+
uvx pysentry-rs --format markdown --output security-report.md
|
|
188
197
|
|
|
189
|
-
#
|
|
190
|
-
uvx pysentry-rs --
|
|
198
|
+
# Control CI exit codes - only fail on critical vulnerabilities
|
|
199
|
+
uvx pysentry-rs --fail-on critical
|
|
191
200
|
|
|
192
201
|
# Or with installed binary
|
|
193
|
-
pysentry --
|
|
194
|
-
pysentry --direct-only
|
|
202
|
+
pysentry --all-extras --format sarif --output security-report.sarif
|
|
203
|
+
pysentry --sources pypa,osv --direct-only
|
|
204
|
+
pysentry --format markdown --output security-report.md
|
|
195
205
|
|
|
196
206
|
# Ignore specific vulnerabilities
|
|
197
207
|
pysentry --ignore CVE-2023-12345 --ignore GHSA-xxxx-yyyy-zzzz
|
|
@@ -220,26 +230,45 @@ pysentry /path/to/project
|
|
|
220
230
|
pysentry --verbose --resolver uv /path/to/project
|
|
221
231
|
```
|
|
222
232
|
|
|
233
|
+
### CI/CD Integration Examples
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
# Development environment - only fail on critical vulnerabilities
|
|
237
|
+
pysentry --fail-on critical --format json --output security-report.json
|
|
238
|
+
|
|
239
|
+
# Staging environment - fail on high+ vulnerabilities
|
|
240
|
+
pysentry --fail-on high --sources pypa,osv --format sarif --output security.sarif
|
|
241
|
+
|
|
242
|
+
# Production deployment - strict security (fail on medium+, default)
|
|
243
|
+
pysentry --sources pypa,pypi,osv --format json --output prod-security.json
|
|
244
|
+
|
|
245
|
+
# Generate markdown report for GitHub issues/PRs
|
|
246
|
+
pysentry --format markdown --output SECURITY-REPORT.md
|
|
247
|
+
|
|
248
|
+
# Comprehensive audit with all sources and full reporting
|
|
249
|
+
pysentry --sources pypa,pypi,osv --all-extras --format json --fail-on low
|
|
250
|
+
```
|
|
251
|
+
|
|
223
252
|
## Configuration
|
|
224
253
|
|
|
225
254
|
### Command Line Options
|
|
226
255
|
|
|
227
|
-
| Option | Description
|
|
228
|
-
| ---------------- |
|
|
229
|
-
| `--format` | Output format: `human`, `json`, `sarif`
|
|
230
|
-
| `--severity` | Minimum severity: `low`, `medium`, `high`, `critical`
|
|
231
|
-
| `--
|
|
232
|
-
| `--
|
|
233
|
-
| `--
|
|
234
|
-
| `--direct-only` | Check only direct dependencies
|
|
235
|
-
| `--ignore` | Vulnerability IDs to ignore (repeatable)
|
|
236
|
-
| `--output` | Output file path
|
|
237
|
-
| `--no-cache` | Disable caching
|
|
238
|
-
| `--cache-dir` | Custom cache directory
|
|
239
|
-
| `--verbose` | Enable verbose output
|
|
240
|
-
| `--quiet` | Suppress non-error output
|
|
241
|
-
| `--resolver` | Dependency resolver: `auto`, `uv`, `pip-tools`
|
|
242
|
-
| `--requirements` | Additional requirements files (repeatable)
|
|
256
|
+
| Option | Description | Default |
|
|
257
|
+
| ---------------- | ------------------------------------------------------- | ------------------- |
|
|
258
|
+
| `--format` | Output format: `human`, `json`, `sarif`, `markdown` | `human` |
|
|
259
|
+
| `--severity` | Minimum severity: `low`, `medium`, `high`, `critical` | `low` |
|
|
260
|
+
| `--fail-on` | Fail (exit non-zero) on vulnerabilities ≥ severity | `medium` |
|
|
261
|
+
| `--sources` | Vulnerability sources: `pypa`, `pypi`, `osv` (multiple) | `pypa` |
|
|
262
|
+
| `--all-extras` | Include all dependencies (main + dev + optional) | `false` |
|
|
263
|
+
| `--direct-only` | Check only direct dependencies | `false` |
|
|
264
|
+
| `--ignore` | Vulnerability IDs to ignore (repeatable) | `[]` |
|
|
265
|
+
| `--output` | Output file path | `stdout` |
|
|
266
|
+
| `--no-cache` | Disable caching | `false` |
|
|
267
|
+
| `--cache-dir` | Custom cache directory | `~/.cache/pysentry` |
|
|
268
|
+
| `--verbose` | Enable verbose output | `false` |
|
|
269
|
+
| `--quiet` | Suppress non-error output | `false` |
|
|
270
|
+
| `--resolver` | Dependency resolver: `auto`, `uv`, `pip-tools` | `auto` |
|
|
271
|
+
| `--requirements` | Additional requirements files (repeatable) | `[]` |
|
|
243
272
|
|
|
244
273
|
### Cache Management
|
|
245
274
|
|
|
@@ -267,6 +296,23 @@ PySentry has support for `uv.lock` files:
|
|
|
267
296
|
- Source tracking
|
|
268
297
|
- Dependency classification (main, dev, optional) including transitive dependencies
|
|
269
298
|
|
|
299
|
+
### poetry.lock Files
|
|
300
|
+
|
|
301
|
+
Full support for Poetry lock files:
|
|
302
|
+
|
|
303
|
+
- **Exact Version Resolution**: Scans exact dependency versions locked by Poetry
|
|
304
|
+
- **Lock-File Only Analysis**: Relies purely on the lock file structure, no pyproject.toml parsing needed
|
|
305
|
+
- **Complete Dependency Tree**: Analyzes all resolved dependencies including transitive ones
|
|
306
|
+
- **Dependency Classification**: Distinguishes between main dependencies and optional groups (dev, test, etc.)
|
|
307
|
+
- **Source Tracking**: Supports PyPI registry, Git repositories, local paths, and direct URLs
|
|
308
|
+
|
|
309
|
+
**Key Features:**
|
|
310
|
+
|
|
311
|
+
- No external tools required
|
|
312
|
+
- Fast parsing with exact version information
|
|
313
|
+
- Handles Poetry's dependency groups and optional dependencies
|
|
314
|
+
- Perfect for Poetry-managed projects with established lock files
|
|
315
|
+
|
|
270
316
|
### requirements.txt Files (External Resolution)
|
|
271
317
|
|
|
272
318
|
Advanced support for `requirements.txt` files using external dependency resolvers:
|
|
@@ -334,6 +380,10 @@ Support for projects without lock files:
|
|
|
334
380
|
|
|
335
381
|
Most comfortable to read.
|
|
336
382
|
|
|
383
|
+
### Markdown
|
|
384
|
+
|
|
385
|
+
GitHub-friendly format with structured sections and severity indicators. Perfect for documentation, GitHub issues, and security reports.
|
|
386
|
+
|
|
337
387
|
### JSON
|
|
338
388
|
|
|
339
389
|
```json
|
|
@@ -421,7 +471,7 @@ src/
|
|
|
421
471
|
|
|
422
472
|
```bash
|
|
423
473
|
# Ensure you're in a Python project directory
|
|
424
|
-
ls pyproject.toml uv.lock requirements.txt
|
|
474
|
+
ls pyproject.toml uv.lock poetry.lock requirements.txt
|
|
425
475
|
|
|
426
476
|
# Or specify the path explicitly
|
|
427
477
|
pysentry /path/to/python/project
|
|
@@ -468,8 +518,9 @@ pysentry --verbose /path/to/project
|
|
|
468
518
|
# Check network connectivity
|
|
469
519
|
curl -I https://osv-vulnerabilities.storage.googleapis.com/
|
|
470
520
|
|
|
471
|
-
# Try with different
|
|
472
|
-
pysentry --
|
|
521
|
+
# Try with different or multiple sources
|
|
522
|
+
pysentry --sources pypi
|
|
523
|
+
pysentry --sources pypa,osv
|
|
473
524
|
```
|
|
474
525
|
|
|
475
526
|
**Slow requirements.txt resolution**
|
|
@@ -498,7 +549,7 @@ pysentry /path/to/python/project
|
|
|
498
549
|
pysentry --requirements requirements-dev.txt --requirements requirements-test.txt
|
|
499
550
|
|
|
500
551
|
# Check if higher-priority files exist (they take precedence)
|
|
501
|
-
ls uv.lock pyproject.toml
|
|
552
|
+
ls uv.lock poetry.lock pyproject.toml
|
|
502
553
|
```
|
|
503
554
|
|
|
504
555
|
**Performance Issues**
|