Skip to content

Commit df61372

Browse files
hyperpolymathclaude
andcommitted
feat(v2.5.0): proof_drift category — 49-language support, PA021
Add ProofDrift (PA021) weak point category detecting formal verification drift across all estate proof assistant languages: - Isabelle: sorry, oops, axiomatization - Coq/Rocq: Admitted, admit tactic, Axiom/Parameter, Obj.magic in extractions - Lean4: sorry (upgraded Critical, was High), unsafeNativeIO/unsafeBaseIO - Agda: trustMe/primTrustMe (upgraded Critical), TERMINATING pragma, postulate - Idris2: assert_total (High), %partial (Medium) — believe_me already ProofDrift - Julia mirrors: # sorry/# TODO: prove/# admitted comments; @test x isa Y patterns Language count 47 → 49 (Isabelle + Coq added with dedicated analyzers and dispatch arms). Category count 20 → 21. PatternCompleteness.idr updated to maintain completeness proof. PA021 wired into panicbot translator at 0.92 confidence, Control tier. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 476efd9 commit df61372

12 files changed

Lines changed: 434 additions & 43 deletions

File tree

.claude/CLAUDE.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ src/
2424
├── types.rs # Core types (AssailReport, WeakPoint, etc.)
2525
├── assail/ # Static analysis engine
2626
│ ├── mod.rs # Public API: analyze(), analyze_verbose()
27-
│ ├── analyzer.rs # 47-language analyzer with per-file detection
27+
│ ├── analyzer.rs # 49-language analyzer with per-file detection
2828
│ └── patterns.rs # Language-specific attack patterns
2929
├── kanren/ # miniKanren-inspired logic engine (v2.0.0)
3030
│ ├── mod.rs # Module entry, re-exports
@@ -88,8 +88,8 @@ cp target/release/panic-attack ~/.asdf/installs/rust/nightly/bin/
8888

8989
## Key Design Decisions
9090

91-
- **47 language analyzers**: Rust, C/C++, Go, Python, JavaScript, Ruby, Elixir, Erlang, Gleam, ReScript, OCaml, SML, Scheme, Racket, Haskell, PureScript, Idris, Lean, Agda, Prolog, Logtalk, Datalog, Zig, Ada, Odin, Nim, Pony, D, Nickel, Nix, Shell, Julia, Lua, + 12 nextgen DSLs
92-
- **20 weak point categories**: UnsafeCode, PanicPath, CommandInjection, UnsafeDeserialization, AtomExhaustion, UnsafeFFI, PathTraversal, HardcodedSecret, etc.
91+
- **49 language analyzers**: Rust, C/C++, Go, Python, JavaScript, Ruby, Elixir, Erlang, Gleam, ReScript, OCaml, SML, Scheme, Racket, Haskell, PureScript, Idris, Lean, Agda, Isabelle, Coq, Prolog, Logtalk, Datalog, Zig, Ada, Odin, Nim, Pony, D, Nickel, Nix, Shell, Julia, Lua, + 12 nextgen DSLs
92+
- **21 weak point categories**: UnsafeCode, PanicPath, CommandInjection, UnsafeDeserialization, AtomExhaustion, UnsafeFFI, PathTraversal, HardcodedSecret, ProofDrift, etc.
9393
- **Per-file language detection**: Each file analyzed with its own language-specific patterns. Skips `external_corpora/`, `third_party/`, and `corpus/` directories
9494
- **miniKanren logic engine**: Relational reasoning for taint analysis, cross-language vulnerability chains, and search strategy optimisation
9595
- **Latin-1 fallback**: Non-UTF-8 files handled gracefully

CHANGELOG.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,42 @@
11
# Changelog
22

