Repository navigation
fix: apply the input size limit to multiline input - #178
Open
ferdingler wants to merge 1 commit into
Open
ferdingler wants to merge 1 commit into
ferdingler wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
Description
The input size limit only worked for single-line input. When the input had more than one line, the shell checked each line on its own, so a large multiline command went through as long as no single line was over the limit.
Now the limit applies to the whole input before it runs, the same way it already did for one line. This is a behaviour change: multiline input over the limit that used to run is now refused with the same error as an oversized single line. With the default 1 MiB limit that should only affect very large scripts sent in one go, for example over the WASM module's stdin or as one MCP call. Scripts loaded with
sourceare not affected.I added a regression test with a small limit. On main a three-line input over the limit ran fine; with the change it's refused, and a short multiline input still runs. One existing test for the limit inside command substitutions had been relying on this gap to get its input past the top-level check, so I changed it to reach the same path through a sourced script instead. It still checks the same thing, and it passes on main and with the change. Everything else passed.
Related Issues
None
Documentation PR
None
Type of Change
Bug fix
Testing
How have you tested the change? Verify that the changes do not break functionality or introduce new warnings.
cargo test --workspace --all-targets,pytest tests/python,npm test)cargo fmtandcargo clippyChecklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.