Skip to content

Commit eaa7890

Browse files
committed
repo: milestone: make /milestone/:id endpoint accessible
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 issue #10312, #11233
1 parent 1bdffef commit eaa7890

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
@@ -704,6 +704,14 @@ func RegisterRoutes(m *macaron.Macaron) {
704704

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

707+
// Grouping for those endpoints not requiring authentication
708+
m.Group("/:username/:reponame", func() {
709+
m.Group("/milestone", func() {
710+
m.Get("/:id", repo.MilestoneIssuesAndPulls)
711+
}, reqRepoIssuesOrPullsReader, context.RepoRef())
712+
}, context.RepoAssignment(), context.UnitTypes())
713+
714+
// Grouping for those endpoints that do require authentication
707715
m.Group("/:username/:reponame", func() {
708716
m.Group("/issues", func() {
709717
m.Combo("/new").Get(context.RepoRef(), repo.NewIssue).
@@ -761,9 +769,6 @@ func RegisterRoutes(m *macaron.Macaron) {
761769
m.Post("/:id/:action", repo.ChangeMilestonStatus)
762770
m.Post("/delete", repo.DeleteMilestone)
763771
}, context.RepoMustNotBeArchived(), reqRepoIssuesOrPullsWriter, context.RepoRef())
764-
m.Group("/milestone", func() {
765-
m.Get("/:id", repo.MilestoneIssuesAndPulls)
766-
}, reqRepoIssuesOrPullsReader, context.RepoRef())
767772
m.Combo("/compare/*", repo.MustBeNotEmpty, reqRepoCodeReader, repo.SetEditorconfigIfExists).
768773
Get(repo.SetDiffViewStyle, repo.CompareDiff).
769774
Post(context.RepoMustNotBeArchived(), reqRepoPullsReader, repo.MustAllowPulls, bindIgnErr(auth.CreateIssueForm{}), repo.CompareAndPullRequestPost)

0 commit comments

Comments
 (0)