Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace line-feed with comma plus space in message #41

Merged
merged 1 commit into from
Sep 28, 2024

Conversation

alimirjamali
Copy link
Contributor

@@ -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]])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think simply allowing newlines in an exception message is a good idea. Depending on what applications will do with that, it may mess with formatting, or even allow injecting something. This is especially important since it's about a message received from a VM - that's why it's sanitized after all.
Maybe better to replace disallowed chars with something (we use "_" for that in several places) instead of just removing them? Or replace newline specifically with a coma?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or replace newline specifically with a coma?

Very well said. But coma+space (or semicolon+space.). Amendment will follow shortly.

@alimirjamali alimirjamali force-pushed the Issue-5701 branch 3 times, most recently from 866047e to 9264727 Compare September 27, 2024 05:13
@alimirjamali alimirjamali changed the title Allow Line Feed & Carriage Return as safe chars Replace line-feed with comma plus space in message Sep 27, 2024
@alimirjamali
Copy link
Contributor Author

@marmarek This is fixed as advised. The last force-push was to change the commit message

qubesusbproxy/core3ext.py Outdated Show resolved Hide resolved
@marmarek marmarek merged commit 7daba26 into QubesOS:main Sep 28, 2024
1 of 2 checks passed
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.

Missing newline in qvm-usb timeout output
2 participants