]> source.dussan.org Git - gitea.git/commitdiff
Add write check for creating Commit status (#20332)
authorGusted <williamzijl7@hotmail.com>
Tue, 12 Jul 2022 12:51:06 +0000 (12:51 +0000)
committerGitHub <noreply@github.com>
Tue, 12 Jul 2022 12:51:06 +0000 (14:51 +0200)
- Add write code checks for creating new commit status
- Regression #5314

Co-authored-by: zeripath <art27@cantab.net>
routers/api/v1/api.go

index c93606ae88308afc708825575475125a59239ae0..44e0c290a0881badaa7b85fde7b9b11418d485c1 100644 (file)
@@ -1017,7 +1017,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)