Repository navigation
Add sha512 support - #4946
Add sha512 support#4946tianon wants to merge 1 commit into
Conversation
|
Edit: done |
|
(Tested against opencontainers/distribution-spec#623, which is also why I missed implementing that in the first place 😂) |
|
Nice to see you are still engaged with registries @tianon! I have made my agents run a few tests, and asked questions, related to throuput, ops calls etc. Here are some of the returned findings, can you take a look at 2,3, not sure about 5 Tested locally: filesystem storage, PR head vs merge base
Every sha512 category passes and nothing regresses. The 24 remaining failures are the same on base: referrers, Findings
Behavior that checked out:
Hash throughput, Go stdlib, Apple M1 Pro:
That is still well above per-connection network rates. Without the |
|
Thanks for reviewing! Good points all around. I've pushed a new commit to address your points (kept separate to make it easier to [re-]review), but I am perfectly happy to squash (or for this to be squash-merged).
|
|
Had the paperclip counter go and actually verify the GC claims:
|
|
This is still broken and needs a bit more work. Specifically, we the following 2 things would've been broken if we merged this:
proxysha512 manifests never hit the proxy cache... so content is cached under notifsthis one is tricky and without an agent it would've skipped past me - thanks AI Gods... So, in distribution/notifications/bridge.go Lines 148 to 154 in be78ef9
this digest distribution/notifications/bridge.go Line 154 in be78ef9 UnmarshalManifest Line 78 in be78ef9 unmarshalFunc(p)); that actually calls digest.FromBytes 👉
which computes sha256
Which we then set in distribution/notifications/bridge.go Line 154 in be78ef9 instead of the |
milosgajdos
left a comment
There was a problem hiding this comment.
This needs a bit more work 😅
|
Review updates (and a few bonus related edges I pressed to find while fixing those) are up in 98cffd6 -- I'll rebase/squash shortly, esp. to fix that conflict. |
Accept, store, and serve content addressed by sha512 in addition to sha256, including through the pull-through proxy and in notification events. Verified against the OCI conformance suite (all sha512 blob and digest-algorithm categories now pass). Newly pushed content is limited to sha256 and sha512 (the `digest-algorithm` hint, the blob commit digest, and manifest PUT by digest), and anything else is rejected with `DIGEST_INVALID` -- `crypto/sha512` also registers sha384, but the spec does not define it. This also adds the optional `?digest-algorithm=` blob upload parameter (opencontainers/distribution-spec@eadf94bb) so a client can pre-inform the registry of the final digest algorithm, which lets it digest in-progress instead of doing an expensive re-read / re-digest at commit. - carry the declared `digest-algorithm` in the signed upload state and hand it to `Resume` via the new `storage.WithResumeDigestAlgorithm`, instead of persisting a file that every PATCH/PUT would have to read back (the public `Resume` signature is unchanged) - compare against the digester's algorithm rather than `digest.Canonical` in the `validateBlob` "written == size" fast path, and declare the algorithm when the pull-through cache creates its local writer, so sha512 blobs that were just hashed while streaming are not read back from storage - pass the requested digest through to the proxy's local manifest `Put`, so pull-through caches store sha512 manifests under sha512 (this also fixes the TTL expiry callback deleting a digest that was never stored) - report the algorithm a manifest was stored under in push and pull notification events instead of always the canonical one - recognize the empty blob for non-sha256 algorithms - document `digest-algorithm` and sha512 in the API spec, and extend the blob upload, blob API, manifest API, proxy, and notification tests to cover sha512 with and without the hint, `Resume` rebuilding the digester, and rejection of sha384 and unknown algorithms Assisted-By: "claude my eyes right out" Signed-off-by: Tianon Gravi <[email protected]>
|
this is failing validation, alas |
|
That's a Docker Hub flake, not this change 😅 #16 [stage-2 1/1] RUN --mount=type=bind,target=. --mount=type=cache,target=/root/.cache --mount=from=golangci-lint,source=/usr/bin/golangci-lint,target=/usr/bin/golangci-lint golangci-lint config verify && golangci-lint --timeout "5m" --build-tags "" run
#16 2.226 The command is terminated due to an error: [.golangci.yml] validate: compile schema: failing loading "https://golangci-lint.run/jsonschema/golangci.v2.9.jsonschema.json": Get "https://golangci-lint.run/jsonschema/golangci.v2.9.jsonschema.json": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
#16 ERROR: process "/bin/sh -c golangci-lint config verify && golangci-lint --timeout \"${TIMEOUT}\" --build-tags \"${BUILDTAGS}\" run" did not complete successfully: exit code: 3
------
> [stage-2 1/1] RUN --mount=type=bind,target=. --mount=type=cache,target=/root/.cache --mount=from=golangci-lint,source=/usr/bin/golangci-lint,target=/usr/bin/golangci-lint golangci-lint config verify && golangci-lint --timeout "5m" --build-tags "" run:
2.226 The command is terminated due to an error: [.golangci.yml] validate: compile schema: failing loading "https://golangci-lint.run/jsonschema/golangci.v2.9.jsonschema.json": Get "https://golangci-lint.run/jsonschema/golangci.v2.9.jsonschema.json": context deadline exceeded (Client.Timeout exceeded while awaiting headers) |
Ah nice, I responded from phone when I saw this; retried from desktop now; all good; will review later. thanks |
Verified against the OCI conformance suite (779 -> 950 passing tests, all core sha512 categories now green).
This also includes support for the (optional)
?digest-algorithm=query parameter (opencontainers/distribution-spec@eadf94b / opencontainers/distribution-spec#543) on blob uploading to pre-inform the registry of the final digest algorithm (so it can correctly digest in-progress instead of having to perform an expensive re-read / re-digest at commit).Assisted-By: "claude my eyes right out"