summaryrefslogtreecommitdiffstats
path: root/integrations/api_releases_test.go
diff options
context:
space:
mode:
authorB-OnTheGo <42626718+beeonthego@users.noreply.github.com>2018-09-11 02:15:52 +1000
committertechknowlogick <techknowlogick@users.noreply.github.com>2018-09-10 12:15:52 -0400
commite47df0b301510a49b49fc43266f436b7d58a02b1 (patch)
treeacc014c8e82a3b75754c9969f078b25579a523e9 /integrations/api_releases_test.go
parent387a4b09c1b62a2a5eb70b89559d5ae53032c989 (diff)
downloadgitea-e47df0b301510a49b49fc43266f436b7d58a02b1.tar.gz
gitea-e47df0b301510a49b49fc43266f436b7d58a02b1.zip
Enforce token on api routes [fixed critical security issue #4357] (#4840)
Diffstat (limited to 'integrations/api_releases_test.go')
-rw-r--r--integrations/api_releases_test.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/integrations/api_releases_test.go b/integrations/api_releases_test.go
index 678075935c..c8bad51c09 100644
--- a/integrations/api_releases_test.go
+++ b/integrations/api_releases_test.go
@@ -22,7 +22,7 @@ func TestAPICreateRelease(t *testing.T) {
repo := models.AssertExistsAndLoadBean(t, &models.Repository{ID: 1}).(*models.Repository)
owner := models.AssertExistsAndLoadBean(t, &models.User{ID: repo.OwnerID}).(*models.User)
session := loginUser(t, owner.LowerName)
-
+ token := getTokenForLoggedInUser(t, session)
gitRepo, err := git.OpenRepository(repo.RepoPath())
assert.NoError(t, err)
@@ -32,8 +32,8 @@ func TestAPICreateRelease(t *testing.T) {
commitID, err := gitRepo.GetTagCommitID("v0.0.1")
assert.NoError(t, err)
- urlStr := fmt.Sprintf("/api/v1/repos/%s/%s/releases",
- owner.Name, repo.Name)
+ urlStr := fmt.Sprintf("/api/v1/repos/%s/%s/releases?token=%s",
+ owner.Name, repo.Name, token)
req := NewRequestWithJSON(t, "POST", urlStr, &api.CreateReleaseOption{
TagName: "v0.0.1",
Title: "v0.0.1",
@@ -53,8 +53,8 @@ func TestAPICreateRelease(t *testing.T) {
Note: newRelease.Note,
})
- urlStr = fmt.Sprintf("/api/v1/repos/%s/%s/releases/%d",
- owner.Name, repo.Name, newRelease.ID)
+ urlStr = fmt.Sprintf("/api/v1/repos/%s/%s/releases/%d?token=%s",
+ owner.Name, repo.Name, newRelease.ID, token)
req = NewRequest(t, "GET", urlStr)
resp = session.MakeRequest(t, req, http.StatusOK)