feat(subsonic): auth + envelope + ping.view + getLicense.view (Fable #294) #7
Reference in New Issue
Block a user
Delete Branch "dev"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Foundation of the
/rest/*Subsonic-compatible surface. Covers Fable task #294.Architecture — hybrid auth posture:
/api/*surface gets modern auth (apiKey bearer + OIDC later)./rest/*ships Subsonic-compatible auth for third-party clients (Symfonium, Substreamer, DSub, Tempo, play:Sub).u+t+stoken auth is per-user opt-in via a newusers.subsonic_passwordcolumn. Plaintextp=is disabled by default and gated bySMARTMUSIC_SUBSONIC_ALLOW_PLAINTEXT_PASSWORD.subsonic_passwordis a separate column: bcryptpassword_hashisn't reversible, but Subsonic'st = md5(password + salt)needs the plaintext. Storing it separately, opt-in, means the default posture is secure and legacy clients can still be supported without compromising the web-login password.Endpoints:
/rest/ping(.view)— envelope-only ok./rest/getLicense(.view)— always-valid license (required by many clients before streaming).Envelope:
{"subsonic-response": {…}}, XML withxmlns=http://subsonic.org/restapi, JSONP wrapped incallback(…)(falls back to plain JSON if callback is empty)./rest/nameand/rest/name.view, GET + POST.Docs:
config.example.yamlrefreshed to includeauth.admin_bootstrap,library, andsubsonicsections (first two were stale from #292/#293).Verification
go test ./...— green, including integration tests against ephemeral Postgres (migration 0003 applies clean).go build ./.../go vet ./.../gofmt -l .— clean.cmd/minstrel:/healthz→ 200 ok/rest/ping.viewno creds → error code 10u+t+s(correct) → oku+t+s(wrong) → error 40apiKey→ okgetLicense.view?apiKey=…→license.valid=truep=with plaintext disabled → error 41p=hunter2with plaintext enabled → okp=enc:68756e74657232(hex) with plaintext enabled → okTest plan
decodePasswordenc/plain/bad-hext = md5(password + salt)🤖 Generated with Claude Code