Repository navigation
feat(pack): add a digest algorithm option to PackManifest - #1494
Merged
TerryHowe merged 2 commits intoOct 2, 2026
Merged
Conversation
PackManifest always built its descriptors with digest.Canonical, so its output was SHA-256 even where SHA-384 or SHA-512 is the standard. Add PackManifestOptions.DigestAlgorithm, used for the manifest and for the config and empty blobs PackManifest generates, and content.NewDescriptorFromBytesWithAlgorithm. The default stays digest.Canonical, and an unavailable algorithm returns ErrUnsupported. Part of oras-project#1491 Signed-off-by: Aditya <205600203+Rohilalala@users.noreply.github.com>
Rohilalala
requested review from
TerryHowe,
Wwwsylvia,
sabre1041 and
shizhMSFT
as code owners
October 1, 2026 19:22
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1494 +/- ##
==========================================
+ Coverage 91.28% 91.32% +0.03%
==========================================
Files 100 100
Lines 7848 7872 +24
==========================================
+ Hits 7164 7189 +25
+ Misses 673 672 -1
Partials 11 11 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
TerryHowe
reviewed
Oct 2, 2026
Accept only SHA-256, SHA-384 and SHA-512 when packing, instead of whatever go-digest has registered, and share the list with the OCI store. Also note that non-canonical empty blobs differ from DescriptorEmptyJSON, and wrap the manifest descriptor error like the marshal error. Signed-off-by: Aditya <205600203+Rohilalala@users.noreply.github.com>
Member
|
Thanks! |
This was referenced Oct 7, 2026
Closed
Closed
Closed
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.
Part of #1491: lets callers choose the digest algorithm when packing (item 1), restricted to an allowlist (item 2).
PackManifestbuilt every descriptor withdigest.Canonical, so its output was always SHA-256.PackManifestOptions.DigestAlgorithmselects the algorithm for the manifest and for the config and empty blobs thatPackManifestgenerates. Descriptors passed inSubject,LayersandConfigDescriptorkeep their own digests.content.NewDescriptorFromBytesWithAlgorithmis the matching descriptor helper.digest.Canonical, so existing output is unchanged.internal/descriptor.IsSupportedAlgorithm, which the OCI store's GC now uses too). Anything else, or an algorithm whose hash package is not linked, returnserrdef.ErrUnsupportedbefore anything is pushed.Not in this PR:
Available()checks inregistry/remoteare not moved to the allowlist.Docker-Content-Digeststill fails the strict check on pushes inregistry/remote. That path is untouched.Packkeeps usingdigest.Canonical.AI-assisted (Claude); I reviewed and tested the change.