libsir
libsir copied to clipboard
Need a way to sanitize logged output
Looking at output of the Ch demo:
(note this particular mobile terminal application doesn't support underlining)
We should really provide a way to sanitize the output, especially if logging from untrusted sources, where ANSI escapes or other terminal sequences could potentially create vulnerabilities.
I think that stripping ANSI escape sequences, while potentially complicated, is probably going to be required, along with an option to also strip the high bits completely.
This filtering would best be handled with per-output granularity, because plugins may want to handle unmolested messages, or you might wish to strip the high bits when logging to files, but not in some cases where you know you'll be expecting non-ASCII text, yet stripping ANSI escapes might still be requested.
@aremmell, any ideas on how to best implement this?