Skip to content

fix: limit manifest config fetch size - #2222

Merged
TerryHowe merged 10 commits into
oras-project:mainfrom
TanvirTian:fix/config-size-limit
Oct 6, 2026
Merged

TerryHowe merged 10 commits into
oras-project:mainfrom
TanvirTian:fix/config-size-limit

Conversation

@TanvirTian

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:
This PR fixes unbounded memory use when oras manifest fetch-config fetches an oversized config file. It rejects config files larger than 4 MiB before downloading them.

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 #2221

Please check the following list:

  • Does the affected code have corresponding tests, e.g. unit test, E2E test?
  • Does this change require a documentation update?
  • Does this introduce breaking changes that would require an announcement or bumping the major version?
  • Do all new files have an appropriate license header?

@codecov

codecov Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 82.14286% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 57.37%. Comparing base (8d737cd) to head (e1146e1).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
cmd/oras/root/manifest/fetch_config.go 81.48% 5 Missing and 5 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2222      +/-   ##
==========================================
+ Coverage   56.21%   57.37%   +1.15%     
==========================================
  Files         139      139              
  Lines        6021     6067      +46     
==========================================
+ Hits         3385     3481      +96     
+ Misses       2427     2364      -63     
- Partials      209      222      +13     

☔ 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.

Comment thread cmd/oras/root/manifest/fetch_config.go Resolved
Comment thread cmd/oras/root/manifest/fetch_config.go Resolved
Comment thread cmd/oras/root/manifest/fetch_config.go Resolved
@TanvirTian
TanvirTian force-pushed the fix/config-size-limit branch from 64393f8 to a2fc97a Compare October 4, 2026 21:08
@TanvirTian
TanvirTian force-pushed the fix/config-size-limit branch from a2fc97a to f1ea607 Compare October 4, 2026 21:31
Comment thread cmd/oras/root/manifest/fetch_config.go Resolved
Comment thread cmd/oras/root/manifest/fetch_config.go Resolved
Comment thread cmd/oras/root/manifest/fetch_config.go Resolved
Comment thread cmd/oras/root/manifest/fetch_test.go Resolved
@TanvirTian
TanvirTian force-pushed the fix/config-size-limit branch from 5f50f9d to f5c301c Compare October 5, 2026 16:32
Comment thread cmd/oras/root/manifest/fetch_config.go Resolved
Comment thread cmd/oras/root/manifest/fetch_config.go Resolved
Comment thread cmd/oras/root/manifest/fetch_config.go Resolved
@TanvirTian
TanvirTian force-pushed the fix/config-size-limit branch from f5c301c to c966612 Compare October 5, 2026 21:32
@TanvirTian
TanvirTian force-pushed the fix/config-size-limit branch from c966612 to 8ba112c Compare October 5, 2026 21:43
@TerryHowe

Copy link
Copy Markdown
Member

Hmm, I didn't notice codecov failing before.

@TanvirTian

Copy link
Copy Markdown
Contributor Author

Hmm, I didn't notice codecov failing before.

i ddint notice it failing either 😿

@TanvirTian

Copy link
Copy Markdown
Contributor Author

finally 🐱

Comment thread cmd/oras/root/manifest/fetch_config.go Resolved
Comment thread cmd/oras/root/manifest/fetch_config.go Resolved
Comment thread cmd/oras/root/manifest/fetch_config.go Resolved
Comment thread cmd/oras/root/manifest/fetch_test.go Resolved
Comment thread cmd/oras/root/manifest/index/create.go Resolved
@TanvirTian
TanvirTian force-pushed the fix/config-size-limit branch from bdbbb0f to e1146e1 Compare October 6, 2026 18:02
@TanvirTian

Copy link
Copy Markdown
Contributor Author

Updated the error message, set the file permissions to 0644 right after Verify(), and added validation to reject --pretty with --output - and also updated the related tests

Hope it’s good to go now

@TerryHowe TerryHowe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/lgtm

@TerryHowe

Copy link
Copy Markdown
Member

Thanks!

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.

oras manifest fetch-config uses too much memory for large config files

2 participants