cashapp / logquacious

Logquacious (lq) is a fast and simple log viewer.
Apache License 2.0
59 stars 14 forks source link

Sanitize More HTML Outputs #152

Closed jonwinton closed 3 years ago

jonwinton commented 3 years ago

Purpose

This PR aims to fix a problem we ran into where HTML in a log broke the page because it wasn't escaped. Here's an example:

Screen Shot 2021-02-05 at 1 56 57 PM

The black section is the hover styling for the log, but it shows that there's a CSS declaration setting the body background to white.

Changes

It turns out we render the log content in a few places, so this just touched up a couple of the places we could render HTML to sanitize it all.

Screen Shot 2021-02-05 at 2 03 30 PM Screen Shot 2021-02-05 at 2 03 46 PM

After adding the existing HTML escape function the UI is fixed: Screen Shot 2021-02-05 at 1 58 34 PM

Testing

I added a very simple HTML output that is a toned down version of what we saw in our logging cluster so that any future HTML logs will be caught.