Skip to content

Commit

Permalink
schema1: reject ambiguous documents
Browse files Browse the repository at this point in the history
Signed-off-by: Samuel Karp <skarp@amazon.com>
  • Loading branch information
samuelkarp committed Nov 15, 2021
1 parent eb9ba7e commit 70c88f5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions remotes/docker/schema1/converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,9 @@ func (c *Converter) fetchManifest(ctx context.Context, desc ocispec.Descriptor)
if err := json.Unmarshal(b, &m); err != nil {
return err
}
if len(m.Manifests) != 0 || len(m.Layers) != 0 {
return errors.New("converter: expected schema1 document but found extra keys")
}
c.pulledManifest = &m

return nil
Expand Down Expand Up @@ -471,8 +474,10 @@ type history struct {
}

type manifest struct {
FSLayers []fsLayer `json:"fsLayers"`
History []history `json:"history"`
FSLayers []fsLayer `json:"fsLayers"`
History []history `json:"history"`
Layers json.RawMessage `json:"layers,omitempty"` // OCI manifest
Manifests json.RawMessage `json:"manifests,omitempty"` // OCI index
}

type v1History struct {
Expand Down

0 comments on commit 70c88f5

Please sign in to comment.