From 0d946be8be140a9614afd525f08faed1625908d6 Mon Sep 17 00:00:00 2001 From: Giteabot Date: Sat, 22 Aug 2026 03:26:37 -0700 Subject: [PATCH] fix(repo): limit gitignore template selections (#39027) (#39040) Backport #39027 by @bircni Bound gitignore template selections at both web and API request boundaries before repository initialization. Co-authored-by: bircni Co-authored-by: wxiaoguang --- modules/structs/repo.go | 2 +- services/forms/repo_form.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/structs/repo.go b/modules/structs/repo.go index eca1b15b026..63e244cd98b 100644 --- a/modules/structs/repo.go +++ b/modules/structs/repo.go @@ -154,7 +154,7 @@ type CreateRepoOption struct { // Whether the repository is template Template bool `json:"template"` // Gitignores to use - Gitignores string `json:"gitignores"` + Gitignores string `json:"gitignores" binding:"MaxSize(1024)"` // License to use License string `json:"license" binding:"MaxSize(100)"` // Readme of the repository to create diff --git a/services/forms/repo_form.go b/services/forms/repo_form.go index 5b65369dd68..c268e223282 100644 --- a/services/forms/repo_form.go +++ b/services/forms/repo_form.go @@ -28,7 +28,7 @@ type CreateRepoForm struct { Description string `binding:"MaxSize(2048)"` DefaultBranch string `binding:"GitRefName;MaxSize(100)"` AutoInit bool - Gitignores string + Gitignores string `binding:"MaxSize(1024)"` IssueLabels string `binding:"MaxSize(255)"` License string `binding:"MaxSize(100)"` Readme string `binding:"MaxSize(255)"`