opcodesio / log-viewer

Fast and beautiful Log Viewer for Laravel
https://log-viewer.opcodes.io
MIT License
3.49k stars 250 forks source link

Newlines to <br> lost in context ouput #284

Closed GavG closed 11 months ago

GavG commented 12 months ago

The prepareContextForOutput method translates newlines to
tage for display.

https://github.com/opcodesio/log-viewer/blob/main/resources/js/components/BaseLogTable.vue#L193

However, the output is then passed through the highlightSearchResult method:

https://github.com/opcodesio/log-viewer/blob/main/resources/js/helpers.js#L16

Which calls escapeHtml, escaping any added \<br> tags.

I suspect an additional,:

.replace(/&lt;br\/&gt;/g, '<br/>');

Call might solve the issue, I can't forsee this opening up an XSS vector.

GavG commented 11 months ago

Addressing in the above PR: https://github.com/opcodesio/log-viewer/pull/285

arukompas commented 11 months ago

Thanks a lot for the report and the fix @GavG 💪 tagged a new release, v3.1.5