mirror of
https://github.com/go-vikunja/vikunja.git
synced 2026-08-29 07:46:00 -05:00
Huma's AutoPatch implements PATCH as an internal GET + PUT re-dispatched through the router, so both legs re-enter the API token middleware. Scoping the GET leg like a client request made every /api/v2 PATCH additionally demand the resource's read_one permission, so a token scoped to tasks: update could never patch a task. Mark the re-dispatched requests with the route the client request was matched against, and skip the scope check only for a GET leg that carries no query string and resolves to that exact route. Anything looser is exploitable: echo routes on the raw path while autopatch re-dispatches the decoded one, so an encoded slash steers the unchecked leg onto a deeper route and an encoded question mark smuggles a query onto it. Fixes #3528