Security & hardening
Followed up v0.5.1 with a gosec audit pass. One HIGH-severity finding was real; the rest were false positives (taint analysis couldn't see input validation). Fixed the real issue and tightened two adjacent MEDIUM items.
Fixed
- Remote filesystem deletion via book update (HIGH).
PUT /api/v1/book/{id}previously accepted afilePathfield and wrote it to the book record unchecked. A caller could then triggerDELETE /api/v1/book/{id}?deleteFiles=true(orDELETE /api/v1/book/{id}/file) to runos.RemoveAllon that path — unbounded by the library dir. WhenBINDERY_API_KEYis unset (a warn-only configuration) this is unauthenticated.filePathis now omitted from the update schema; it remains internally-set by the importer after a successful grab. - Multipart upload error response.
/api/v1/migrate/csvand/api/v1/migrate/readarralready capped body size viahttp.MaxBytesReader, but passednilas the ResponseWriter, so oversize requests surfaced as a generic 400. They now passw, so oversize uploads receive a proper413 Request Entity Too Large.
Changed
- Backup directory (
<data>/backups) is now created with mode0700instead of0755. SQLite snapshots there may contain indexer/client credentials in plaintext rows; only the bindery process should read them. - Library and audiobook directories created by the importer are now
0750(was0755). Host users needing read access should run bindery with a matching UID/GID (standardPUID/PGIDpattern used by Readarr/Sonarr containers).