summaryrefslogtreecommitdiffstats
path: root/integrations/api_issue_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_issue_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_issue_test.go')
-rw-r--r--integrations/api_issue_test.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/integrations/api_issue_test.go b/integrations/api_issue_test.go
index 74436ffe9e..97207f3368 100644
--- a/integrations/api_issue_test.go
+++ b/integrations/api_issue_test.go
@@ -22,8 +22,9 @@ func TestAPIListIssues(t *testing.T) {
owner := models.AssertExistsAndLoadBean(t, &models.User{ID: repo.OwnerID}).(*models.User)
session := loginUser(t, owner.Name)
- req := NewRequestf(t, "GET", "/api/v1/repos/%s/%s/issues?state=all",
- owner.Name, repo.Name)
+ token := getTokenForLoggedInUser(t, session)
+ req := NewRequestf(t, "GET", "/api/v1/repos/%s/%s/issues?state=all&token=%s",
+ owner.Name, repo.Name, token)
resp := session.MakeRequest(t, req, http.StatusOK)
var apiIssues []*api.Issue
DecodeJSON(t, resp, &apiIssues)
@@ -41,8 +42,8 @@ func TestAPICreateIssue(t *testing.T) {
owner := models.AssertExistsAndLoadBean(t, &models.User{ID: repo.OwnerID}).(*models.User)
session := loginUser(t, owner.Name)
-
- urlStr := fmt.Sprintf("/api/v1/repos/%s/%s/issues?state=all", owner.Name, repo.Name)
+ token := getTokenForLoggedInUser(t, session)
+ urlStr := fmt.Sprintf("/api/v1/repos/%s/%s/issues?state=all&token=%s", owner.Name, repo.Name, token)
req := NewRequestWithJSON(t, "POST", urlStr, &api.CreateIssueOption{
Body: body,
Title: title,