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
+5 -5
View File
@@ -790,7 +790,7 @@ func handleSettingsPostConvert(ctx *context.Context) {
form := web.GetForm[*forms.RepoSettingForm](ctx)
repo := ctx.Repo.Repository
if repo.Name != form.RepoName {
if repo.FullName() != form.RepoName {
ctx.JSONError(ctx.Tr("form.enterred_invalid_repo_name"))
return
}
@@ -824,7 +824,7 @@ func handleSettingsPostConvertFork(ctx *context.Context) {
ctx.ServerError("Convert Fork", err)
return
}
if repo.Name != form.RepoName {
if repo.FullName() != form.RepoName {
ctx.JSONError(ctx.Tr("form.enterred_invalid_repo_name"))
return
}
@@ -860,7 +860,7 @@ func handleSettingsPostTransfer(ctx *context.Context) {
form := web.GetForm[*forms.RepoSettingForm](ctx)
repo := ctx.Repo.Repository
if repo.Name != form.RepoName {
if repo.FullName() != form.RepoName {
ctx.JSONError(ctx.Tr("form.enterred_invalid_repo_name"))
return
}
@@ -951,7 +951,7 @@ func handleSettingsPostDelete(ctx *context.Context) {
form := web.GetForm[*forms.RepoSettingForm](ctx)
repo := ctx.Repo.Repository
if repo.Name != form.RepoName {
if repo.FullName() != form.RepoName {
ctx.JSONError(ctx.Tr("form.enterred_invalid_repo_name"))
return
}
@@ -977,7 +977,7 @@ func handleSettingsPostDeleteWiki(ctx *context.Context) {
}
form := web.GetForm[*forms.RepoSettingForm](ctx)
repo := ctx.Repo.Repository
if repo.Name != form.RepoName {
if repo.FullName() != form.RepoName {
ctx.JSONError(ctx.Tr("form.enterred_invalid_repo_name"))
return
}