fix: require code permissions for branch feed
- The RSS and atom feed for branches exposes details about the code, it therefore should be guarded by the requirement that the doer has access to the code of that repository. - Added integration testing.
This commit is contained in:
parent
7067cc7da4
commit
3e3ef76808
6 changed files with 150 additions and 2 deletions
|
@ -109,4 +109,24 @@ func TestFeed(t *testing.T) {
|
|||
})
|
||||
})
|
||||
})
|
||||
|
||||
t.Run("View permission", func(t *testing.T) {
|
||||
t.Run("Anomynous", func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
req := NewRequest(t, "GET", "/org3/repo3/rss/branch/master")
|
||||
MakeRequest(t, req, http.StatusNotFound)
|
||||
})
|
||||
t.Run("No code permission", func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
session := loginUser(t, "user8")
|
||||
req := NewRequest(t, "GET", "/org3/repo3/rss/branch/master")
|
||||
session.MakeRequest(t, req, http.StatusNotFound)
|
||||
})
|
||||
t.Run("With code permission", func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
session := loginUser(t, "user9")
|
||||
req := NewRequest(t, "GET", "/org3/repo3/rss/branch/master")
|
||||
session.MakeRequest(t, req, http.StatusOK)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue