From 424fe9991b5ad61422ca5d1b0ff9b8e01465e6f5 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 9 Jun 2026 06:21:15 +0530 Subject: [PATCH] Sanitise color control responses for shells that still dont use the kitty keyboard protocol --- kitty/window.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kitty/window.py b/kitty/window.py index dd3f79eaf..0b6e56956 100644 --- a/kitty/window.py +++ b/kitty/window.py @@ -551,6 +551,8 @@ def color_control(cp: ColorProfile, code: int, value: str | bytes | memoryview = if isinstance(value, (bytes, memoryview)): value = str(value, 'utf-8', 'replace') responses: dict[str, str] = {} + # Only printable ASCII payload allowed as it is echoed back + value = re.sub(r'[^ -~]', '', value) for rec in value.split(';'): key, sep, val = rec.partition('=') if key.startswith('transparent_background_color'):