From d309bce2d1ba7fa06fbaa29a4768651afaba72c2 Mon Sep 17 00:00:00 2001 From: Troels Thomsen Date: Thu, 26 Nov 2015 10:28:35 +0100 Subject: [PATCH] Verify manifest name format Signed-off-by: Troels Thomsen --- registry/storage/manifeststore.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/registry/storage/manifeststore.go b/registry/storage/manifeststore.go index 4cbfbda2..2505b57c 100644 --- a/registry/storage/manifeststore.go +++ b/registry/storage/manifeststore.go @@ -112,6 +112,10 @@ func (ms *manifestStore) verifyManifest(ctx context.Context, mnfst *schema1.Sign errs = append(errs, fmt.Errorf("manifest name must not be more than %v characters", reference.NameTotalLengthMax)) } + if !reference.NameRegexp.MatchString(mnfst.Name) { + errs = append(errs, fmt.Errorf("invalid manifest name format")) + } + if len(mnfst.History) != len(mnfst.FSLayers) { errs = append(errs, fmt.Errorf("mismatched history and fslayer cardinality %d != %d", len(mnfst.History), len(mnfst.FSLayers)))