Skip to content

Commit ad90195

Browse files
committed
[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 #36902 from srowen/LogViewEscape. Authored-by: Sean Owen <srowen@gmail.com> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
1 parent 4c4efdc commit ad90195

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • core/src/main/resources/org/apache/spark/ui/static

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)