From a1b1a63549c4dc9b1da31378e677fa9ca1574ed3 Mon Sep 17 00:00:00 2001 From: forgejo-backport-action Date: Fri, 19 Sep 2025 23:20:03 +0200 Subject: [PATCH] [v11.0/forgejo] fix: do not display the title of unsubscribed issues or pull requests in the notification web page (#9363) **Backport:** https://codeberg.org/forgejo/forgejo/pulls/9362 Do not display the title of unsubscribed issues or pull requests in the notification web page . The title of some random issues or pull requests from repositories were accidentally displayed in the notifications of a user. It was a rare occurrence, caused by an incorrect comparison of two unrelated unique identifiers that are unlikely to match (the id of the notification and the id of a repository). If the issue or the pull request belonged to a private repository to which the user had no read access, only the title was leaked. The user was denied permission to view the issue or the pull request when clicking on the link displayed in the notifications web page. ## Checklist The [contributor guide](https://forgejo.org/docs/next/contributor/) contains information that will be helpful to first time contributors. There also are a few [conditions for merging Pull Requests in Forgejo repositories](https://codeberg.org/forgejo/governance/src/branch/main/PullRequestsAgreement.md). You are also welcome to join the [Forgejo development chatroom](https://matrix.to/#/#forgejo-development:matrix.org). ### Tests - I added test coverage for Go changes... - [x] in their respective `*_test.go` for unit tests. - [ ] in the `tests/integration` directory if it involves interactions with a live Forgejo server. - I added test coverage for JavaScript changes... - [ ] in `web_src/js/*.test.js` if it can be unit tested. - [ ] in `tests/e2e/*.test.e2e.js` if it requires interactions with a live Forgejo server (see also the [developer guide for JavaScript testing](https://codeberg.org/forgejo/forgejo/src/branch/forgejo/tests/e2e/README.md#end-to-end-tests)). ### Documentation - [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change. - [x] I did not document these changes and I do not expect someone else to do it. ### Release notes - [ ] I do not want this change to show in the release notes. - [ ] I want the title to show in the release notes with a link to this pull request. - [x] I want the content of the `release-notes/.md` to be be used for the release notes instead of the title. ## Release notes - Security bug fixes - [PR](https://codeberg.org/forgejo/forgejo/pulls/9362): Do not display the title of unsubscribed issues or pull requests in the notification web page . The title of some random issues or pull requests from repositories were accidentally displayed in the notifications of a user. It was a rare occurrence, caused by an incorrect comparison of two unrelated unique identifiers that are unlikely to match (the id of the notification and the id of a repository). If the issue or the pull request belonged to a private repository to which the user had no read access, only the title was leaked. The user was denied permission to view the issue or the pull request when clicking on the link displayed in the notifications web page. Co-authored-by: Earl Warren Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/9363 Reviewed-by: Earl Warren Co-authored-by: forgejo-backport-action Co-committed-by: forgejo-backport-action --- models/issues/issue_search.go | 2 +- models/issues/issue_test.go | 24 ++++++++++++++++++++++++ release-notes/9362.md | 1 + 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 release-notes/9362.md diff --git a/models/issues/issue_search.go b/models/issues/issue_search.go index bf4b89ee0b..386d521424 100644 --- a/models/issues/issue_search.go +++ b/models/issues/issue_search.go @@ -453,7 +453,7 @@ func applySubscribedCondition(sess *xorm.Session, subscriberID int64) { ), builder.Eq{"issue.poster_id": subscriberID}, builder.In("issue.repo_id", builder. - Select("id"). + Select("repo_id"). From("watch"). Where(builder.And(builder.Eq{"user_id": subscriberID}, builder.In("mode", repo_model.WatchModeNormal, repo_model.WatchModeAuto))), diff --git a/models/issues/issue_test.go b/models/issues/issue_test.go index afca27dfcf..494098b2d2 100644 --- a/models/issues/issue_test.go +++ b/models/issues/issue_test.go @@ -211,6 +211,30 @@ func TestIssues(t *testing.T) { }, []int64{2}, }, + { + issues_model.IssuesOptions{ + SubscriberID: 11, + }, + []int64{11, 5, 9, 8, 3, 2, 1}, + }, + { + issues_model.IssuesOptions{ + SubscriberID: 4, + }, + []int64{11, 5, 7, 4, 3, 2, 1}, + }, + { + issues_model.IssuesOptions{ + SubscriberID: 1, + }, + []int64{11, 6, 5, 3, 2, 1}, + }, + { + issues_model.IssuesOptions{ + SubscriberID: 8, + }, + []int64{}, + }, } { issues, err := issues_model.Issues(db.DefaultContext, &test.Opts) require.NoError(t, err) diff --git a/release-notes/9362.md b/release-notes/9362.md new file mode 100644 index 0000000000..f72f2eba10 --- /dev/null +++ b/release-notes/9362.md @@ -0,0 +1 @@ +Do not display the title of unsubscribed issues or pull requests in the notification web page . The title of some random issues or pull requests from repositories were accidentally displayed in the notifications of a user. It was a rare occurrence, caused by an incorrect comparison of two unrelated unique identifiers that are unlikely to match (the id of the notification and the id of a repository). If the issue or the pull request belonged to a private repository to which the user had no read access, only the title was leaked. The user was denied permission to view the issue or the pull request when clicking on the link displayed in the notifications web page.