fix: sanitize interactive terminal output to prevent escape injection#228
Draft
bukinoshita wants to merge 2 commits intomainfrom
Draft
fix: sanitize interactive terminal output to prevent escape injection#228bukinoshita wants to merge 2 commits intomainfrom
bukinoshita wants to merge 2 commits 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>
Member
Author
|
@cursor fix conflict |
|
The PR description was auto-generated by cubic and will update on new commits. The conflict is resolved, so no need to update the PR description. Resolved the merge conflict by accepting |
Accept main's safe-terminal-text implementation (stripVTControlCharacters + deepSanitize) and revert redundant per-file sanitization in command files since deepSanitize is now applied centrally in actions.ts. Retain error message sanitization in output.ts as the sole remaining addition over main. 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. 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.