Skip to content

fix: set max decompressed size for elements JSON#4244

Merged
qued merged 8 commits intomainfrom
fix/defuse-decompression-bomb
Feb 19, 2026
Merged

fix: set max decompressed size for elements JSON#4244
qued merged 8 commits intomainfrom
fix/defuse-decompression-bomb

Conversation

@qued
Copy link
Copy Markdown
Contributor

@qued qued commented Feb 18, 2026

Sets a max size on the decompressed version of an elements JSON. A quite large JSON from a 1225 page document is 5MB, for reference. One place we still might run into headroom issues is if a JSON from a quite large document included embedded digital images.

The result of a JSON being too large, is that the decompressed version will not parse, as the tail will be left off. Part of the review should be to determine whether this is an acceptable failure mode.


Note

Medium Risk
Touches deserialization of compressed element payloads, which can affect ingestion/round-tripping for large documents and changes the failure mode to explicit exceptions when limits are hit.

Overview
Adds a hard cap (MAX_DECOMPRESSED_SIZE, default 200MB) when inflating base64+gzipped elements JSON in elements_from_base64_gzipped_json, preventing unbounded memory/disk blowups; decompression now explicitly fails with DecompressedSizeExceededError (new) when the limit is hit, or zlib.error when the payload is incomplete/corrupt.

Bumps version to 0.20.7, updates the changelog, and adds targeted tests covering normal round-trip, incomplete streams, and size-limit exceedance (via patching the max size).

Written by Cursor Bugbot for commit a5e5256. This will update automatically on new commits. Configure here.

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

badGarnet
badGarnet previously approved these changes Feb 19, 2026
lawrence-u10d
lawrence-u10d previously approved these changes Feb 19, 2026
@qued qued added this pull request to the merge queue Feb 19, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Feb 19, 2026
@qued qued dismissed stale reviews from lawrence-u10d and badGarnet via a5e5256 February 19, 2026 19:24
@qued qued enabled auto-merge February 19, 2026 19:25
@qued qued added this pull request to the merge queue Feb 19, 2026
Merged via the queue into main with commit c6c7462 Feb 19, 2026
52 checks passed
@qued qued deleted the fix/defuse-decompression-bomb branch February 19, 2026 20:29
aadland6 pushed a commit that referenced this pull request Feb 19, 2026
Sets a max size on the decompressed version of an elements JSON. A quite
large JSON from a 1225 page document is 5MB, for reference. One place we
still might run into headroom issues is if a JSON from a quite large
document included embedded digital images.

The result of a JSON being too large, is that the decompressed version
will not parse, as the tail will be left off. Part of the review should
be to determine whether this is an acceptable failure mode.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Touches deserialization of compressed element payloads, which can
affect ingestion/round-tripping for large documents and changes the
failure mode to explicit exceptions when limits are hit.
> 
> **Overview**
> Adds a hard cap (`MAX_DECOMPRESSED_SIZE`, default 200MB) when
inflating base64+gzipped elements JSON in
`elements_from_base64_gzipped_json`, preventing unbounded memory/disk
blowups; decompression now explicitly fails with
`DecompressedSizeExceededError` (new) when the limit is hit, or
`zlib.error` when the payload is incomplete/corrupt.
> 
> Bumps version to `0.20.7`, updates the changelog, and adds targeted
tests covering normal round-trip, incomplete streams, and size-limit
exceedance (via patching the max size).
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
a5e5256. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
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