fix: sanitize interactive terminal output to prevent escape injection#228
Draft
bukinoshita wants to merge 1 commit intomainfrom
Draft
fix: sanitize interactive terminal output to prevent escape injection#228bukinoshita wants to merge 1 commit intomainfrom
bukinoshita wants to merge 1 commit intomainfrom
Conversation
Add safeTerminalText utility that strips C0/C1 control characters and escape sequences from untrusted strings before rendering them to the terminal in interactive mode. Apply sanitization to: - renderTable (table.ts) - all cell contents - contacts get/create - email, name, properties, id - topics get/create - name, description, id - segments get/create - name, id - outputError (output.ts) - error messages Preserves newlines, tabs, and carriage returns (\n, \t, \r) while escaping all other C0 controls (0x00-0x08, 0x0B, 0x0C, 0x0E-0x1F), DEL (0x7F), and C1 controls (0x80-0x9F). JSON output is unaffected as JSON.stringify already escapes control characters. Resolves BU-657 Co-authored-by: Bu Kinoshita <bukinoshita@users.noreply.github.com>
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 by cubic
Sanitizes interactive terminal output to block escape-sequence injection, fixing Linear BU-657. Untrusted strings now escape C0/C1 control chars (except \n, \r, \t) so terminals can’t be manipulated.
safeTerminalTextto replace control chars with\uXXXXwhile preserving\n,\r,\t.Written for commit a91b35b. Summary will update on new commits.