From 08f9e5632da83aae9866f0805e8879fa7039c7b0 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 31 Oct 2026 14:38:24 -0700 Subject: Refuse pathspec magic through one helper --- source/ui-shared.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source/ui-shared.c') diff --git a/source/ui-shared.c b/source/ui-shared.c index cef57eb..fc4e559 100644 --- a/source/ui-shared.c +++ b/source/ui-shared.c @@ -1534,6 +1534,14 @@ int cgit_prepare_walk(struct rev_info *rev) return -1; } +int cgit_refuse_pathspec_magic(const char *path) +{ + if (!path || path[0] != ':') + return 0; + cgit_print_error_page(400, "Bad Request", "Invalid path"); + return -1; +} + static void add_clone_urls(void (*fn)(const char *), char *urls, char *suffix) { struct strbuf **url_list = strbuf_split_str(urls, ' ', 0); -- cgit