diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-20 14:11:35 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-20 14:11:35 +0300 |
| commit | 97b0a6e7f15cb094d4d2e87ef000e3579489a60c (patch) | |
| tree | 8750e6263aebf42ca67f9078c53f9755b6c3d17f /player-android | |
| parent | 560d8ac3efeccb4e667444dec822c2bd454cb587 (diff) | |
Validate AbsPath in streamer and clean up partial podcast downloads (l9+k9)
l9: Add mediaRoot field to mediaStreamer. NewMediaStreamer now takes a
mediaRoot string parameter; when non-empty, Open() rejects any path that
does not reside under that directory (filepath.Clean prefix check), returning
ErrForbidden to prevent filepath-traversal via a compromised AbsPath in the
DB. Production wiring passes cfg.MediaRoot; tests that don't exercise path
traversal pass "". Added TestMediaStreamerOpenRejectsPathOutsideRoot to
cover the rejection path.
k9: Add a defer-based cleanup guard in DownloadEpisode. After the enclosure
file is written, a succeeded flag gates a deferred closure that calls
dbCleanup() (undoes DB row + removes file) when persistDownloadedEpisode
succeeded, or removeAndLog(path) when it did not. This ensures that any
failure after the file is written — including UpdateEpisodeMedia — leaves no
orphaned files on disk. The guard is disarmed by setting succeeded=true on
the happy path.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Diffstat (limited to 'player-android')
0 files changed, 0 insertions, 0 deletions
