mirror of
https://github.com/go-gitea/gitea.git
synced 2026-11-16 16:11:06 +00:00
Backport https://github.com/go-gitea/gitea/pull/40192 The repository issue search JSON route sits behind the issues reader check only, and the milestone page is open to anyone who can read either issues or pull requests, since the issue routes have to tolerate pull request permissions. Neither handler narrows the issue type to what the viewer may read: the search route takes `type=pulls` straight from the query or lists both types when it is absent, and the milestone page always lists both. A team member granted only the Issues unit on a private repository can therefore fetch every pull request's title and body as JSON and see pull requests on milestone pages, while a pull-requests-only reader sees issues there. I noticed it while comparing these routes with the API `ListIssues` handler and the web issue suggestions endpoint, which both already narrow the type. The narrowing now lives in one small helper used by all three handlers, with the search route answering 404 for a requested type the viewer cannot read, like the API does. A unit test covers both handlers with an issues-only permission. Co-authored-by: Basavaraj S m <basavaraj@digiscrypt.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>