fix: Limit explore search query length to keep TUI responsive#18251
Merged
fdncred merged 2 commits intoMay 20, 2026
Conversation
Automated security fix generated by OrbisAI Security
Contributor
|
Can you place a comment above the line explaining why it's limiting a search to less than 256 chars? |
Add comments to clarify interactive search input behavior.
Contributor
Author
|
Thanks, added a comment explaining the 256-character cap. I’ve framed it as an interactive responsiveness guard rather than relying on a specific regex-engine failure mode: search filtering is applied on every keystroke, so bounding the query prevents pathological or accidental very-long inputs from making the TUI sluggish. Happy to adjust the wording or the limit if you prefer a different threshold. |
Contributor
|
Thanks |
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.
Summary
This adds a small upper bound to the interactive explore search query.
The search filter is re-applied on each typed character, so extremely long search input can cause unnecessary repeated work and make the TUI feel sluggish. This caps the query length at 256 characters as a defensive responsiveness guard.
This is not intended to change normal search behaviour; 256 characters should be well above typical interactive search usage.
Description: User keystrokes captured in tui.rs:112 via handle_search_input are passed directly to apply_search_filter() in app.rs:194 without confirmed input validation, length limits, or debouncing. If apply_search_filter() compiles user input as a regular expression (a common pattern in TUI search implementations), adversarial inputs containing catastrophic backtracking patterns (e.g., (a+)+ against a non-matching string) can cause the Rust regex engine to consume 100% CPU, freezing the TUI. This is a Regular Expression Denial of Service (ReDoS) vulnerability. Confidence is medium because the code structure confirms the unsanitized input flow, though the exact filter implementation requires verification.
Changes
crates/nu-explore/src/explore_config/input.rsVerification
Automated security fix by OrbisAI Security