Commit 9398f13
fix(security): outbox path-injection — hash the envelope id for the filename (CodeQL)
CodeQL py/path-injection (HIGH) failed PR #1441 at app_outbox_store.py:55/60/63:
`envelope_id` arrives as a request path param (POST /internal/outbox/{id}/status) and
flowed into the outbox filesystem path. The old char-strip sanitizer was a silent strip
(and CodeQL didn't recognize it as a barrier).
Fix: derive the filename from sha256(envelope_id) — the tainted string never reaches the
path (a hex digest can't carry a separator), which both removes the injection surface and
is a CodeQL-recognized taint sanitizer. Dedupe is preserved (same id → same hash → same
file); list_pending reads the real id from file contents, so it's unaffected.
Test: a traversal-style id ("../../../etc/passwd") stays inside outbox/ and round-trips
by id. 16 outbox tests pass; black/flake8/mypy green.
(The Snyk-Debian base-image CVEs on the PR are pre-existing infra, not this branch — that
check passed; only CodeQL failed, on this finding.)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019FDfbEedtYuS9PiqFoCtgK1 parent bb0904d commit 9398f13
2 files changed
Lines changed: 21 additions & 3 deletions
File tree
- src/podcast_scraper/server
- tests/unit/podcast_scraper/server
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
48 | | - | |
49 | | - | |
50 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
51 | 56 | | |
52 | 57 | | |
53 | 58 | | |
| |||
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
0 commit comments