enhance(repo): check full repo name for dangerous operations (#39213)

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
Mitrahsoft
2026-09-02 17:07:04 +00:00
committed by GitHub
co-authored by wxiaoguang
parent f735df4dee
commit 8cf7330556
8 changed files with 67 additions and 70 deletions
+2 -2
View File
@@ -388,7 +388,7 @@ func testForkToEditFile(t *testing.T, session *TestSession, user, owner, repo, b
// Archive the repository
req := NewRequestWithValues(t, "POST", "/"+path.Join(user, repo, "settings"),
map[string]string{
"repo_name": repo,
"repo_name": user + "/" + repo,
"action": "archive",
},
)
@@ -402,7 +402,7 @@ func testForkToEditFile(t *testing.T, session *TestSession, user, owner, repo, b
// Unfork the repository
req = NewRequestWithValues(t, "POST", "/"+path.Join(user, repo, "settings"),
map[string]string{
"repo_name": repo,
"repo_name": user + "/" + repo,
"action": "convert_fork",
},
)
+1 -1
View File
@@ -187,7 +187,7 @@ func testUIDeleteBranch(t *testing.T, session *TestSession, ownerName, repoName,
func testDeleteRepository(t *testing.T, session *TestSession, ownerName, repoName string) {
relURL := "/" + path.Join(ownerName, repoName, "settings")
req := NewRequestWithValues(t, "POST", relURL+"?action=delete", map[string]string{
"repo_name": repoName,
"repo_name": ownerName + "/" + repoName,
})
resp := session.MakeRequest(t, req, http.StatusOK)
assert.NotNil(t, test.ParseJSONRedirect(resp.Body.Bytes()).Redirect)