-
Notifications
You must be signed in to change notification settings - Fork 3.4k
hubble: escape terminal special characters from observe output #37401
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
hubble: escape terminal special characters from observe output #37401
Conversation
03c1938
to
511ad4f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add a set of test that actually tests this with each output format to ensure it works when combined with the rest of the code. So basically an e2e test of sorts.
I can add unit tests that use Printer directly and write each supported types containing control sequences and colorized fields. |
Escape special characters from `hubble observe` output when not using JSON formatting to protect against possible malicious character injection. Similar to: kubernetes/kubernetes#101695 Similar to: python/cpython#100001 Signed-off-by: Alexandre Barone <abalexandrebarone@gmail.com>
511ad4f
to
e478216
Compare
I updated existing printer tests to add entries for each output type and colored/not colored. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @devodev !
/test |
/test |
We might want to add a security label on this PR. |
Escape special characters from
hubble observe
output when not using JSON formatting to protect against possible malicious character injection.This approach escapes characters at the very end, before writing the output to its writer. It also takes care of allowing control characters used to colorize the output. I tried something smart, but we might want to simply escape manually all callsites that may return unsanitized strings before colorizing.
Similar to: kubernetes/kubernetes#101695
Similar to: python/cpython#100001