oci-image-platform-audit
Audit local OCI Image Layout v1.1.1 directories offline for index/manifest media types, blob digests and sizes, platform vs. config OS/arch/variant alignment, and non-image artifacts.
Try your first task
A source-grounded starter task has not been verified for this skill yet.
SKILL.md
name: oci-image-platform-auditdescription: "Audit local OCI Image Layout v1.1.1 directories offline for index/manifest media types, blob digests and sizes, platform vs. config OS/arch/variant alignment, and non-image artifacts."category: devopsrisk: safesource: selfsource_type: selfdate_added: "2026-12-01"author: Koushik-Katkamtags: [oci, container-image, multi-arch, platform, digest, audit]OCI Image Platform Audit
Overview
Inspect local OCI Image Layout v1.1.1 directories strictly offline without starting a Docker daemon, pulling from remote registries, extracting filesystem layer tarballs, or executing containers. Verifies oci-layout, index.json, media types, sha256 blob existence and byte sizes, platform descriptor vs. image config os/architecture/variant alignment, duplicate/ambiguous platform entries, and non-image artifact descriptors.
Distinction from existing container and gateway skills:
unified-ai-gateway: verifies a pinned multi-platform MCP server digest using livedocker pull --platformand container inspection commands rather than auditing raw local OCI Image Layout JSON/blobs.container-scanningandcontainer-security-hardening: focus on vulnerability scanning (Trivy/Grype), Dockerfile hardening, seccomp/AppArmor, and Kubernetes pod security rather than OCI index/config platform consistency.container-registriesanddocker-expert: manage remote registry auth/retention and Dockerfile builds rather than offline OCI layout verification.
When to Use
- Auditing multi-arch OCI layouts (
linux/amd64,linux/arm64,linux/arm/v7) before pushing images to a registry or signing digests. - Catching mismatched platform builds (for example, an
index.jsonlinux/arm64descriptor pointing to anamd64config JSON). - Verifying that SBOM/attestation/referrer descriptors (
application/vnd.oci.empty.v1orunknown/unknownplatform) are classified explicitly as non-image artifacts without breaking platform selection. - Do not use this skill to pull remote images, mutate registries, unpack rootfs tarballs, or verify cryptographic signatures / publisher identity.
Prerequisites
- Python
3.10+withjsonschemaandpytest(tested with Python3.12.10,jsonschema==4.26.0,pytest==9.1.1). - A synthetic or exported local OCI layout directory (
oci-layout,index.json,blobs/sha256/*). - No Docker daemon, registry network requests, or container execution required.
How It Works
1. Validate OCI layout containment and index structure
- Read
oci-layout({"imageLayoutVersion": "1.0.0"}) andindex.jsonstrictly as regular, layout-contained JSON objects (rejecting symlinks, junctions, non-regular files, and path escapes outside the layout root) using a single bounded read (4 MiBlimit enforced at the read boundary); malformed JSON, non-object documents (e.g., JSON arrays), unsafe metadata paths, or missing required files classify asINVALID_INPUT. - Enforce strict
sha256:<64-lowercase-hex>digest format (UNSUPPORTEDfor non-sha256algorithms), non-negative integer descriptorsize(rejecting booleans/strings/negatives), and regular-file layout containment ensuringblobs,blobs/sha256, and target blob files remain non-symlink regular files strictly inside the layout root. - Validate
index.jsonmediaType (application/vnd.oci.image.index.v1+jsonwhen present) andschemaVersion: 2. Nested OCI indexes (application/vnd.oci.image.index.v1+jsoninsideindex.manifests) are explicitly markedUNSUPPORTED.
2. Audit image manifests, blobs, and platform alignment
Run the local suite in OCI platform audit harness:
- Blob existence, byte size, and SHA-256 digest: Verify every referenced manifest, config, and layer blob exists inside
blobs/sha256/as a contained regular file, stays within its declared read-boundary byte limit (4 MiBfor JSON metadata,64 MiBbounded streaming read for layers and artifact payloads), matchesdescriptor.size, and hashes to the declaredsha256digest. - Verified image manifests vs. non-image artifacts: Inspect
manifest.mediaType,config.mediaType(application/vnd.oci.empty.v1+jsonor customartifactType), andplatform(unknown/unknownBuildx attestation pattern) after verifying the artifact manifest's referencedconfig(when present) andlayersblobs, so valid non-image descriptors are classified cleanly asnon_image_artifactswithout failing image config-arch checks, while missing or corrupted artifact blobs fail the audit. - Platform vs. config cross-check: For runnable image manifests (
application/vnd.oci.image.manifest.v1+json+application/vnd.oci.image.config.v1+json), assertdescriptor.platform.os == config.os,descriptor.platform.architecture == config.architecture, anddescriptor.platform.variant == config.variantwhenvariantis present. Missing optionalplatformon an index image descriptor fails strict multi-arch selection audit (MISSING_INDEX_PLATFORM). - Duplicate/ambiguous platform detection: Flag two or more runnable descriptors sharing the same
(os, architecture, variant)tuple asAMBIGUOUS_PLATFORM(FAIL).
3. Preserve integrity vs. authenticity boundary
State explicitly in every audit report that matching sha256 digests verify internal content integrity against the local index only — digest verification never proves publisher authenticity, build provenance, cryptographic signature trust, or runnable container execution.
Examples
Run the self-contained verification suite in OCI platform audit harness:
User request: "Check our exported multi-arch OCI directory before pushing to ECR."
Inputs: Local OCI Image Layout v1.1.1 directory containing linux/amd64, linux/arm64, and an SBOM artifact descriptor.
Expected result: PASS for valid matched amd64 + arm64 + non-image artifact layout (with content-integrity-only
note); FAIL with PLATFORM_CONFIG_MISMATCH if linux/arm64 references an amd64 config, or AMBIGUOUS_PLATFORM
on duplicate platform descriptors.
Limitations
- Verifies OCI layout descriptors, manifests, configs, and layer blob digests/sizes; does not extract, decompress, or validate tar entries inside layer blobs or execute binaries under emulation (
binfmt_misc). - Only
sha256digests are hashed locally;sha512or unregistered digest algorithms returnUNSUPPORTED. - Nested OCI Image Indexes (
application/vnd.oci.image.index.v1+jsoninsideindex.manifests) and Docker manifest list v2 (application/vnd.docker.distribution.manifest.list.v2+json) manifests are rejected/classified separately (UNSUPPORTED/UNEXPECTED_MANIFEST_MEDIA_TYPE). - Index
descriptor.platformis optional in the OCI specification for single-architecture images, soMISSING_INDEX_PLATFORMenforces a stricter multi-arch index policy rather than a universal OCI grammar failure.
Safety and Side Effects
- Strictly offline and read-only over synthetic or local OCI layout directories, enforcing layout-root containment, symlink/junction refusal, and open-handle regular-file (
S_ISREG) checks acrossoci-layout,index.json, andblobs/sha256/*, with a4 MiBJSON metadata single-bounded-read limit and a64 MiBbounded streaming read limit for layer and artifact blobs. - Never runs
docker pull,docker push,docker run, ortarextraction against untrusted layers.