Skip to content

Commit

Permalink
repo: milestone: make /milestone/:id endpoint accessible
Browse files Browse the repository at this point in the history
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 go-gitea#10312, go-gitea#11233
  • Loading branch information
kevans91 committed May 1, 2020
1 parent 1bdffef commit eaa7890
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions routers/routes/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,14 @@ func RegisterRoutes(m *macaron.Macaron) {

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

// Grouping for those endpoints not requiring authentication
m.Group("/:username/:reponame", func() {
m.Group("/milestone", func() {
m.Get("/:id", repo.MilestoneIssuesAndPulls)
}, reqRepoIssuesOrPullsReader, context.RepoRef())
}, context.RepoAssignment(), context.UnitTypes())

// Grouping for those endpoints that do require authentication
m.Group("/:username/:reponame", func() {
m.Group("/issues", func() {
m.Combo("/new").Get(context.RepoRef(), repo.NewIssue).
Expand Down Expand Up @@ -761,9 +769,6 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Post("/:id/:action", repo.ChangeMilestonStatus)
m.Post("/delete", repo.DeleteMilestone)
}, context.RepoMustNotBeArchived(), reqRepoIssuesOrPullsWriter, context.RepoRef())
m.Group("/milestone", func() {
m.Get("/:id", repo.MilestoneIssuesAndPulls)
}, reqRepoIssuesOrPullsReader, context.RepoRef())
m.Combo("/compare/*", repo.MustBeNotEmpty, reqRepoCodeReader, repo.SetEditorconfigIfExists).
Get(repo.SetDiffViewStyle, repo.CompareDiff).
Post(context.RepoMustNotBeArchived(), reqRepoPullsReader, repo.MustAllowPulls, bindIgnErr(auth.CreateIssueForm{}), repo.CompareAndPullRequestPost)
Expand Down

0 comments on commit eaa7890

Please sign in to comment.