fix(v3.2.0): repair broken JSON API, add media sync endpoint, close open redirect - #500
Open
JHNY5 wants to merge 1 commit into
Open
fix(v3.2.0): repair broken JSON API, add media sync endpoint, close open redirect#500JHNY5 wants to merge 1 commit into
JHNY5 wants to merge 1 commit into
Conversation
JHNY5
marked this pull request as ready for review
August 14, 2026 00:16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Scope note
These fixes target the v3.2.0 release line (the currently published stable image). Upstream
masterhas since rewritten the API (moved to top-level routes), so several of these are already fixed by the rewrite — but the v3.2.0 tag has no branch, so this PR is opened against master for visibility and should be backported / cherry-picked onto the v3.2.0 release (or the release branch the maintainers use).Problems fixed (all verified live against the shipped v3.2.0 image)
GET /api/v1/songsreturns 500 — the collection endpoint has no route action and no template (onlyshowexists). Any client following the documented API cannot list the library. Addedindexroute + action +index.json.jbuilder.ErrorsControlleronly has HTML templates; a JSON request hitting an error path fails to rendererrors/not_foundas JSON and returns a broken 500. Added JSON responses so API consumers get structured{type, message}errors.POST /media_syncingis web-only (CSRF-bound); mobile/API clients cannot trigger a scan. AddedPOST /api/v1/media_syncing.redirect_back_with_referer_paramsredirects to anyreferer_urlparam value; an on-page link withreferer_url=https://evil.comcan silently drop users onto an attacker domain. Now validates host (same-host or relative only).Verification
All changes were live-tested against a patched v3.2.0 instance: songs index returns 200 JSON, media sync returns 202, errors return structured JSON (404 not 500), redirect stays on same host.