Skip to content

Commit 37dbf1c

Browse files
srowendongjoon-hyun
authored andcommitted
[SPARK-39505][UI] Escape log content rendered in UI
### What changes were proposed in this pull request? Escape log content rendered to the UI. ### Why are the changes needed? Log content may contain reserved characters or other code in the log and be misinterpreted in the UI as HTML. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Existing tests Closes apache#36902 from srowen/LogViewEscape. Authored-by: Sean Owen <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
1 parent 9cc7cdc commit 37dbf1c

File tree

1 file changed

+2
-2
lines changed
  • core/src/main/resources/org/apache/spark/ui/static

1 file changed

+2
-2
lines changed

core/src/main/resources/org/apache/spark/ui/static/log-view.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ function loadMore() {
8585
if (retStartByte == 0) {
8686
disableMoreButton();
8787
}
88-
$("pre", ".log-content").prepend(cleanData);
88+
$("pre", ".log-content").prepend(document.createTextNode(cleanData));
8989

9090
curLogLength = curLogLength + (startByte - retStartByte);
9191
startByte = retStartByte;
@@ -115,7 +115,7 @@ function loadNew() {
115115
var retLogLength = dataInfo[2];
116116

117117
var cleanData = data.substring(newlineIndex + 1);
118-
$("pre", ".log-content").append(cleanData);
118+
$("pre", ".log-content").append(document.createTextNode(cleanData));
119119

120120
curLogLength = curLogLength + (retEndByte - retStartByte);
121121
endByte = retEndByte;

0 commit comments

Comments
 (0)