From 50ccbfc9f459eb5a9837703de65b6c5c2ef04c55 Mon Sep 17 00:00:00 2001 From: Ali Mirjamali Date: Sat, 31 Aug 2024 16:32:43 +0330 Subject: [PATCH] Allow Line Feed & Carriage Return as safe chars resolves: https://github.com/QubesOS/qubes-issues/issues/5701 --- qubesusbproxy/core3ext.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/qubesusbproxy/core3ext.py b/qubesusbproxy/core3ext.py index 799bff6..a5ab155 100644 --- a/qubesusbproxy/core3ext.py +++ b/qubesusbproxy/core3ext.py @@ -642,9 +642,10 @@ async def on_device_attach_usb(self, vm, event, device, options): else: # TODO: sanitize and include stdout sanitized_stderr = ''.join( - [chr(c) for c in e.stderr if 0x20 <= c < 0x80]) + [chr(c) for c in e.stderr if 0x20 <= c < 0x80 + or c in [0x0A, 0x0D]]) raise QubesUSBException( - 'Device attach failed: {}'.format(sanitized_stderr)) + 'Device attach failed:\n{}'.format(sanitized_stderr)) finally: modify_qrexec_policy('qubes.USB+{}'.format(device.ident), policy_line, False)