Repository navigation
fix(jq): bound stream event traversal and allocation - #2621
Merged
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | a6cd92d | Commit Preview URL Branch Preview URL |
Oct 08 2026, 01:38 AM |
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.
What changed
jq --streamnow produces one path event at a time with shared ancestor key strings. Traversal state, event arrays, and--slurpretention are checked against the live-memory meter before allocation. Every traversal step consumes shared work and checks cancellation/deadlines, including with a non-emitting filter.Why
Compact JSON could multiply long ancestor keys into a retained list of events before jq installed its memory meter. A script such as
jq --stream empty /input.jsontherefore bypassed the intermediate-memory limit. This fixes Codex Security findingcommit:1e898b2a69508191a49db08b6c85349e.Before / After
Executed safely through
Bash::exec/ VFS andexec_with_options:jq: error: value size limit (32768 bytes) exceeded. A subsequent shell request succeeds.--stream --slurp empty: before exit 0, after exit 5 with the configured value-size limit.inputsconsumption retain jq behavior.These are bounded regressions; no host-OOM test was attempted.
Risk
Medium: input conversion and slurp now occur inside metered evaluation. Inputs exceeding the configured live-memory allowance fail cleanly. Input-depth restrictions and existing jq output/recursion protections remain enforced.
Validation
just bench: 96 cases, zero errors, 100% Bash output match.threat_model_tests::nesting_depth_security::misconfig_huge_ast_depth_still_safeon macOS. The same exact test also aborts on unmodified current mainf286bf332c6eadcda068c645077432d7da7f729dwith the same feature set. It parses nested Bashifstatements and never invokes jq. No test was disabled and no stack limit was raised. Full CI is required before merge.Checklist