Skip to content

Commit 9f3c6a3

Browse files
sarutakdongjoon-hyun
authored andcommitted
[SPARK-54624][UI] Ensure user name in historypage get escaped
### What changes were proposed in this pull request? This PR aims to escape user name displayed in historypage. ### Why are the changes needed? Similar to the issue resolved in #52851, user name should also get escaped because arbitrary user name can be set through the env var `SPARK_USER`. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? User name displayed in historypage is escaped even if the name is like `<script>alert('XSS')</script>` ### Was this patch authored or co-authored using generative AI tooling? No. Closes #53364 from sarutak/fix-username-xss. Authored-by: Kousuke Saruta <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
1 parent 59fcc0f commit 9f3c6a3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

core/src/main/resources/org/apache/spark/ui/static/historypage.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,11 @@ $(document).ready(function() {
216216
data: 'duration',
217217
render: (id, type, row) => `<span title="${row.durationMillisec}">${row.duration}</span>`
218218
},
219-
{name: 'user', data: 'sparkUser' },
219+
{
220+
name: 'user',
221+
data: 'sparkUser',
222+
render: (name) => escapeHtml(name)
223+
},
220224
{name: 'lastUpdated', data: 'lastUpdated' },
221225
{
222226
name: 'eventLog',

0 commit comments

Comments
 (0)