Skip to content

Commit 70c88f5

Browse files
committed
schema1: reject ambiguous documents
Signed-off-by: Samuel Karp <[email protected]>
1 parent eb9ba7e commit 70c88f5

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

remotes/docker/schema1/converter.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,9 @@ func (c *Converter) fetchManifest(ctx context.Context, desc ocispec.Descriptor)
255255
if err := json.Unmarshal(b, &m); err != nil {
256256
return err
257257
}
258+
if len(m.Manifests) != 0 || len(m.Layers) != 0 {
259+
return errors.New("converter: expected schema1 document but found extra keys")
260+
}
258261
c.pulledManifest = &m
259262

260263
return nil
@@ -471,8 +474,10 @@ type history struct {
471474
}
472475

473476
type manifest struct {
474-
FSLayers []fsLayer `json:"fsLayers"`
475-
History []history `json:"history"`
477+
FSLayers []fsLayer `json:"fsLayers"`
478+
History []history `json:"history"`
479+
Layers json.RawMessage `json:"layers,omitempty"` // OCI manifest
480+
Manifests json.RawMessage `json:"manifests,omitempty"` // OCI index
476481
}
477482

478483
type v1History struct {

0 commit comments

Comments
 (0)