forked from TrueCloudLab/distribution
Verify manifest name length
Signed-off-by: Troels Thomsen <troels@thomsen.io>
This commit is contained in:
parent
e8f8f4034e
commit
34c8194c95
1 changed files with 5 additions and 0 deletions
|
@ -7,6 +7,7 @@ import (
|
||||||
"github.com/docker/distribution/context"
|
"github.com/docker/distribution/context"
|
||||||
"github.com/docker/distribution/digest"
|
"github.com/docker/distribution/digest"
|
||||||
"github.com/docker/distribution/manifest/schema1"
|
"github.com/docker/distribution/manifest/schema1"
|
||||||
|
"github.com/docker/distribution/reference"
|
||||||
"github.com/docker/libtrust"
|
"github.com/docker/libtrust"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -107,6 +108,10 @@ func (ms *manifestStore) GetByTag(tag string, options ...distribution.ManifestSe
|
||||||
func (ms *manifestStore) verifyManifest(ctx context.Context, mnfst *schema1.SignedManifest) error {
|
func (ms *manifestStore) verifyManifest(ctx context.Context, mnfst *schema1.SignedManifest) error {
|
||||||
var errs distribution.ErrManifestVerification
|
var errs distribution.ErrManifestVerification
|
||||||
|
|
||||||
|
if len(mnfst.Name) > reference.NameTotalLengthMax {
|
||||||
|
errs = append(errs, fmt.Errorf("manifest name must not be more than %v characters", reference.NameTotalLengthMax))
|
||||||
|
}
|
||||||
|
|
||||||
if len(mnfst.History) != len(mnfst.FSLayers) {
|
if len(mnfst.History) != len(mnfst.FSLayers) {
|
||||||
errs = append(errs, fmt.Errorf("mismatched history and fslayer cardinality %d != %d",
|
errs = append(errs, fmt.Errorf("mismatched history and fslayer cardinality %d != %d",
|
||||||
len(mnfst.History), len(mnfst.FSLayers)))
|
len(mnfst.History), len(mnfst.FSLayers)))
|
||||||
|
|
Loading…
Reference in a new issue