Skip to content

Cap remote changelog body at 1 MiB in FetchAndParse#3

Merged
andrew merged 1 commit into
mainfrom
fix/fetch-size-limit
May 2, 2026
Merged

Cap remote changelog body at 1 MiB in FetchAndParse#3
andrew merged 1 commit into
mainfrom
fix/fetch-size-limit

Conversation

@andrew
Copy link
Copy Markdown
Contributor

@andrew andrew commented May 2, 2026

FetchAndParse previously read the entire HTTP response into memory with io.ReadAll(resp.Body). A repository owner could serve an arbitrarily large changelog and cause the caller to allocate unbounded memory.

This wraps the body in io.LimitReader capped at 1 MiB, matching the existing size heuristic in FindChangelog. Adds a test that serves a 2 MiB body via httptest.NewServer and verifies the parser receives at most 1 MiB.

@andrew andrew merged commit e7ab939 into main May 2, 2026
2 checks passed
@andrew andrew deleted the fix/fetch-size-limit branch May 2, 2026 16:01
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.

1 participant