mirror of
https://github.com/go-gitea/gitea.git
synced 2025-12-05 00:34:09 +09:00
Fix various permission & login related bugs (#36002)
Permission & protection check:
- Fix Delete Release permission check
- Fix Update Pull Request with rebase branch protection check
- Fix Issue Dependency permission check
- Fix Delete Comment History ID check
Information leaking:
- Show unified message for non-existing user and invalid password
- Fix #35984
- Don't expose release draft to non-writer users.
- Make API returns signature's email address instead of the user
profile's.
Auth & Login:
- Avoid GCM OAuth2 attempt when OAuth2 is disabled
- Fix #35510
---------
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@@ -41,17 +41,6 @@ func TestAPIUserReposNotLogin(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestAPIUserReposWithWrongToken(t *testing.T) {
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2})
|
||||
wrongToken := "Bearer " + "wrong_token"
|
||||
req := NewRequestf(t, "GET", "/api/v1/users/%s/repos", user.Name).
|
||||
AddTokenAuth(wrongToken)
|
||||
resp := MakeRequest(t, req, http.StatusUnauthorized)
|
||||
|
||||
assert.Contains(t, resp.Body.String(), "user does not exist")
|
||||
}
|
||||
|
||||
func TestAPISearchRepo(t *testing.T) {
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
const keyword = "test"
|
||||
|
||||
Reference in New Issue
Block a user