Skip to content

Commit eb949d8

Browse files
hyperpolymathclaude
andcommitted
feat(v2.5.0): crypto_misuse category — PA022
Add CryptoMisuse weak point category detecting cryptographic primitive misuse: MD5/SHA1 in security contexts (Rust/Python/JS/Go/Elixir), and constant-time comparison violations (== on secret/password/token/key variables). Context window heuristic (±200 chars) keeps FP rate low. Key-reuse and nonce-reuse deferred — not reliably detectable statically. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 0bba84d commit eb949d8

4 files changed

Lines changed: 31 additions & 8 deletions

File tree

CHANGELOG.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,30 @@
11
# Changelog
22

3+
## [2.3.0] - 2026-04-12
4+
5+
### Added
6+
- **CryptoMisuse category (PA022)**: New weak point category detecting cryptographic primitive
7+
misuse across five languages. Context-window heuristic (±200 chars) restricts MD5/SHA-1
8+
findings to security-sensitive usage — MD5 for file checksums is not flagged.
9+
- **Rust**: `md5::compute`/`Md5::new` and `sha1::Sha1`/`Sha1::new` in security context (High);
10+
`==` comparison on `secret`/`password`/`token`/`key` variables (Critical — timing attack).
11+
- **Python**: `hashlib.md5()`/`hashlib.sha1()` in security context (High);
12+
`==` on secret-named variables — use `hmac.compare_digest()` instead (Critical).
13+
- **JavaScript**: `crypto.createHash('md5')` and `crypto.createHash('sha1')` (High);
14+
`crypto.createHash('sha256')` is fine and not flagged.
15+
- **Go**: `md5.New()`/`md5.Sum()` and `sha1.New()`/`sha1.Sum()` in security context (High).
16+
- **Elixir**: `:crypto.hash(:md5, ...)` and `:crypto.hash(:sha, ...)` (High);
17+
`:crypto.mac(:hmac, :sha, ...)` is acceptable (HMAC-SHA1 is not broken) and not flagged.
18+
- Key-reuse and nonce-reuse deferred — not reliably detectable statically.
19+
- **has_security_context() helper**: Module-level helper function checks ±200 char window
20+
around a pattern match for security vocabulary (password, secret, token, auth, key,
21+
credential, hash, sign, verify, encrypt) to reduce false positives on benign MD5/SHA-1 use.
22+
- **PA022 → panicbot**: CryptoMisuse mapped to fleet category `static-analysis/crypto-misuse`
23+
with 0.75 confidence, Eliminate tier, Partial fixability. Confidence is honest — the context
24+
window has a modest false-positive rate when security vocabulary appears for unrelated reasons.
25+
- **Idris2 ABI completeness**: `PatternCompleteness.idr` updated — CryptoMisuse added to
26+
`WPCategory` with `detectorsFor` covering Rust, Python, JavaScript, Go, Elixir.
27+
328
## [2.2.0] - 2026-04-12
429

530
### Added
@@ -13,8 +38,6 @@
1338
with 0.85 confidence, Eliminate tier, fixable (adding pins resolves the finding).
1439
- **Idris2 ABI completeness**: `PatternCompleteness.idr` updated — SupplyChain added to
1540
`WPCategory` with `detectorsFor` covering Rust, Julia, Nix, JavaScript.
16-
- **CryptoMisuse wiring completed**: CryptoMisuse (PA022) now fully wired into
17-
`readiness.rs` expected categories and `translator.rs` category mapping.
1841

1942
### Changed
2043
- **Category count**: 22 → 23 (added SupplyChain)

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# SPDX-License-Identifier: PMPL-1.0-or-later
22
[package]
33
name = "panic-attack"
4-
version = "2.2.0"
4+
version = "2.3.0"
55
edition = "2021"
66
rust-version = "1.85.0"
77
authors = ["Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>"]

ROADMAP.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,10 @@ The estate uses SHA, Sodium, Ed25519, CBOR proofs, and hash-chain integrity
7979
throughout VerisimCore, Hypatia attestations, and the Patch Bridge. Current
8080
coverage: none beyond `unsafe_blocks` (too blunt).
8181

82-
* [ ] Detect weak-hash-for-security patterns (MD5/SHA1 in security contexts)
83-
* [ ] Detect constant-time comparison violations (using `==` on secret values)
84-
* [ ] Detect key-reuse patterns across contexts
85-
* [ ] Detect nonce reuse in symmetric encryption
82+
* [x] Detect weak-hash-for-security patterns (MD5/SHA1 in security contexts) — PA022, Rust/Python/JS/Go/Elixir
83+
* [x] Detect constant-time comparison violations (using `==` on secret values) — PA022, Rust/Python
84+
* [ ] Detect key-reuse patterns across contexts (not reliably detectable statically — deferred)
85+
* [ ] Detect nonce reuse in symmetric encryption (not reliably detectable statically — deferred)
8686
* [ ] Detect missing signature verification before use
8787

8888
=== `proof_drift` — Formal verification drift

0 commit comments

Comments
 (0)