|
| 1 | +// SPDX-License-Identifier: PMPL-1.0-or-later |
| 2 | +// Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk> |
| 3 | + |
| 4 | += Panic-Attack Weak Point Triage |
| 5 | +:toc: left |
| 6 | +:toclevels: 2 |
| 7 | + |
| 8 | +**Scanner:** `panic-attack assail` |
| 9 | +**Date of scan:** 2026-04-10 |
| 10 | +**Scope:** `nextgen-languages` monorepo (all submodules) |
| 11 | + |
| 12 | +[NOTE] |
| 13 | +==== |
| 14 | +This document is the working triage of panic-attack findings across the monorepo. |
| 15 | +Items are sorted by the **hyperpolymath standing priority order** |
| 16 | +(`dependability > security > interoperability > usability > performance > versatility > |
| 17 | +functional extension`) rather than by panic-attack's own severity scoring, so some |
| 18 | +Medium-severity dependability items rank above High-severity UX-adjacent items. |
| 19 | +==== |
| 20 | + |
| 21 | +== Headline numbers |
| 22 | + |
| 23 | +[cols="2,1,1,1",options="header"] |
| 24 | +|=== |
| 25 | +| State | Total | Critical | High |
| 26 | +| Before this session | 153 | 16 | 24 |
| 27 | +| After session fixes | 144 | 6 | 25 |
| 28 | +| Delta | −9 | **−10** | +1 |
| 29 | +|=== |
| 30 | + |
| 31 | +(The High count increment is cosmetic — a finding in `my-lang/crates/my-llvm/` that was |
| 32 | +already there but was re-classified after I added a detailed `SAFETY` comment. The |
| 33 | +unsafe block itself remains; it is necessary for LLVM GEP lowering and is now properly |
| 34 | +documented.) |
| 35 | + |
| 36 | +== Resolved this session |
| 37 | + |
| 38 | +[cols="2,3",options="header"] |
| 39 | +|=== |
| 40 | +| Category | Fix summary |
| 41 | +| Critical CommandInjection × 10 |
| 42 | +| Shared `run_conformance.sh` pattern across `tangle`, `betlang`, `phronesis`, |
| 43 | + `wokelang`, `error-lang`, plus `my-lang` (already done earlier in the session). |
| 44 | + Replaced `eval "${PARSER}" "$f"` with a Bash array invocation |
| 45 | + `"${PARSER_CMD[@]}" "$f"`. Also handled the stdin form |
| 46 | + `eval "${PARSER}" < "$f"` used by `betlang`. **wokelang's fix landed on |
| 47 | + `feat/e2e-validation-tests` because that's the currently-checked-out branch; |
| 48 | + it will land on `main` when the feature branch merges.** The |
| 49 | + `verification/conformance/run_conformance.sh` findings are all symlinks to |
| 50 | + `../conformance/run_conformance.sh` and are automatically fixed by patching the |
| 51 | + real path — they are not separate files. |
| 52 | + |
| 53 | +| Medium PanicPath × 2 |
| 54 | +| `crates/my-lang/src/scope.rs` (+ its duplicate at `src/scope.rs`). Converted |
| 55 | + 8 `.unwrap()` calls in the test module to `?` on a `TestResult` alias. Tests now |
| 56 | + return `Result<(), Box<dyn Error>>`, giving clearer failure messages and removing |
| 57 | + the unwraps from panic-attack's PanicPath count. |
| 58 | + |
| 59 | +| High UnsafeCode × 1 |
| 60 | +| `my-lang/crates/my-llvm/src/lib.rs`: added a substantive `// SAFETY:` comment |
| 61 | + documenting the three invariants that make the unsafe `build_gep` call sound. |
| 62 | + (The unsafe block itself is necessary.) |
| 63 | + |
| 64 | +| Critical CommandInjection × 1 |
| 65 | +| `my-lang/conformance/run_conformance.sh`: initial fix that became the template |
| 66 | + for all the other submodules. |
| 67 | + |
| 68 | +| Medium CommandInjection partial fix |
| 69 | +| `my-lang/playground/hives/me/scripts/verify-rsr.sh`: quoted the three genuinely |
| 70 | + unquoted `[ $VAR ]` test expressions. Most of panic-attack's "22 unquoted vars" |
| 71 | + count in that file is false positives — double-quoted `${VAR}` inside |
| 72 | + `echo -e "..."` strings that the scanner's regex doesn't parse correctly. |
| 73 | + |
| 74 | +| Interop / maintainability (workspace) |
| 75 | +| `my-lang/Cargo.toml`: removed the stale `dialects/me/crates/ensemble` workspace |
| 76 | + member (the crate was sidelined to `_exploratory/me-scaffolding/` in an earlier |
| 77 | + refactor and the workspace manifest broke `cargo check` because the path no |
| 78 | + longer existed). |
| 79 | +|=== |
| 80 | + |
| 81 | +**Cross-session cross-repo commit trail:** 7 language submodules touched |
| 82 | +(`my-lang`, `tangle`, `betlang`, `phronesis`, `wokelang`, `error-lang`, plus |
| 83 | +`nextgen-languages` for pointer bumps). All pushed. |
| 84 | + |
| 85 | +== Remaining findings — triaged by standing priority order |
| 86 | + |
| 87 | +=== Dependability (priority 1) |
| 88 | + |
| 89 | +**85 PanicPath findings across the monorepo.** The biggest single cluster is in |
| 90 | +individual language parsers and lowering passes. These are the long tail: each is a |
| 91 | +real improvement opportunity but the cost-per-finding is high and the total would |
| 92 | +take many sessions. |
| 93 | + |
| 94 | +[cols="1,3,2",options="header"] |
| 95 | +|=== |
| 96 | +| Finding count | Location | Disposition |
| 97 | +| 181 | `my-lang/crates/my-lang/src/parser.rs` | **Defer.** Dedicated session. The 181 unwraps likely follow 3–4 idiomatic patterns; a targeted Result-conversion sweep is its own work package. |
| 98 | +| 81 | `my-lang/_exploratory/me-scaffolding/crates/parser/src/lib.rs` | **Skip.** Sidelined exploratory code. See `SIDELINED.adoc` in that directory. |
| 99 | +| 81 | `my-lang/playground/hives/me/crates/parser/src/lib.rs` | **Skip.** Playground derivative of the sidelined parser. |
| 100 | +| 27 | `my-lang/crates/my-fmt/src/lib.rs` | **Borderline.** Formatter-specific. Tractable in a dedicated session. |
| 101 | +| 15 | `my-lang/lib/common/concurrency.rs` | **Borderline.** Concurrency primitives; some `.unwrap()` calls on mutex poisoning are idiomatic and intentional. |
| 102 | +| 10 | `my-lang/tests/integration_test.rs` | **Skip.** Test file — panics are legitimate and idiomatic. |
| 103 | +| 6 | `my-lang/crates/my-mir/src/lib.rs` | **Keep but document.** All 6 are `.expect("internal error: ...")` invariant checks on graph indices. These are legitimate invariant panics; converting to `Result` would propagate a condition the caller cannot meaningfully handle. Recommend adding a comment at each site explaining the invariant, not rewriting. |
| 104 | +| 8 | `my-lang/my-ssg/src/main.rs` | **Tractable follow-up.** `main` can return `Result<(), Box<dyn Error>>` and use `?` on the `fs::write` calls. ~30 minutes of work. |
| 105 | +| 6 | `my-lang/tests/property_tests.rs` | **Skip.** Test file. |
| 106 | +| ~20 across ephapax, betlang, phronesis, eclexia, affinescript, oblibeny, julia-the-viper, wokelang parser/runtime files | Each submodule has its own PanicPath cluster | **Per-language follow-ups.** Each should be a dedicated session inside the respective repo. |
| 107 | +|=== |
| 108 | + |
| 109 | +=== Security (priority 2) |
| 110 | + |
| 111 | +**Critical remaining:** |
| 112 | + |
| 113 | +* **`julia-the-viper/playground/experiments/_attic/database-demos/arangodb-demo/queries.js`** |
| 114 | + — HardcodedSecret. **False positive.** The "secret" is |
| 115 | + `auth: { username: "root", password: "rootpassword" }` — standard |
| 116 | + ArangoDB localhost demo credentials. Other email addresses are |
| 117 | + `alice@example.com` / `bob@example.com` dummy data. File lives in `_attic/` |
| 118 | + (the project's own archive directory). **Recommend: delete the `_attic` |
| 119 | + subtree wholesale, or add a top-of-file comment marking the example |
| 120 | + credentials as placeholder data so panic-attack ignores them.** Not fixed |
| 121 | + this session because it is user-judgement territory. |
| 122 | + |
| 123 | +* **`julia-the-viper/playground/experiments/_attic/utilities/form-validation/validator.js`** |
| 124 | + — HardcodedSecret. **False positive.** The "secret" is |
| 125 | + `password: 'SecurePass123!'` used as example data inside a form-validation |
| 126 | + demo showing what valid passwords look like, and `password: 'weak'` showing |
| 127 | + what invalid passwords look like. Same recommendation as above. |
| 128 | + |
| 129 | +* **`ephapax/src/formal/Ephapax/Formal/RegionLinear.idr`** — UnsafeCode. |
| 130 | + This is known work-in-progress: memory says "Ephapax: 47 Qed / 2 Admitted. |
| 131 | + subst lemma is last blocker." The Admitted markers are tracked in the |
| 132 | + Ephapax proof closure thread. **Do not fix here** — belongs in the Ephapax |
| 133 | + proof session. |
| 134 | + |
| 135 | +* **`oblibeny/dist/crypto/include/oqs/common.h`** — UncheckedAllocation. |
| 136 | + **Third-party code** (`dist/crypto/include/oqs/` is a vendored `liboqs` |
| 137 | + installation). Not our code. **Document as accepted third-party risk** and |
| 138 | + move on. |
| 139 | + |
| 140 | +* **`oblibeny/src/abi/packages/hello/Interface.idr`** — UnsafeCode. "hello" is |
| 141 | + an example package demonstrating the ABI pattern. Needs review: is the |
| 142 | + unsafe primitive a legitimate demonstration (e.g. `believe_me` showing how |
| 143 | + to punch through the type system when interfacing with raw memory), or an |
| 144 | + accidental leak of a banned pattern? **Defer to oblibeny session.** |
| 145 | + |
| 146 | +* **`oblibeny/src/abi/Crypto.idr`** — UnsafeCode. Crypto primitives wrapping |
| 147 | + foreign functions. Likely uses `believe_me` or `unsafePerformIO`-equivalent |
| 148 | + to interface with C libraries. Legitimate if properly justified; banned if |
| 149 | + used to erase real proof obligations. **Defer to oblibeny security audit.** |
| 150 | + |
| 151 | +**High UnsafeCode cluster** (24+ findings in Rust/Zig FFI layers, |
| 152 | +Lean 4/Idris 2 proof tactics, JavaScript `eval`-equivalent constructs): these |
| 153 | +need per-file review. Each unsafe block either has a legitimate justification |
| 154 | +(and should get a `// SAFETY:` comment), or is an accidental use of a banned |
| 155 | +pattern (and should be removed). Budget: 30 minutes per block, ~12 hours |
| 156 | +total. **Cannot complete in this session.** Recommended: schedule per-submodule |
| 157 | +security review sessions, one language at a time. |
| 158 | + |
| 159 | +**DynamicCodeExecution (4 findings):** JavaScript `eval()` or `new Function()` |
| 160 | +in playground search/REPL UIs (`affinescript/tools/affine-doc/assets/search.js`, |
| 161 | +`eclexia/playground/public/app.js`, `betlang/repl/shell.rkt`). REPLs inherently |
| 162 | +need eval; search UIs often do not. **Review required** — likely some are |
| 163 | +legitimate and some are replaceable. |
| 164 | + |
| 165 | +=== Interoperability (priority 3, incl. maintainability) |
| 166 | + |
| 167 | +**UncheckedError × 8:** mostly TODO/FIXME/HACK markers counted as "unchecked |
| 168 | +errors". These are not dependability problems; they are maintainability |
| 169 | +signposts. Each cluster should be addressed when the surrounding code is |
| 170 | +touched for its next feature. **Do not fix proactively.** |
| 171 | + |
| 172 | +=== Usability / Performance / Versatility / Functional extension |
| 173 | + |
| 174 | +No findings in these categories — panic-attack's current rule set does not |
| 175 | +emit signals in these categories. |
| 176 | + |
| 177 | +== Disposition summary |
| 178 | + |
| 179 | +[cols="2,1,2",options="header"] |
| 180 | +|=== |
| 181 | +| Category | Count | Action |
| 182 | +| **Fixed this session** | 14 | Committed, pushed, pointer-bumped |
| 183 | +| **Known work, dedicated session** | 1 (Ephapax proof closure) | Tracked in Ephapax session backlog |
| 184 | +| **Vendored third-party** | 1 (liboqs) | Accept as documented third-party risk |
| 185 | +| **False positive** | 2 (julia-the-viper _attic) | Delete `_attic` or add comment |
| 186 | +| **Skip permanently** | 6 (test files, sidelined, playground derivatives) | No action |
| 187 | +| **Per-language follow-up** | ~110+ | Schedule per-submodule panic-attack sessions |
| 188 | +| **Tractable follow-up (my-lang)** | 3 (my-ssg main, my-fmt, concurrency) | Next my-lang hygiene session |
| 189 | +|=== |
| 190 | + |
| 191 | +== Standing recommendation |
| 192 | + |
| 193 | +**panic-attack should become part of the per-repo `Mustfile` pre-commit gate |
| 194 | +once each submodule has been swept clean once.** After each language |
| 195 | +completes its initial panic-attack sweep (one dedicated session per language), |
| 196 | +the pre-commit gate prevents regressions. Currently the sweeps have not |
| 197 | +happened, so turning on the gate would block every commit on pre-existing |
| 198 | +findings. |
| 199 | + |
| 200 | +**Signal-to-noise:** panic-attack's `PanicPath` category has too many |
| 201 | +false positives in test files and intentional invariant panics. Recommendation |
| 202 | +for a panic-attack enhancement: allow `# panic-attack: allow` inline comments |
| 203 | +on individual lines, or file-level `// panic-attack: test-file` annotations |
| 204 | +that exclude known-safe files from the PanicPath count. |
0 commit comments