Repository navigation
Conversation
Short request inputs could make one render allocate gigabytes: an icon placeholder repeat count, tooltip padding, inventory rows and columns, scene scale and offsets, a huge-exponent JSON number, and content template fills all lacked an upper bound. - Add RenderLimits, a canvas and animation pixel budget checked before every canvas allocation (tooltip, inventory, container, HUD, scene, glint, composite). Limits are system properties. - Clamp icon repeat counts to 100 and tooltip padding to 255. - Cap inventories at 64 rows and 64 slots per row. - Reject JSON number literals over 64 characters or with an exponent over 400, so error messages no longer expand them. - Cap scene scale, margin, spacing, columns, gui_width and offsets. - Cap the output of one content template fill.
Aerhhh
force-pushed
the
security/input-clamps-pixel-budget
branch
from
November 21, 2026 00:34
a2a574b to
26e7864
Compare
This was referenced Nov 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
A security review found that several short, untrusted inputs could make a single render allocate gigabytes and take down the host JVM. Four were reproduced against
masterwith a 1 GB heap:master%%dot:5000000%%OutOfMemoryErrorpadding=8000OutOfMemoryErrorOutOfMemoryError, thrown raw on the caller's thread{"schema_version":1e400000000,...}What changed
RenderLimits(new): a canvas and animation pixel budget checked before every canvas allocation: tooltip, inventory, container, HUD, scene compositor, glint effect and theGeneratorImageBuildercomposites. Over budget fails withGeneratorValidationException. Both limits are system properties (generator.render.maxCanvasPixels, default 25M;generator.render.maxAnimationPixels, default 400M).IllegalArgumentException.InventoryRequestand the generator builder; the canvas is also budget-checked.StrictJson: number literals over 64 characters or with an exponent over 400 are rejected at read time, so error messages no longer expand them.scaleat most 16;margin,spacing,columns,gui_widthandat/offsetvalues at most 4096.fillproduces at most 1,000,000 characters and nodes of output.Behaviour changes to be aware of
Testing
RenderLimitsTest(11 tests) covers each case above.generatorsuite: 1579 run, 1578 pass. The one error,DisplayToolTest.enchantedRenderIsAnimated, hit the library's 20 s render timeout on a loaded machine. It passes on this branch when run alone and fails the same way on unmodifiedmasterunder the same load.toolingmodule is untouched and was not run.Not in this PR
The review's other findings (timeout not cancelling work, resource-pack size values that bypass
PackLimits, plain-HTTP skin fetch, dependency and CI hardening) are separate follow-ups.