|
@@ -32,7 +32,11 @@ import (
|
|
"golang.org/x/net/context"
|
|
"golang.org/x/net/context"
|
|
)
|
|
)
|
|
|
|
|
|
-var errRootFSMismatch = errors.New("layers from manifest don't match image configuration")
|
|
|
|
|
|
+var (
|
|
|
|
+ errRootFSMismatch = errors.New("layers from manifest don't match image configuration")
|
|
|
|
+ errMediaTypePlugin = errors.New("target is a plugin")
|
|
|
|
+ errRootFSInvalid = errors.New("invalid rootfs in image configuration")
|
|
|
|
+)
|
|
|
|
|
|
// ImageConfigPullError is an error pulling the image config blob
|
|
// ImageConfigPullError is an error pulling the image config blob
|
|
// (only applies to schema2).
|
|
// (only applies to schema2).
|
|
@@ -356,6 +360,12 @@ func (p *v2Puller) pullV2Tag(ctx context.Context, ref reference.Named) (tagUpdat
|
|
return false, fmt.Errorf("image manifest does not exist for tag or digest %q", tagOrDigest)
|
|
return false, fmt.Errorf("image manifest does not exist for tag or digest %q", tagOrDigest)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if m, ok := manifest.(*schema2.DeserializedManifest); ok {
|
|
|
|
+ if m.Manifest.Config.MediaType == schema2.MediaTypePluginConfig {
|
|
|
|
+ return false, errMediaTypePlugin
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
// If manSvc.Get succeeded, we can be confident that the registry on
|
|
// If manSvc.Get succeeded, we can be confident that the registry on
|
|
// the other side speaks the v2 protocol.
|
|
// the other side speaks the v2 protocol.
|
|
p.confirmedV2 = true
|
|
p.confirmedV2 = true
|
|
@@ -574,6 +584,10 @@ func (p *v2Puller) pullSchema2(ctx context.Context, ref reference.Named, mfst *s
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if unmarshalledConfig.RootFS == nil {
|
|
|
|
+ return "", "", errRootFSInvalid
|
|
|
|
+ }
|
|
|
|
+
|
|
// The DiffIDs returned in rootFS MUST match those in the config.
|
|
// The DiffIDs returned in rootFS MUST match those in the config.
|
|
// Otherwise the image config could be referencing layers that aren't
|
|
// Otherwise the image config could be referencing layers that aren't
|
|
// included in the manifest.
|
|
// included in the manifest.
|