Skip to content

fix: enforce size limit on individual files in build_bundle() - #3911

Open
Quratulain-bilal wants to merge 2 commits into
github:mainfrom
Quratulain-bilal:fix/bundle-unbounded-read
Open

fix: enforce size limit on individual files in build_bundle()#3911
Quratulain-bilal wants to merge 2 commits into
github:mainfrom
Quratulain-bilal:fix/bundle-unbounded-read

Conversation

@Quratulain-bilal

Copy link
Copy Markdown
Contributor

Problem

build_bundle() called read_bytes() without any size guard. A single large asset file could exhaust memory.

Fix

Enforce MAX_ZIP_MEMBER_BYTES (10 MiB) limit before reading each file.

Testing

  • Verified normal files are packaged correctly
  • Verified oversized files are rejected

@Quratulain-bilal
Quratulain-bilal requested a review from mnriem as a code owner July 31, 2026 12:57

@mnriem mnriem left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please resolve conflicts

build_bundle() called read_bytes() without any size guard. A single
large asset file could exhaust memory. Enforce MAX_ZIP_MEMBER_BYTES
(10 MiB) limit before reading.
Enforce MAX_ZIP_MEMBER_BYTES (10 MiB) limit before reading each file
via os.fstat() on the same file descriptor used for reading, avoiding
a TOCTOU gap between stat() and read_bytes().

Add regression tests: oversized file (>limit) is rejected, file at
exact limit is accepted.

Co-authored-by: GitHub Copilot (model: mimo-v2.5-free, supervised)
@Quratulain-bilal
Quratulain-bilal force-pushed the fix/bundle-unbounded-read branch from 0724b00 to 9f59bfb Compare August 10, 2026 21:38
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.

2 participants