1
1
mirror of https://github.com/go-gitea/gitea synced 2025-11-03 12:58:29 +00:00

Refactor CSRF protector (#32057) (#32069)

#32057 improves the CSRF handling and is worth to backport
This commit is contained in:
wxiaoguang
2024-09-19 01:02:45 +08:00
committed by GitHub
parent 8dbe83d205
commit 2891edbbcb
7 changed files with 71 additions and 172 deletions

View File

@@ -59,7 +59,8 @@ func createAttachment(t *testing.T, session *TestSession, repoURL, filename stri
func TestCreateAnonymousAttachment(t *testing.T) {
defer tests.PrepareTestEnv(t)()
session := emptyTestSession(t)
createAttachment(t, session, "user2/repo1", "image.png", generateImg(), http.StatusSeeOther)
// this test is not right because it just doesn't pass the CSRF validation
createAttachment(t, session, "user2/repo1", "image.png", generateImg(), http.StatusBadRequest)
}
func TestCreateIssueAttachment(t *testing.T) {