Skip to content

Commit 1cc029c

Browse files
committed
repo: milestone: make /milestone/:id endpoint accessible (go-gitea#11264)
Previously, this required authentication, but there's not actually any privileged information on this page. Move the endpoint out of the group that requires sign-in. It still requires the ability to read issues and pull requests, so private repositories (for instance) will not be exposed. Fixes go-gitea#10312 Fixes go-gitea#11233
1 parent 4a6765f commit 1cc029c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

routers/routes/routes.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,14 @@ func RegisterRoutes(m *macaron.Macaron) {
668668

669669
m.Post("/:username/:reponame/action/:action", reqSignIn, context.RepoAssignment(), context.UnitTypes(), repo.Action)
670670

671+
// Grouping for those endpoints not requiring authentication
672+
m.Group("/:username/:reponame", func() {
673+
m.Group("/milestone", func() {
674+
m.Get("/:id", repo.MilestoneIssuesAndPulls)
675+
}, reqRepoIssuesOrPullsReader, context.RepoRef())
676+
}, context.RepoAssignment(), context.UnitTypes())
677+
678+
// Grouping for those endpoints that do require authentication
671679
m.Group("/:username/:reponame", func() {
672680
m.Group("/issues", func() {
673681
m.Combo("/new").Get(context.RepoRef(), repo.NewIssue).
@@ -723,9 +731,6 @@ func RegisterRoutes(m *macaron.Macaron) {
723731
m.Post("/:id/:action", repo.ChangeMilestonStatus)
724732
m.Post("/delete", repo.DeleteMilestone)
725733
}, context.RepoMustNotBeArchived(), reqRepoIssuesOrPullsWriter, context.RepoRef())
726-
m.Group("/milestone", func() {
727-
m.Get("/:id", repo.MilestoneIssuesAndPulls)
728-
}, reqRepoIssuesOrPullsReader, context.RepoRef())
729734
m.Combo("/compare/*", repo.MustBeNotEmpty, reqRepoCodeReader, repo.SetEditorconfigIfExists).
730735
Get(repo.SetDiffViewStyle, repo.CompareDiff).
731736
Post(context.RepoMustNotBeArchived(), reqRepoPullsReader, repo.MustAllowPulls, bindIgnErr(auth.CreateIssueForm{}), repo.CompareAndPullRequestPost)

0 commit comments

Comments
 (0)