3+
## [2.1.0] - 2026-04-12
4+
5+
### Added
6+
- **ProofDrift category (PA021)**: New weak point category detecting formal verification drift
7+
across all proof assistant languages. Catches banned proof escape hatches (`sorry`, `Admitted`,
8+
`believe_me`, `oops`, `trustMe`, `assert_total`, `%partial`, `{-# TERMINATING #-}`) and
9+
Julia mirror files substituting `@test x isa Y` or `# sorry` comments for formal proofs.
10+
Confidence 0.92 — proof escape hatches have essentially no false positives in their file types.
11+
- **Isabelle/HOL language support**: `.thy` files parsed with `analyze_isabelle()` detecting
12+
`sorry`, `oops`, and `axiomatization` as ProofDrift findings.
13+
- **Coq/Rocq language support**: `.v` files parsed with `analyze_coq()` detecting `Admitted`,
14+
`admit` tactic, `Axiom`/`Parameter` declarations, and `Obj.magic` in extraction artifacts.
15+
- **Isabelle + Coq dispatch**: Both new languages wired into `analyze_inner()` dispatch.
16+
- **Lean4 ProofDrift upgrade**: `sorry` upgraded from UnsafeCode → ProofDrift (Critical).
17+
Added `unsafeNativeIO`/`unsafeBaseIO` as ProofDrift (IO discipline bypass).
18+
- **Agda ProofDrift upgrade**: `trustMe`/`primTrustMe` upgraded to ProofDrift (Critical).
19+
Added `{-# TERMINATING #-}`, `{-# NON_TERMINATING #-}`, bare `postulate` as ProofDrift.
20+
- **Idris2 ProofDrift upgrade**: `believe_me` already ProofDrift; added `assert_total` (High)
21+
and `%partial` (Medium) as ProofDrift findings.
22+
- **Julia mirror detection**: `# sorry`, `# TODO: prove`, `# admitted` comments and
23+
`@test x isa Y` patterns (no value check) flagged as ProofDrift in Julia files.
24+
- **FP suppression wiring**: `apply_suppression()` now runs on every scan, marking
25+
weak points `suppressed: true` when logic engine finds defensive-pattern context.
26+
Suppressed items stay in report for audit transparency; filtered by panicbot and CI gates.
27+
- **PA021 → panicbot**: ProofDrift mapped to fleet category `static-analysis/proof-drift`
28+
with 0.92 confidence and Control tier.
29+
- **Idris2 ABI completeness**: `PatternCompleteness.idr` updated — Isabelle, Coq added to
30+
`Lang` enum; ProofDrift added to `WPCategory` with `detectorsFor` covering all new languages.
31+
- **Hypatia integration**: JSON AssailReport consumed by Hypatia Elixir rules. Logtalk
32+
export removed 2026-04-12.
33+
34+
### Changed
35+
- **Language count**: 47 → 49 (added Isabelle, Coq)
36+
- **Category count**: 20 → 21 (added ProofDrift)
37+
- **Verbose output**: Two views — filtered (active, what CI sees) and unfiltered (total,
38+
audit transparency) with explicit labelling of what each count means.
39+
340
## [2.0.0+] - 2026-03-23
441

542
### Fixed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ edition = "2021"
66
rust-version = "1.85.0"
77
authors = ["Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>"]
88
license-file = "LICENSE"
9-
description = "Universal static analysis, stress testing, and logic-based bug signature detection for 47 languages"
9+
description = "Universal static analysis, stress testing, and logic-based bug signature detection for 49 languages"
1010
repository = "https://github.com/hyperpolymath/panic-attack"
1111

1212
[dependencies]

EXPLAINME.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ The README makes claims. This file backs them up.
77

88
== Claims Substantiation
99

10-
=== Claim 1: "47-language static analysis across multiple families"
10+
=== Claim 1: "49-language static analysis across multiple families"
1111

1212
**How it works:** The `src/assail/analyzer.rs` module implements a per-file language detector that identifies file extension and shebang, dispatching to language-specific pattern matchers in `src/assail/patterns.rs`. Each language family (C/C++, Python, JavaScript, Rust, Go, etc.) has dedicated regex-based weak point detectors (unwrap, panic, unsafe blocks, expect, eval, hardcoded secrets). The analyzer processes 47 distinct language patterns without requiring external parsers—pattern-based shallow analysis enables fast scanning across heterogeneous codebases.
1313

