Repository navigation
Description
At audited revision f04bc7a5729e26dc9c067b0d610e35cd51633435, a non-image OCI artifact is accepted as a fully covered container image and its TAR contents become container package observations. This is an evidence-classification defect, not a demonstrated CVE or exploitability claim.
The planner verifies hashes and sizes but does not inspect the manifest descriptor media type, artifactType, or configuration media type before selecting filesystem semantics. It applies the layer stack for every manifest-shaped object. The README explicitly says OCI attestation manifests are incomplete and describes observations as image package metadata.
Safe reproduction: run python repro.py from the audit workspace. Its first case creates a local synthetic OCI archive using the repository's inspected fixture helpers. The manifest declares artifactType=application/vnd.example.attestation, has the standard two-byte empty JSON configuration with media type application/vnd.oci.empty.v1+json, and a correctly hashed TAR attachment containing app/package.json for Sharp 0.35.5. All descriptor hashes and sizes are correct. Observed output is exit 0, complete=true, coverage_complete=true, and a Sharp row with build_source=container_image_unverified. No image, package, or network operation is executed.
Expected: unsupported artifact contents remain explicitly unsupported/incomplete and do not enter image-consumer exports. An artifact attachment does not establish installed filesystem state. The primary OCI manifest specification distinguishes artifacts and configs; its ordered final-filesystem restrictions apply when the config media type is the image-config type. Hash correctness establishes bytes, not their interpretation.
Remediation: classify supported manifest/config media types and artifact intent before applying filesystem layers; retain the verified artifact identity and an uncertainty reason where unsupported. Acceptance: add synthetic empty-config artifact and unknown-descriptor cases; neither emits runtime package rows, valid image siblings still complete, and normal image fixtures remain passing. Metadata must retain not_tested and must not become a vulnerability verdict. No exact covering issue exists in the supplied issue metadata; merged PR #1 is historical implementation, not an open remediation.
Self-contained synthetic reproduction
Save the following as repro.py beside the pinned repository's test_inventory.py, then run python repro.py. It uses existing local fixture helpers and never runs an image or contacts a registry.
import sys, io, json, hashlib, tarfile
from pathlib import Path
import test_inventory as t
case=t.InventoryTests()
base=t.oci_archive([t.tar_bytes([('app/package.json',t.package())])])
def unpack(raw):
with tarfile.open(fileobj=io.BytesIO(raw)) as f:
return {m.name:f.extractfile(m).read() for m in f if m.isfile()}
def blob(files,value):
raw=json.dumps(value).encode(); d='sha256:'+hashlib.sha256(raw).hexdigest();files['blobs/sha256/'+d[7:]]=raw
return dict(digest=d,size=len(raw),mediaType='application/vnd.oci.image.manifest.v1+json')
files=unpack(base); index=json.loads(files['index.json']); old=index['manifests'][0]; manifest=json.loads(files['blobs/sha256/'+old['digest'][7:]])
empty=b'{}';empty_hash=hashlib.sha256(empty).hexdigest();files['blobs/sha256/'+empty_hash]=empty
manifest['config']=dict(digest='sha256:'+empty_hash,size=2,mediaType='application/vnd.oci.empty.v1+json');manifest['artifactType']='application/vnd.example.attestation';index['manifests']=[blob(files,manifest)];files['index.json']=json.dumps(index).encode()
code,report,_=case.scan(t.tar_bytes(list(files.items())))
print(json.dumps(dict(case='artifact-treated-as-image',exit=code,complete=report['complete'],images=report['images'])))
files=unpack(base);index=json.loads(files['index.json']);nested=blob(files,dict(schemaVersion=3,manifests=[]));nested['mediaType']='application/vnd.oci.image.index.v1+json';index['manifests'].append(nested);files['index.json']=json.dumps(index).encode()
code,report,_=case.scan(t.tar_bytes(list(files.items())))
print(json.dumps(dict(case='nested-invalid-index-loses-sibling',exit=code,report=report)))
files=unpack(t.docker_archive([t.tar_bytes([('app/package.json',t.package())])]))
manifest=json.loads(files['manifest.json']);manifest.append(dict(Config='config.json',Layers=['missing.tar']));files['manifest.json']=json.dumps(manifest).encode()
code,report,_=case.scan(t.tar_bytes(list(files.items())))
print(json.dumps(dict(case='docker-missing-layer-loses-sibling',exit=code,report=report)))
Activity