Commit 1f057ce
fix: bound three unbounded file reads (resolves self-scan Critical)
Self-scanning panic-attack with the latest release surfaced a Critical
UnboundedAllocation in attestation/mod.rs and, on closer inspection, two
sibling sites the analyzer's per-file heuristic glossed over. All three
follow the established pattern of every other read in the codebase
(File::open + .take(LIMIT) + .read_to_string) and were the residual
violations of the "every file read must be capacity-bounded" invariant.
Fixes:
1. src/attestation/mod.rs::verify_attestation_file — was reading the
attestation envelope with fs::read_to_string. JSON envelopes are
small (well under 1 MiB legitimately); capped at 16 MiB.
2. src/assemblyline.rs::load_cache_file — was reading the fingerprint
cache JSON with fs::read_to_string. Caches grow with estate size;
capped at 256 MiB (large enough for multi-thousand-repo rollups).
3. src/assail/mod.rs::load_user_classifications — was reading the
user-classification a2ml registry with fs::read_to_string. Hand-
edited audit files; capped at 4 MiB.
Verification:
- cargo build / clippy --all-targets --features signing,http -D warnings — clean
- cargo test --bin panic-attack --features signing,http — 236 passed, 0 failed
- cargo fmt --check — clean
- self-scan before: 12 findings (1 Critical UnboundedAllocation in attestation)
- self-scan after: 11 findings (Critical resolved; residual findings are
intentional — examples/vulnerable_program.rs unsafe blocks, test
unwraps, etc.)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent ea02d50 commit 1f057ce
3 files changed
Lines changed: 43 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
225 | 225 | | |
226 | 226 | | |
227 | 227 | | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
228 | 235 | | |
229 | 236 | | |
230 | | - | |
231 | | - | |
232 | | - | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
233 | 247 | | |
234 | 248 | | |
235 | 249 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
119 | 124 | | |
120 | | - | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
121 | 132 | | |
122 | 133 | | |
123 | 134 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
71 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
72 | 83 | | |
73 | 84 | | |
74 | 85 | | |
| |||
0 commit comments