@@ -32,7 +32,11 @@ import (
3232 "golang.org/x/net/context"
3333)
3434
35- var errRootFSMismatch = errors .New ("layers from manifest don't match image configuration" )
35+ var (
36+ errRootFSMismatch = errors .New ("layers from manifest don't match image configuration" )
37+ errMediaTypePlugin = errors .New ("target is a plugin" )
38+ errRootFSInvalid = errors .New ("invalid rootfs in image configuration" )
39+ )
3640
3741// ImageConfigPullError is an error pulling the image config blob
3842// (only applies to schema2).
@@ -356,6 +360,12 @@ func (p *v2Puller) pullV2Tag(ctx context.Context, ref reference.Named) (tagUpdat
356360 return false , fmt .Errorf ("image manifest does not exist for tag or digest %q" , tagOrDigest )
357361 }
358362
363+ if m , ok := manifest .(* schema2.DeserializedManifest ); ok {
364+ if m .Manifest .Config .MediaType == schema2 .MediaTypePluginConfig {
365+ return false , errMediaTypePlugin
366+ }
367+ }
368+
359369 // If manSvc.Get succeeded, we can be confident that the registry on
360370 // the other side speaks the v2 protocol.
361371 p .confirmedV2 = true
@@ -574,6 +584,10 @@ func (p *v2Puller) pullSchema2(ctx context.Context, ref reference.Named, mfst *s
574584 }
575585 }
576586
587+ if unmarshalledConfig .RootFS == nil {
588+ return "" , "" , errRootFSInvalid
589+ }
590+
577591 // The DiffIDs returned in rootFS MUST match those in the config.
578592 // Otherwise the image config could be referencing layers that aren't
579593 // included in the manifest.
0 commit comments