mirror of
https://github.com/go-gitea/gitea.git
synced 2026-09-08 14:03:24 +09:00
enhance(repo): check full repo name for dangerous operations (#39213)
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user