Commit ee5f6e2
fix(scripts): use mktemp for temp paths (closes 3 panic-attack path-traversal findings) (#185)
## Summary
Three scripts wrote to or read from hard-coded `/tmp/*` paths —
panic-attack flags as path-traversal / TOCTOU low (any local user on a
shared CI or workstation can race the file between write and read, or
pre-create a symlink to clobber the target).
- `scripts/balance_corpus.sh` — write listing to `$(mktemp)` + trap rm
- `scripts/balance_corpus_fast.sh` — write listing to `$(mktemp)` + trap
rm
- `scripts/gen-provers-a2ml.sh` — accept variant-list path as `$1` (was
hard-coded `/tmp/provers-list.txt`); callers should pass `$(mktemp)` or
any path they control. Adds usage banner + early-exit on
missing/unreadable arg.
## Test plan
- [x] `bash -n` syntax-check passes on all three scripts
- [x] `gen-provers-a2ml.sh` against a populated `$(mktemp)` emits the
expected `[prover.<Variant>]` blocks with snake_case slugs and correct
`count = N` header
- [x] empty-arg invocation prints usage to stderr and exits 2 instead of
silently producing `count = 0`
- [ ] CI green (rust-ci / governance / scans)
Does not touch in-flight PRs (#176/#178/#179/#182 — none of them edit
the scripts directory).
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 88cd8dc commit ee5f6e2
3 files changed
Lines changed: 30 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
29 | 33 | | |
30 | 34 | | |
31 | | - | |
| 35 | + | |
32 | 36 | | |
33 | 37 | | |
34 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
29 | 33 | | |
30 | 34 | | |
31 | | - | |
| 35 | + | |
32 | 36 | | |
33 | 37 | | |
34 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
4 | 11 | | |
5 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
6 | 20 | | |
7 | 21 | | |
8 | 22 | | |
| |||
28 | 42 | | |
29 | 43 | | |
30 | 44 | | |
31 | | - | |
| 45 | + | |
32 | 46 | | |
33 | 47 | | |
34 | 48 | | |
| |||
38 | 52 | | |
39 | 53 | | |
40 | 54 | | |
41 | | - | |
| 55 | + | |
0 commit comments