Repository navigation
Prevent Unicode bidirectional controls in terminal output - #65
Merged
Merged
Conversation
Contributor
Author
|
Hi! I noticed that the Proofline gate check failed because my account doesn't have a Proofline seat assigned. Since I'm contributing as an external contributor, could you clarify whether a seat is required for community contributions, and if there's anything I need to do to get the check running? Thanks! |
mohsen1
approved these changes
Nov 17, 2026
mohsen1
left a comment
Member
There was a problem hiding this comment.
Codex
Reviewed the narrow terminal-output change. Corrected formatting; check and windows now pass on this head. Ordinary Unicode remains intact.
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.
Problem
The
terminal_safefunction prevents terminal control characters from reaching the terminal by replacing characters recognized by Rust'schar::is_control().However, Unicode bidirectional formatting characters are not covered by this check. Characters such as Right-to-Left Override (
U+202E) can change the visual ordering of terminal output without changing the underlying string.This creates a potential security issue when displaying untrusted repository paths, filenames, or server-provided text. A malicious filename could appear different from its actual name, misleading users reviewing CLI output.
Approach
Extend the existing terminal sanitization logic to recognize the Unicode Bidirectional_Control characters:
U+061CU+200E–U+200FU+202A–U+202EU+2066–U+2069Replace these characters with the Unicode replacement character (
U+FFFD), following the existing sanitization strategy.This keeps the change localized to
src/text.rsand automatically protects existing callers ofterminal_safeandone_line.Ordinary Unicode text remains unaffected.
Verification
The following tests are included:
U+202E) replacement.U+2066,U+2069).Run the tests with:
cargo test text::testsRun the complete test suite with:
cargo testScope