Skip to content

[release/10.0.3xx] Fix DownloadBlobAsync_RetriesOnFailure digest validation - #55543

Open
nagilson wants to merge 2 commits into
dotnet:release/10.0.3xxfrom
nagilson:fix-containers-digest-test-10.0.3xx
Open

[release/10.0.3xx] Fix DownloadBlobAsync_RetriesOnFailure digest validation#55543
nagilson wants to merge 2 commits into
dotnet:release/10.0.3xxfrom
nagilson:fix-containers-digest-test-10.0.3xx

Conversation

@nagilson

Copy link
Copy Markdown
Member

Problem

The blob digest-validation feature (Registry.DownloadBlobAsync -> StreamExtensions.CopyToAndVerifyAsync -> DigestUtils.GetEncodedValue) is flowing into release/10.0.3xx from the VMR, but RegistryTests.DownloadBlobAsync_RetriesOnFailure still uses the placeholder digest sha256:testdigest1234.

Once verification runs, the retried download "succeeds" returning bytes { 1, 2, 3 } and the code strips sha256: then calls Convert.FromHexString("testdigest1234"), which throws FormatException: The input is not a valid hex string (t/s aren't hex). The next retry NREs (mock exhausted) and the method throws UnableToDownloadFromRepositoryException, failing the test on every leg (Linux/macOS/Windows/FullFramework).

This blocks the codeflow PR #55455 and every codeflow into release/10.0.3xx.

Fix

Use the real SHA-256 of the mock content { 1, 2, 3 } (039058c6f2c0cb492c533b0a4d14ef77cc0f78abccced5287d84a1a2011cfb81) so digest verification passes. This matches the fix already on main (commit b525d46, "Add digest validation for downloaded and cached registry blobs").

Landing this on release/10.0.3xx forward-flows the correction to the VMR so codeflow PRs stop reintroducing the broken test.

Validation

SHA256({ 1, 2, 3 }) == 039058c6f2c0cb492c533b0a4d14ef77cc0f78abccced5287d84a1a2011cfb81 (verified), so CopyToAndVerifyAsync computes a matching hash and the retry test passes.

The blob digest-validation feature (CopyToAndVerifyAsync) is flowing into
release/10.0.3xx from the VMR, but this test uses the placeholder digest
'sha256:testdigest1234'. That value is not valid hex, so once verification is
enabled GetEncodedValue -> Convert.FromHexString throws FormatException when the
retried download 'succeeds', failing the test on every leg.

Use the actual SHA-256 of the mock content { 1, 2, 3 }
(039058c6f2c0cb492c533b0a4d14ef77cc0f78abccced5287d84a1a2011cfb81) so digest
verification passes, matching the fix already on main (b525d46). Landing this on
release/10.0.3xx forward-flows the correction so codeflow PRs stop regressing.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 6267ed77-eef8-42c1-8799-1b107460fc61
@nagilson
nagilson requested a review from a team as a code owner July 30, 2026 17:53
Copilot AI review requested due to automatic review settings July 30, 2026 17:53
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
2 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the container registry unit test in release/10.0.3xx to use a valid SHA-256 digest for the mocked blob payload, preventing digest-parsing/verification failures when DownloadBlobAsync validates the digest.

Changes:

  • Replace the placeholder digest (sha256:testdigest1234) with the real SHA-256 for the mocked content { 1, 2, 3 }.

@nagilson
nagilson requested review from a team and lbussell July 30, 2026 17:55
@nagilson
nagilson enabled auto-merge July 30, 2026 17:57
@marcpopMSFT

Copy link
Copy Markdown
Member

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 9e4ad2d8-eae4-4af7-a524-6ad60a95f070
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants