From 3800885ada9da6d224a35e59f72fd20bb372f4b0 Mon Sep 17 00:00:00 2001 From: Malte Poll <1780588+malt3@users.noreply.github.com> Date: Mon, 28 Jul 2025 20:52:23 +0200 Subject: [PATCH] isBlob: avoid panic on invalid path The array access of `elem[len(elem)-1]` can be invalid if `len(elem) == 0`. --- pkg/registry/blobs.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/registry/blobs.go b/pkg/registry/blobs.go index c83e54799..73a8331c7 100644 --- a/pkg/registry/blobs.go +++ b/pkg/registry/blobs.go @@ -38,6 +38,9 @@ import ( func isBlob(req *http.Request) bool { elem := strings.Split(req.URL.Path, "/") elem = elem[1:] + if len(elem) < 3 { + return false + } if elem[len(elem)-1] == "" { elem = elem[:len(elem)-1] }