gogs / gogs/gogs

CVE-2026-25229: cross-repo authz checks on issue comments / deploy keys not backported to release/0.13

Open
#8,240 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
47.8k
Forks
5.1k
Avg merge
7h 23m
Merged PRs (30d)
5

Description

CVE-2026-25229 (gogs "repo: improve authz for resources", upstream commit 643a6d6353cb6a182a4e1f0720228727f30a3ad2) adds repo-scope checks that prevent IDOR-style access when a comment/deploy-key id from another repository is supplied to handlers that only authorize by user-vs-poster. The release/0.13 branch is missing all of these checks.

Concrete gaps on release/0.13:

internal/route/api/v1/repo/issue_comment.go
  EditIssueComment   — no `issue.RepoID != c.Repo.Repository.ID` guard
  DeleteIssueComment — same

internal/route/api/v1/repo/key.go
  GetDeployKey       — no `key.RepoID != c.Repo.Repository.ID` guard
  DeleteDeploykey    — fetched-by-id without guard, then DeleteDeployKey

internal/route/repo/issue.go
  UpdateCommentContent — no RepoID check
  DeleteComment        — same

Upstream wraps each of those with:

issue, err := database.GetIssueByID(comment.IssueID)
if err != nil { c.NotFoundOrError(err, "get issue by ID"); return }
if issue.RepoID != c.Repo.Repository.ID { c.NotFound(); return }

(or the equivalent key.RepoID guard for the deploy-key handlers).

Without these guards a user with admin rights on repo A can edit/delete comments belonging to repo B by passing a comment id from repo B, and the deploy-key endpoints leak/delete keys across repos.

Would the maintainers consider cherry-picking 643a6d6 to release/0.13? Note the downstream uses the db. import alias rather than database., so the diff needs minor renaming.

— vulgraph

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Compare release/0.13 with upstream commit 643a6d6353cb6a182a4e1f0720228727f30a3ad2, starting in internal/route/api/v1/repo/issue_comment.go, internal/route/api/v1/repo/key.go, and internal/route/repo/issue.go. Confirm the listed handlers reject resources whose issue or key RepoID differs from the current repository, handling lookup errors and preserving the downstream db. alias.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, authorization, backend, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.