Repository navigation
fix(console): render log output as text instead of html - #16
Merged
Merged
Conversation
Add vitest and jsdom as dev dependencies, a test script and a vitest config that runs the suite in a jsdom environment. The first test suite lands with the console escaping fix.
The console rendered each log line with v-html after escaping only < and >, so any character that is significant inside an attribute value was passed through unchanged. Log lines carry request paths and other server-side input, so that was an incomplete escape on an injection sink. Log lines are now parsed into plain text segments with a fixed set of style classes, and the view renders them with interpolation. No markup is built from log text, and interpolation escapes & < > " ' itself. The ansi-to-html dependency is dropped because the small SGR parser covers the codes the server emits.
5 of 7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The dashboard console rendered every log line with
v-htmlafter escaping only<and>. Characters that are significant inside an attribute value passed through unchanged. Log lines carry request paths and other server-side input, so this was an incomplete escape on an HTML injection sink.This change parses log lines into plain text segments with a fixed set of style classes, and the view renders them with interpolation. No markup is built from log text, and Vue interpolation escapes
&,<,>,"and'itself. Theansi-to-htmldependency is dropped, because a small SGR parser covers the codes the server emits.Also included: a vitest and jsdom setup for the frontend (first suite lands with this fix) and a one-character style fix in the artifact snippet.
Intended for the 1.1.1 patch release.
Type of change
fix- bug fixfeat- new featurerefactor- internal change without behaviour changeperf- performance improvementdocs- documentation onlytest- tests onlybuild/ci/chore- tooling, dependencies, pipelinesHow was this tested?
Targeted run locally:
ansi.test.js(vitest, jsdom): the SGR parser and the text segmentation, including markup-like input in log lines, which must come out as literal text.The full suite runs in CI.
Checklist
CLAUDE.md(English, imperative, one offeat,fix,docs,refactor,test,build,ci,chore,perf)./gradlew buildpasses locally