You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Browse filesBrowse the repository at this point in the historyBrowse files
authored and
Mathieu Fenniak
committed
fix(security): prevent unauthorized access to draft release attachments (#13934)
The `GetReleaseAttachment` API endpoint (`GET /repos/{owner}/{repo}/releases/{id}/assets/{attachment_id}`) and the web attachment download route (`ServeAttachment`, `GET /attachments/{uuid}`) did not check whether the release is a draft. Users holding only repository **read** permission (including unauthenticated callers on public repositories) could enumerate release/attachment IDs and retrieve the metadata and the full contents of attachments belonging to draft releases that are otherwise hidden from them.
`GetRelease` and `ListReleaseAttachments` already return 404 for draft releases when the caller lacks write permission on the releases unit (added in the 2026-06-10 security patches), but these two endpoints were missed. This is the same class of issue fixed by Gitea in [CVE-2026-27660](https://nvd.nist.gov/vuln/detail/CVE-2026-27660) and [GHSA-q9pg-jj6x-j9p6](GHSA-q9pg-jj6x-j9p6).
Co-authored-by: trim21 <i@trim21.me>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13934
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org>
Users with only read permission on a repository (including unauthenticated callers on public repositories) could retrieve the metadata and the full contents of attachments belonging to draft releases, even though draft releases are hidden from them. The `GetReleaseAttachment` API endpoint and the web attachment download route (`ServeAttachment`) did not check whether the release is a draft, while `GetRelease` and `ListReleaseAttachments` already do. This is the same class of issue fixed upstream by Gitea in CVE-2026-27660 and GHSA-q9pg-jj6x-j9p6.
0 commit comments