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.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source/ui-shared.h') diff --git a/source/ui-shared.h b/source/ui-shared.h index fa8d8dd..87f9c60 100644 --- a/source/ui-shared.h +++ b/source/ui-shared.h @@ -142,6 +142,13 @@ extern int cgit_get_old_oid(const char *old_rev, const struct commit *commit, st */ extern int cgit_prepare_walk(struct rev_info *rev); +/* + * Refuse a path with a leading colon, printing the 400 page. git reads such a + * path as a pathspec with magic, which can end the request inside git. + * Returns non-zero when the path was refused. + */ +extern int cgit_refuse_pathspec_magic(const char *path); + extern void cgit_print_filemode(unsigned short mode); extern void cgit_print_snapshot_links(const struct cgit_repo *repo, const char *ref, const char *separator); -- cgit