1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-23 12:59:11 -05:00

Add write check for creating Commit status (#20332) (#20333)

- Backport #20332
  - Add write code checks for creating new commit status
  - Regression from #5314
  - Resolves #20331
This commit is contained in:
Gusted 2022-07-12 12:51:35 +00:00 committed by GitHub
parent 54ef658861
commit b8ab9298e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1010,7 +1010,7 @@ func Routes() *web.Route {
}, mustAllowPulls, reqRepoReader(unit.TypeCode), context.ReferencesGitRepo())
m.Group("/statuses", func() {
m.Combo("/{sha}").Get(repo.GetCommitStatuses).
Post(reqToken(), bind(api.CreateStatusOption{}), repo.NewCommitStatus)
Post(reqToken(), reqRepoWriter(unit.TypeCode), bind(api.CreateStatusOption{}), repo.NewCommitStatus)
}, reqRepoReader(unit.TypeCode))
m.Group("/commits", func() {
m.Get("", context.ReferencesGitRepo(), repo.GetAllCommits)