Commit 3edae66
authored
* feat(pq): dependency-level PQ scanning for Cargo.lock and requirements.txt (closes #221)
Scan manifest/lock files against curated crypto package databases to
surface PQ-vulnerable dependencies that source-level rules can't see.
- CargoLockPqCrypto: BFS transitive graph traversal with 6 tier-1 seeds
(RSA, ECDSA, Ed25519, X25519 at 0.9 confidence) and 3 tier-2 seeds
(ring, openssl-sys, aws-lc-rs at 0.6)
- RequirementsTxtPqCrypto: direct lookup against 11 curated packages
with per-package confidence (0.5-0.95), PEP 503 normalization
- New dep_name field on Finding for manifest-level attribution
- Replace is_pq_rule_id substring hack with explicit whitelist
- Language::Manifest via bash-dummy tree-sitter pattern
* fix(pq): address CI and review feedback for manifest scanning
- Fix clippy collapsible_str_replace: use replace(['_', '.'], "-")
- Fix rustfmt formatting for struct initializer arrays
- Fix source.find() returning first occurrence for duplicate crate
names by searching for unique name+version pair
- Fix CRLF line ending drift in requirements.txt byte offset tracking
- Normalize pip_map keys so future entries with mixed case won't break
* fix(pq): prevent is_pq_rule_id false positive on go/insecure-tls-skip-verify
id.contains("insecure-tls") matches non-PQ rules like
go/insecure-tls-skip-verify. Use exact match for the one
Dockerfile rule that belongs in the PQ set.
* fix(pq): address manifest scanning correctness issues
- Remove find_name_version_offset fallback that silently picked wrong
package entry when name+version pair wasn't adjacent
- Stop BFS at seed crates instead of traversing through their deps
- Handle bare CR line endings in requirements.txt offset tracking
- Use .first().unwrap() over index [0] for reached_seeds
- Unify CrateEntry/PipEntry into SeedEntry, extract shared constants
* test(pq): add unit tests for manifest scanning rules
Cover CargoLockPqCrypto (BFS graph walk, seed detection, transitive
deps, version-qualified strings, confidence tiebreaking, BFS stopping
at seeds), RequirementsTxtPqCrypto (PEP 503 normalization, CRLF
offsets, comments/options skipping, environment markers, extras),
and find_name_version_offset (disambiguation, CRLF, missing entries).
* test(pq): strengthen manifest test assertions
- Redesign BFS-stops-at-seed test: use ring (0.6) → rsa (0.9) chain
so confidence value distinguishes correct vs incorrect traversal
- Assert column and end_column in CRLF offset test, not just line
- Add test for name-exists-but-version-mismatches → returns None
- Add multi-version diamond test (syn 1.x vs 2.x with version-
qualified dep strings)
* fix(pq): resolve version-qualified dep strings to exact package
Version-qualified dep strings like "syn 2.0.0" were split on space
but the version was discarded — edges fanned out to all indices with
that crate name regardless of version. Add name_ver_to_index lookup
so version-qualified strings resolve to exactly one package.
Strengthen multi-version diamond test: syn 1.0 now depends on ring
(0.6) while syn 2.0 depends on rsa (0.9), so incorrect edge
resolution would produce a different confidence value.
* test(pq): fix tautological multi-version diamond assertion
Swap seeds: syn 1.0 → rsa (0.9), syn 2.0 → ring (0.6). Old buggy
code (fan-out to both versions) would reach rsa and report 0.9.
Correct code resolves to syn 2.0 only → ring → 0.6. The assertion
now actually discriminates the bug from the fix.
* fix(pq): use max_by instead of sort_by for highest-confidence seed
Avoids mutating the vec just to pick one element.
1 parent 39127c1 commit 3edae66
28 files changed
Lines changed: 1132 additions & 4 deletions
File tree
- src
- bin
- engine
- report
- rules
- tests
- fixtures/deps
- www/src/data
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
495 | 495 | | |
496 | 496 | | |
497 | 497 | | |
498 | | - | |
| 498 | + | |
499 | 499 | | |
500 | 500 | | |
501 | 501 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
| 179 | + | |
179 | 180 | | |
180 | 181 | | |
181 | 182 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| 51 | + | |
50 | 52 | | |
51 | 53 | | |
52 | 54 | | |
| |||
66 | 68 | | |
67 | 69 | | |
68 | 70 | | |
| 71 | + | |
69 | 72 | | |
70 | 73 | | |
71 | 74 | | |
| |||
85 | 88 | | |
86 | 89 | | |
87 | 90 | | |
| 91 | + | |
88 | 92 | | |
89 | 93 | | |
90 | 94 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
262 | 262 | | |
263 | 263 | | |
264 | 264 | | |
| 265 | + | |
265 | 266 | | |
266 | 267 | | |
267 | 268 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1238 | 1238 | | |
1239 | 1239 | | |
1240 | 1240 | | |
| 1241 | + | |
1241 | 1242 | | |
1242 | 1243 | | |
1243 | 1244 | | |
| |||
1303 | 1304 | | |
1304 | 1305 | | |
1305 | 1306 | | |
| 1307 | + | |
1306 | 1308 | | |
1307 | 1309 | | |
1308 | 1310 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
289 | 289 | | |
290 | 290 | | |
291 | 291 | | |
| 292 | + | |
292 | 293 | | |
293 | 294 | | |
294 | 295 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
| 119 | + | |
119 | 120 | | |
120 | 121 | | |
121 | 122 | | |
| |||
492 | 493 | | |
493 | 494 | | |
494 | 495 | | |
495 | | - | |
| 496 | + | |
| 497 | + | |
496 | 498 | | |
497 | 499 | | |
498 | 500 | | |
| |||
0 commit comments