Skip to content

fix: sanitize untrusted terminal output to prevent escape sequence injection#240

Draft
bukinoshita wants to merge 1 commit intomainfrom
fix/terminal-escape-injection-8ddb
Draft

fix: sanitize untrusted terminal output to prevent escape sequence injection#240
bukinoshita wants to merge 1 commit intomainfrom
fix/terminal-escape-injection-8ddb

Conversation

@bukinoshita
Copy link
Copy Markdown
Member

@bukinoshita bukinoshita commented Apr 9, 2026

Summary by cubic

Sanitizes all untrusted interactive CLI output to block ANSI/OSC escape sequence injection (BU-650). Adds a shared safeTerminalText helper and applies it across webhooks, emails receiving, tables, and all interactive get commands.

  • Bug Fixes
    • Added safeTerminalText to strip ANSI/VT and dangerous control chars (keeps tabs/newlines).
    • Applied to: webhooks listen (type/resourceId/detail), table renderer (all cells), emails receiving listen, and all get commands.
    • JSON/pipe mode unchanged.

Written for commit 5f04f30. Summary will update on new commits.

…jection

Add safeTerminalText utility that strips ANSI/VT control sequences and
dangerous C0 control characters from untrusted data before rendering to
the terminal in interactive mode.

Applied to:
- webhooks listen: sanitize type, resourceId, and detail from webhook payloads
- table renderer: sanitize all cell contents in renderTable
- All get commands: sanitize API-returned fields in interactive output
- emails receiving listen: sanitize inbound email fields

JSON/pipe mode is unaffected since it uses JSON.stringify which escapes
control bytes.

Co-authored-by: Bu Kinoshita <bukinoshita@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants