mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-02 14:29:43 +00:00
ab10e37acf
Backport #38318 by @bircni Draft-release access control was enforced only on the API release endpoints (`/api/v1/repos/{owner}/{repo}/releases/...`) but not on the UUID-based web attachment endpoints (`/attachments/{uuid}`, `/{owner}/{repo}/attachments/{uuid}`, `/{owner}/{repo}/releases/attachments/{uuid}`). Anyone who obtained an attachment UUID — including unauthenticated callers — could download files belonging to a hidden draft release, since `ServeAttachment` only checked repo-level read permission and never the release's draft state. This extends `ServeAttachment` to require write access to releases when the attachment belongs to a draft release, mirroring the existing API-side `canAccessReleaseDraft` gate. A regression test is included. Co-authored-by: bircni <bircni@icloud.com>