GITEA.DEV · CVE-2026-127958 · Package
FIX → 28.4.0
Gitea publishes a pending pull request review created through the REST API to everyone who can read the pull request, including anonymous visitors on public repositories. An attacker gets read access to draft review text and line comments the reviewer had not submitted, and the text also appears in activity feeds and RSS/Atom.
first public Nov 15, 2026 · 2 sources
Check it with your coding agent
It reads this page and tells you if your code or app is affected.
Self-hosted or hosted Gitea instances with public repositories where users start pull request reviews through the REST API using the PENDING or empty event. Instances that only use the web diff view for drafts are not affected, and private repositories are exposed only to users who can already read them.
Not affected if managed-hosting-patched, no-public-repos, web-diff-only-reviews
Who cares gitea, pull-requests, rest-api, self-hosted
gitea --version and compare it against the affected range >= 1.12, <= 28.3.0.GET /api/v1/repos/{owner}/{repo}/issues/{index}/timeline anonymously and look for entries of type review created by a PENDING review.GET /api/v1/repos/{owner}/{repo}/activities/feeds for comment_pull entries tied to unsubmitted reviews.A review that a reviewer starts through the REST API as a draft (POST /repos/{owner}/{repo}/pulls/{index}/reviews with "event": "PENDING" or with no event) is published immediately. Its body and line comments appear to everyone who can read the pull request, which on a public repository includes anonymous visitors. The reader cannot cause this and gains only read access to text the reviewer has not submitted. The disclosure happens whenever a reviewer uses the API's create-as-PENDING, submit-later flow, even if the draft is never submitted. Meanwhile Gitea tells the reviewer the review is PENDING and tells everyone else it does not exist.
CreatePullReview (routers/api/v1/repo/pull_review.go:563) maps PENDING, an empty event or an unknown event to ReviewTypePending and still sends the review through pull_service.SubmitReview. issues_model.SubmitReview (models/issues/review.go:549) then creates the timeline comment without checking the review type, although it checks for the pending type a few lines earlier. The service layer fires the review and code-comment notifications, and the feed notifier copies the draft text into activity entries and the repository's RSS/Atom feeds.
Are you affected?
Ask from here. InfraStack checks the affected versions against your stack and answers in your inbox.
InfraStack checks the affected versions against your stack and answers in Slack, with the evidence and the fix.
InfraStack checks it against your stack and answers on your report, with the evidence and the fix.
Upgrade to 28.4.0
28.4.0 (fixed version for the affected range listed in the sources).CommentTypeReviewcomment_pullThe reviews API and the diff view correctly hide the draft. However, the conversation page loads the linked review's code comments with a concrete review, which bypasses the pending filter in comment_code.go, and the issue timeline API returns the comment unfiltered. When the draft is later submitted, a second entry is added and the original draft text stays on the page. Deleting the draft does not remove the feed entries.
The attached reproducer runs a stock binary with default settings. A regular user with no rights on a public repository creates a PENDING review. An anonymous visitor then gets [] from the reviews API and no line comment in the diff view, but sees both the draft body and the line comment on the conversation page and the body in the timeline API. Drafts started in the web diff view are not affected. The behaviour dates from the introduction of the API review endpoints in c97494a4f4 (#11224), first released in v1.12.0-rc1.
Scanned commit 31626de2a6cdd3e1fe93216e4ac80f511297f1e7, default configuration. The reader who gains something is anyone able to view the pull request (an anonymous visitor on a public repository); the affected user is a reviewer who starts a review through the REST API.
The root cause is one missing check: issues_model.SubmitReview (models/issues/review.go:549) creates the public timeline comment, and pull_service.SubmitReview then fires the review notifications, for a review whose type stays ReviewTypePending. The API handler CreatePullReview is the only caller that passes that type. The draft then surfaces in several places that read timeline comments or notifications (conversation page, timeline API, activity feeds and RSS/Atom, notifications); they are all symptoms of that one write.
POST /api/v1/repos/{owner}/{repo}/pulls/{index}/reviews with "event": "PENDING" (or with no event) returns "state": "PENDING", and from that moment the review body and its line comments are shown to every reader of the pull request on /{owner}/{repo}/pulls/{index}, and the body is returned by GET /api/v1/repos/{owner}/{repo}/issues/{index}/timeline. At the same time GET .../pulls/{index}/reviews returns [] to those readers and the diff view /{owner}/{repo}/pulls/{index}/files does not show the line comment, because both treat the review as a draft that only its author may see.
On a fresh instance, with reviewer being a regular user without any rights on the public repository owner/project:
POST /api/v1/repos/owner/project/pulls/1/reviews (as reviewer)
{"event": "PENDING", "body": "DRAFT-REVIEW-BODY",
"comments": [{"path": "feature.txt", "new_position": 1, "body": "DRAFT-LINE-COMMENT"}]}
-> 200, "state": "PENDING"
GET /api/v1/repos/owner/project/pulls/1/reviews (anonymous) -> []
GET /owner/project/pulls/1/files (anonymous) -> no DRAFT-LINE-COMMENT
GET /owner/project/pulls/1 (anonymous) -> contains DRAFT-REVIEW-BODY and DRAFT-LINE-COMMENT
GET /api/v1/repos/owner/project/issues/1/timeline (anonymous) -> entry of type "review" with body DRAFT-REVIEW-BODY
The same happens for a pending review that has only line comments and no body, a request the API accepts since dcef88a233 ("fix(api): allow pending-inline-comment-only reviews (#39433)").
CreatePullReview maps PENDING, an empty and any unknown event to ReviewTypePending, stores the line comments as pending, and then sends every review, pending or not, through the submit path:
// routers/api/v1/repo/pull_review.go:704
default:
return issues_model.ReviewTypePending, false
…
// routers/api/v1/repo/pull_review.go:562
// create review and associate all pending review comments
review, _, err := pull_service.SubmitReview(ctx, ctx.Doer, ctx.Repo.GitRepo, pr.Issue, reviewType, opts.Body, opts.CommitID, nil)
issues_model.SubmitReview creates or updates the review row with the requested type and then, whatever that type is, adds the timeline comment that announces the review:
// models/issues/review.go:549
comm, err := CreateComment(ctx, &CreateCommentOptions{
Type: CommentTypeReview,
Doer: doer,
Content: review.Content,
…
ReviewID: review.ID,
The function does anticipate the pending type: a few lines earlier (models/issues/review.go:541) it tests reviewType != ReviewTypePending before clearing a leftover review request. The comment creation that follows has no such test.
Back in pull_service.SubmitReview (services/pull/review.go:338-354) the same comment is handed to notify_service.PullRequestReview and each line comment to notify_service.PullRequestCodeComment, as for a submitted review. The feed notifier (services/feed/notifier.go:207) turns these into comment_pull actions carrying the draft text, which is where the activity-feed and RSS/Atom entries come from.
So a pending review created this way owns a CommentTypeReview comment, and nothing that reads timeline comments looks at the type of the linked review:
The conversation page renders the content of every CommentTypeReview comment (routers/web/repo/issue_view.go:686) and then loads the linked review's line comments with comment.Review.LoadCodeComments(ctx) (routers/web/repo/issue_view.go:788). That goes to fetchCodeCommentsByReview(ctx, r.Issue, nil, r, false) (models/issues/review.go:162), i.e. with a concrete review, and the pending filter only applies when no review is given:
// models/issues/comment_code.go:107
// If the review is pending only the author can see the comments (except if the review is set)
if review.ID == 0 && re.Type == ReviewTypePending &&
(currentUser == nil || currentUser.ID != re.ReviewerID) {
continue
}
The template prints the entry like a submitted comment review (templates/repo/issue/view_content/comments.tmpl:386-392, type 0 falls into the else branch).
ListIssueCommentsAndTimeline returns every comment except CommentTypeCode (routers/api/v1/repo/issue_comment.go:203).
The places that do know about drafts hide this review: ToPullReviewList skips pending reviews of other users (services/convert/pull_review.go:69), prepareSingleReview answers 404 to other signed-in users (routers/api/v1/repo/pull_review.go:730), and the diff view loads comments through FetchCodeComments (models/issues/comment_code.go:22), which passes no review, so the filter above applies.
No other caller sends a pending review through SubmitReview. A draft started in the web diff view only calls pull_service.CreateCodeComment(..., !form.SingleReview, ...) (routers/web/repo/pull_review.go:90-101)
NVD data is provided by NIST and is public domain. Posts quoted belong to their authors.