From 96128cad7be0f83f4d1ac66544589cacafcdc614 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 17 Oct 2026 17:09:14 -1000 Subject: Hold a signature download to max-blob-size A signature is a note a pusher stored, and the download read it whole without the size check every other blob a page inflates goes through. --- source/ui-snapshot.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'source/ui-snapshot.c') diff --git a/source/ui-snapshot.c b/source/ui-snapshot.c index f4e79f7..bd5ebf2 100644 --- a/source/ui-snapshot.c +++ b/source/ui-snapshot.c @@ -304,6 +304,17 @@ static int send_sig(const struct cgit_snapshot_format *format, const char *hex, return 0; } + // A note is any blob a pusher stored, so it is held to the same bound + // as every other blob a page inflates. + if (odb_read_object_info(the_repository->objects, note, &size) != OBJ_BLOB) { + cgit_print_error_page(404, "Not Found", "Not found"); + return 0; + } + if (cgit_blob_too_large(size)) { + cgit_print_blob_too_large(size); + return 0; + } + buf = odb_read_object(the_repository->objects, note, &type, &size); if (!buf) { cgit_print_error_page(404, "Not Found", "Not found"); -- cgit