Repository navigation
feat: add the experimental oras check command - #2362
Merged
Merged
Conversation
Add `oras check`, which verifies that one artifact in a registry or an OCI image layout is complete and intact. It reads the manifest, config and every layer and proves each matches its digest and size, continues after a failure, and reports every problem. Part of oras-project#1791, step 1 of 3 as described in oras-project#2359. It resolves the reference, then walks the graph with oras.VerifyGraph and a successor finder that checks each manifest body against the media type of its descriptor and includes the config and the subject. Failures are classified as missing, corrupt, invalid or unable to check, and only proven corruption is called corrupt. A subject that is absent is a warning. Layouts are read without loading their graph, so one corrupt manifest does not stop an intact tag next to it from being checked. The summary is sorted, and the command exits non-zero if anything failed. Refs oras-project#2359 Signed-off-by: branson404 <[email protected]>
Branson404
requested review from
TerryHowe,
Wwwsylvia,
sabre1041,
sajayantony and
shizhMSFT
as code owners
November 25, 2026 07:00
TerryHowe
reviewed
Nov 25, 2026
Print a Verified or Failed line for every node by turning on verbose output for the command, because most manifests, configs and layers have no title and were hidden. Find a manifest nested in an index by its digest in a layout, by falling back to the blob storage when the digest is not listed in the top-level index.json. Treat only the exact media types that oras-go drops as foreign layers, so other types are verified. Clarify the comment on a walk that stops early. Add e2e specs for oras check: an intact artifact in a layout and in a registry, a manifest nested in an index, --platform, a corrupt layer, a missing layer, several problems at once, and the argument errors. Refs oras-project#2359 Signed-off-by: branson404 <[email protected]>
Branson404
force-pushed
the
feat/oras-check-2359
branch
from
November 25, 2026 14:26
ab586a8 to
ffd324a
Compare
TerryHowe
reviewed
Nov 25, 2026
…ted verbose flag A blob over 4 MiB that is resolved by digest got a truncated size, so an intact layer was reported as corrupt (trailing data). Count the rest of the blob to get its real size. Also drop the deprecated --verbose flag; a new command does not need it, and the output is always verbose. Signed-off-by: branson404 <[email protected]>
… manifests An absent subject was counted in the total but is neither verified nor failed, so the summary did not add up. Leave it out of the total. Reject a manifest or index larger than 4 MiB as invalid before reading it into memory. Signed-off-by: branson404 <[email protected]>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2362 +/- ##
==========================================
- Coverage 90.73% 90.71% -0.03%
==========================================
Files 156 157 +1
Lines 6681 6967 +286
==========================================
+ Hits 6062 6320 +258
- Misses 360 376 +16
- Partials 259 271 +12 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
TerryHowe
reviewed
Nov 25, 2026
…ersized manifest as unable to check An oversized manifest is not proof that the content is invalid, only that it was not read. Signed-off-by: branson404 <[email protected]>
Resolve a duplicate tag in a layout to the last match, as oras-go does. Refuse an oversized blob that may be a manifest when it is looked up by digest, instead of checking only its bytes. Do not take an image config for a manifest, and accept an artifact manifest without blobs. Correct the comment on the size limit. Signed-off-by: Terry Howe <[email protected]>
Cover a duplicate tag, an image config and an oversized manifest looked up by digest, and an artifact manifest without blobs. Signed-off-by: Terry Howe <[email protected]>
Member
|
Thanks! |
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.
What this PR does / why we need it:
Adds
oras check, an experimental command that verifies one artifact, in a registry or an OCI image layout, is complete and intact. It reads the manifest, config and every layer, matches each against its digest and size, reports every problem it finds (not only the first), and exits non-zero if anything fails.This is step 1 of 3 from #2359 (part of #1791). Referrers and whole layouts (#2360), and multiple tags, formatted output and TTY progress (#2361), are not included.
Design, following #2359:
oras.Resolve(with--platform), thenoras.VerifyGraphwith a customFindSuccessorsthat checks each manifest body against its descriptor's media type and includes the config and the subject.oras checkto verify the integrity of an artifact #2359 follow its "Proposal" lines.--concurrencyof 0 or less uses the oras-go default (8).Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)format, will close the issue(s) when PR gets merged):Fixes #2359
Please check the following list:
Testing
oras checkto verify the integrity of an artifact #2359 (intact, missing, corrupt, truncated, trailing data, invalid manifests, nested indexes, foreign layers, subject cases, cancellation, output order,--platform, directory and tar layouts, registry errors) plus command-level tests.go test -race -coverpkg=./... ./...passes,golangci-lintwith the repo config reports no issues,go mod tidyleaves no diff, and the CLI builds for every Makefile target.test/e2e/suite/command/check.gohas 17 specs for the scenarios in Addoras checkto verify the integrity of an artifact #2359: an intact artifact in a layout and in a registry, a corrupt layout with a non-zero exit,--platform, a manifest nested in an index, a missing layer and the argument errors. I ran them locally against aregistry:2container and a stand-in login server, since I have no Kubernetes cluster for the repo's Zot setup, so they have not run against Zot or the CI setup.For reviewers: about 480 lines of code in one new file, and the rest of the diff is tests.
cmd.gogets one line.