@@ -43,7 +43,7 @@ The README makes claims. This file backs them up.
4343

4444
| `src/main.rs` | CLI entry: 20 subcommands (assail, assault, temporal, panll, groove, bridge, etc.)
4545
| `src/lib.rs` | Library API exposing all analysis engines
46-
| `src/assail/` | Static analysis (47 languages, 20 weak point categories)
46+
| `src/assail/` | Static analysis (49 languages, 21 weak point categories)
4747
| `src/assail/analyzer.rs` | Per-file language detection and pattern matching dispatcher
4848
| `src/assail/patterns.rs` | Language-specific regex patterns for weak points
4949
| `src/kanren/` | Logic engine (unification, fact database, taint, cross-lang)

ROADMAP.adoc

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
= panic-attack Roadmap
88

9-
_Static analysis and bug signature detection across 47 languages, used in 500+ repos._
9+
_Static analysis and bug signature detection across 49 languages, used in 500+ repos._
1010

1111
toc::[]
1212

@@ -18,7 +18,7 @@ binary, panicbot (gitbot-fleet CI integration), and mass-panic (org-scale batch
1818

1919
**Key capabilities today:**
2020

21-
* 47-language analyzer with per-file detection and 20 weak-point categories
21+
* 49-language analyzer with per-file detection and 21 weak-point categories
2222
* miniKanren v2.0.0 logic engine (taint analysis, cross-language reasoning, search strategies)
2323
* Patch Bridge CVE lifecycle engine (OSV API, reachability scan, phantom dependency detection)
2424
* Cryptographic attestation chain (intent/evidence/seal)
@@ -34,8 +34,9 @@ binary, panicbot (gitbot-fleet CI integration), and mass-panic (org-scale batch
3434
* [x] Search strategy: risk-weighted file prioritisation
3535
* [x] Forward chaining: derive new vulnerability facts from rules
3636
* [x] Backward queries: find files that could cause a vulnerability type
37-
* [ ] Context-facts for false-positive suppression (~10 rules, target ~8% -> ~2-3% FP rate)
38-
* [ ] Context-facts for Hypatia Elixir rules: export FactDB snapshot as JSON for direct consumption by Hypatia rule engine (replaces removed Logtalk export; Hypatia now consumes JSON AssailReport via Elixir rules)
37+
* [x] Context-facts for false-positive suppression (10 rules active, ~8% -> ~2-3% FP target; heuristics intentionally broad — tune v2.1.1)
38+
* [x] Hypatia integration: JSON AssailReport consumed by Elixir rules directly (Logtalk export removed 2026-04-12)
39+
* [x] Isabelle + Coq language support (49 languages total; `.thy` → Isabelle, `.v` → Coq)
3940

4041
== v2.2.0 -- VeriSimDB Integration
4142

@@ -90,10 +91,12 @@ The estate maintains Isabelle theories, Idris2 ABI definitions, and Lean4/Agda
9091
proofs alongside Julia/Rust mirrors. Nothing currently checks that the mirrors
9192
stay in sync with their formal counterparts.
9293

93-
* [ ] Detect `sorry` / `Admitted` / `believe_me` / `unsafeCoerce` / `Obj.magic` in formal files (`.thy`, `.idr`, `.lean`, `.agda`) — these are the estate's banned dangerous patterns
94-
* [ ] Detect `@assert` / `@test` standing in for a formally proven theorem in Julia mirror files
94+
* [x] Detect `sorry` / `Admitted` / `believe_me` / `oops` / `trustMe` in formal files (`.thy`, `.idr`, `.lean`, `.agda`, `.v`) — banned proof escape hatches (PA021)
95+
* [x] Detect `assert_total` / `%partial` in Idris2, `{-# TERMINATING #-}` / `postulate` in Agda, `axiomatization` in Isabelle, `Axiom`/`Parameter` in Coq — totality/axiom bypasses
96+
* [x] Detect `@test x isa Y` (no value check) standing in for a formally proven theorem in Julia mirror files
97+
* [x] Detect `# sorry` / `# TODO: prove` / `# admitted` comments in Julia mirror implementations
9598
* [ ] Flag Rust/Julia functions whose name matches an Isabelle definition but whose signature has drifted
96-
* [ ] Detect `# TODO: prove` / `-- sorry` comments in mirror implementations
99+
* [ ] Detect `Obj.magic` in Coq-extracted OCaml (upstream axiom bypass in extracted artifacts)
97100

98101
=== `input_boundary` — Structured-data parsing and deserialization
99102

src/abi/PatternCompleteness.idr

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module PanicAttack.ABI.PatternCompleteness
2121
-- Language enumeration (mirrors src/types.rs Language enum, 47 variants)
2222
-- ═══════════════════════════════════════════════════════════════════════
2323

24-
||| All 47 programming languages supported by the scanner.
24+
||| All 49 programming languages supported by the scanner.
2525
||| This MUST stay in sync with src/types.rs Language enum.
2626
public export
2727
data Lang
@@ -35,7 +35,7 @@ data Lang
3535
-- Functional
3636
| Haskell | PureScript
3737
-- Proof assistants
38-
| Idris | Lean | Agda
38+
| Idris | Lean | Agda | Isabelle | Coq
3939
-- Logic programming
4040
| Prolog | Logtalk | Datalog
4141
-- Systems languages
@@ -90,6 +90,8 @@ analyzerFor PureScript = SpecificAnalyzer
9090
analyzerFor Idris = SpecificAnalyzer
9191
analyzerFor Lean = SpecificAnalyzer
9292
analyzerFor Agda = SpecificAnalyzer
93+
analyzerFor Isabelle = SpecificAnalyzer
94+
analyzerFor Coq = SpecificAnalyzer
9395
analyzerFor Prolog = SpecificAnalyzer
9496
analyzerFor Logtalk = SpecificAnalyzer
9597
analyzerFor Datalog = SpecificAnalyzer
@@ -145,7 +147,7 @@ crossLangAlwaysApplied _ = MkCrossLangChecked
145147
-- WeakPointCategory enumeration (mirrors src/types.rs, 20 categories)
146148
-- ═══════════════════════════════════════════════════════════════════════
147149

148-
||| All 20 weak point categories detectable by the scanner.
150+
||| All 21 weak point categories detectable by the scanner.
149151
public export
150152
data WPCategory
151153
= UncheckedAllocation
@@ -168,6 +170,10 @@ data WPCategory
168170
| UncheckedError
169171
| InfiniteRecursion
170172
| UnsafeTypeCoercion
173+
||| Formal verification drift: banned proof escape hatches or mirror files
174+
||| substituting assertions for proofs. Detected in .idr, .lean, .agda,
175+
||| .thy, .v, and Julia mirror files.
176+
| ProofDrift
171177

172178
||| Witness that a detection rule exists for a weak point category.
173179
||| Each variant names the language(s) whose analyzer detects it.
@@ -177,7 +183,7 @@ data HasDetector : WPCategory -> Type where
177183
DetectedBy : (langs : List Lang) -> HasDetector cat
178184

179185
||| Every weak point category has at least one detector.
180-
||| Total: Idris2 verifies all 20 constructors are covered.
186+
||| Total: Idris2 verifies all 21 constructors are covered.
181187
||| The list of detecting languages mirrors the actual pattern
182188
||| matching code in analyzer.rs.
183189
public export
@@ -202,6 +208,7 @@ detectorsFor HardcodedSecret = DetectedBy [Rust, C, Cpp, Go, Python, JavaSc
202208
detectorsFor UncheckedError = DetectedBy [Go, Rust, C, Cpp]
203209
detectorsFor InfiniteRecursion = DetectedBy [Haskell, PureScript, Scheme, Racket]
204210
detectorsFor UnsafeTypeCoercion = DetectedBy [OCaml, Haskell, DLang, Nim]
211+
detectorsFor ProofDrift = DetectedBy [Idris, Lean, Agda, Isabelle, Coq, Julia]
205212

206213
||| Proof: every weak point category has at least one detector.
207214
public export

0 commit comments

Comments
 (0)