Skip to content

Commit cd5d287

Browse files
committed
Explicitly fail encryption/decryption if we can't change the manifest
We would fail with an internal error anyway, this fails explicitly. Signed-off-by: Miloslav Trmač <[email protected]>
1 parent 9008597 commit cd5d287

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

copy/encryption.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ func (ic *imageCopier) blobPipelineDecryptionStep(stream *sourceStream, srcInfo
4040
}, nil
4141
}
4242

43+
if ic.cannotModifyManifestReason != "" {
44+
return nil, fmt.Errorf("layer %s should be decrypted, but we can’t modify the manifest: %s", srcInfo.Digest, ic.cannotModifyManifestReason)
45+
}
46+
4347
desc := imgspecv1.Descriptor{
4448
Annotations: stream.info.Annotations,
4549
}
@@ -83,6 +87,10 @@ func (ic *imageCopier) blobPipelineEncryptionStep(stream *sourceStream, toEncryp
8387
}, nil
8488
}
8589

90+
if ic.cannotModifyManifestReason != "" {
91+
return nil, fmt.Errorf("layer %s should be encrypted, but we can’t modify the manifest: %s", srcInfo.Digest, ic.cannotModifyManifestReason)
92+
}
93+
8694
var annotations map[string]string
8795
if !decryptionStep.decrypting {
8896
annotations = srcInfo.Annotations

0 commit comments

Comments
 (0)