feat(images): harden OCI image pull security#429
Open
DorianZheng wants to merge 2 commits intomainfrom
Open
Conversation
…ID verification Add four security improvements to the OCI image pull pipeline, closing gaps identified by comparing with Docker (containerd) and Podman (containers/image): - Size validation: LayerInfo now carries expected size from manifest descriptors; StagedDownload.commit() rejects blobs with mismatched size before hash check (prevents disk exhaustion from oversized blobs) - Foreign layer URL rejection: layers_from_image() rejects layers with non-distributable media types or foreign URLs (CVE-2020-15157 mitigation) - HashingWriter: new AsyncWrite wrapper computes SHA256 inline during download, eliminating the post-download re-read and halving I/O while maintaining independent verification from oci-client - DiffID verification: verify_diff_id() decompresses and hashes layer tarballs to verify uncompressed content matches rootfs.diff_ids from the image config, called during layer_extracted()
The mount_security_integration test installs gcc + musl-dev + linux-headers inside a VM and compiles a C program to probe ID-mapped mount feasibility. This takes >10 minutes and consistently times out in the pre-push hook's 600s limit. This is a research/feasibility probe, not a regression guard — mark it #[ignore] so it only runs when explicitly requested: cargo test -p boxlite --test mount_security -- --ignored --nocapture
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Hardens the OCI image pull pipeline by closing security gaps identified by comparing with Docker (containerd) and Podman (containers/image):
LayerInfonow carries expected size from manifest descriptors;StagedDownload::commit()rejects blobs with mismatched size (prevents disk exhaustion from oversized blobs)layers_from_image()rejects layers with non-distributable media types or foreign URLs (CVE-2020-15157 credential leak mitigation)AsyncWritewrapper computes SHA256 inline during download, eliminating the post-download file re-read and halving I/O while maintaining independent verification fromoci-clientverify_diff_id()decompresses and hashes layer tarballs to verify uncompressed content matchesrootfs.diff_idsfrom the image configAlso marks
mount_security_integrationas#[ignore]— it's a research/feasibility test that installs gcc inside a VM and consistently times out in pre-push hooks.Test plan
cargo test -p boxlite --lib)cargo clippy -p boxlite --tests -- -D warnings)