storeLayer.Parent should return describableStoreLayers
When storeLayer.Parent returns the parent layer, it needs to use the same logic as Get where it wraps in a describablyStoreLayer if the layer is describable. Otherwise, on Windows, this can result in pushing the foreign layers, which is not supposed to be allowed. This fixes https://github.com/docker/docker/issues/30080. Signed-off-by: Stefan J. Wernli <swernli@microsoft.com> Upstream-commit: d14b7212ad7b2b161afc6f0c9ac08daae14198c0 Component: engine
This commit is contained in:
@@ -198,10 +198,18 @@ func (l *storeLayer) Parent() PushLayer {
|
||||
if p == nil {
|
||||
return nil
|
||||
}
|
||||
return &storeLayer{
|
||||
sl := storeLayer{
|
||||
Layer: p,
|
||||
ls: l.ls,
|
||||
}
|
||||
if d, ok := p.(distribution.Describable); ok {
|
||||
return &describableStoreLayer{
|
||||
storeLayer: sl,
|
||||
describable: d,
|
||||
}
|
||||
}
|
||||
|
||||
return &sl
|
||||
}
|
||||
|
||||
func (l *storeLayer) Open() (io.ReadCloser, error) {
|
||||
|
||||
Reference in New Issue
Block a user