Skip to content

Bound remote config blob reads#2324

Open
Haihan-Jiang wants to merge 1 commit into
google:mainfrom
Haihan-Jiang:codex/go-containerregistry-bound-config-read
Open

Bound remote config blob reads#2324
Haihan-Jiang wants to merge 1 commit into
google:mainfrom
Haihan-Jiang:codex/go-containerregistry-bound-config-read

Conversation

@Haihan-Jiang

Copy link
Copy Markdown
Contributor

Summary

  • add a bounded read helper that reads max+1 bytes and returns a clear error when a response exceeds the limit
  • cap remote image config blobs at 100 MiB before fetching and while reading
  • add tests for the limit helper and for rejecting an oversized config descriptor before issuing a blob request

Fixes #2204 for current main; the other issue-listed remote error, auth token, and referrers reads are already bounded there.

Testing

  • go test ./pkg/v1/remote
  • go test ./pkg/v1/remote/transport
  • git diff --check
  • ./hack/presubmit.sh (package tests passed, then local script failed because registry was not found on PATH for cmd/crane/rebase_test.sh; this left no source changes)

@Haihan-Jiang
Haihan-Jiang marked this pull request as ready for review May 24, 2026 19:11
@Haihan-Jiang Haihan-Jiang changed the title [codex] Bound remote config blob reads Bound remote config blob reads May 26, 2026
@Haihan-Jiang

Copy link
Copy Markdown
Contributor Author

This is ready for review. The remote config blob read is now bounded, and the visible checks are green.

@codecov-commenter

codecov-commenter commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.93%. Comparing base (31df54c) to head (1bcb8fe).
⚠️ Report is 19 commits behind head on main.

Files with missing lines Patch % Lines
pkg/v1/remote/fetcher.go 71.42% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2324      +/-   ##
==========================================
+ Coverage   56.91%   56.93%   +0.01%     
==========================================
  Files         165      165              
  Lines       11362    11371       +9     
==========================================
+ Hits         6467     6474       +7     
- Misses       4134     4135       +1     
- Partials      761      762       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

multiple unbounded io.ReadAll reads allow registry-controlled memory exhaustion (dos)

2 participants