Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
image-rs: fix duplicated image layer detective logic
Before this commit, when we pull images who have two encrypted layers whose corresponding plaintext layers are same like `quay.io/fidencio/prueba:encrypted`, ther will be an error like ``` index out of bounds: the len is 25 but the index is 25 ``` This is caused by the deduplication logic inside image pull logic. On one hand, it will delete duplicated layers recorded inside image manifest, who reflectes the encrypted layers/blobs. On the other hand, it will delete duplicated layers recorded inside the config.json, who reflects the plaintext of the layers. The image encryption logic will generate a random symmetric key for each layer. Thus even the same plaintext layer would be encrypted into different blobs/layers. Thus after deduplication, we might have more layers for image manifest. This patch changes the deduplicating logic, by only check the layer digests inside image manifest, s.t. even if there are two same plaintext layers, we will pull and decrypt both of them. It's ok to do some optimization later if a fully analyzation is token. Fies confidential-containers#840 Signed-off-by: Xynnn007 <xynnn@linux.alibaba.com>
- Loading branch information