dongjoon-hyun opened a new pull request, #57290:
URL: https://github.com/apache/spark/pull/57290

   ### What changes were proposed in this pull request?
   
   Escape the executor removal reason in `executorspage.js` by reusing the 
existing
   `escapeHtml` helper from `utils.js`.
   
   `formatLossReason` is the DataTables `render` callback for the `removeReason`
   column and returned the value unchanged. DataTables assigns the `render` 
output
   to the cell's `innerHTML`, so the reason was parsed as markup.
   
   This is a follow-up to SPARK-58156, which fixed the timeline tooltip surface 
of
   the same field. `executorspage.js` was out of scope there.
   
   ### Why are the changes needed?
   
   The removal reason carries strings that originate outside the driver: 
executor-side
   exception messages via `CoarseGrainedExecutorBackend`, YARN container 
diagnostics,
   K8s pod status messages, and Standalone worker exceptions. They converge on
   `ExecutorLossReason.message` and reach the UI through
   `SparkListenerExecutorRemoved`.
   
   A reason such as `"><img src=x onerror=alert(1)>` injects a tag into the 
Executors
   table. The default CSP set by `HttpSecurityFilter` blocks the inline handler 
from
   running, so this is defense-in-depth rather than a directly exploitable XSS. 
It
   still matters when CSP is disabled, and because the reason is persisted to 
the
   event log and replayed by the History Server, which may render one user's
   application to an administrator.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. In the Executors page, a removal reason containing HTML metacharacters 
is now
   displayed literally as text instead of being interpreted as markup. Other 
reasons
   are unaffected.
   
   ### How was this patch tested?
   
   Added `ui-test/tests/executorspage.test.js`: a unit test on 
`formatLossReason`, and
   an integration test that drives the real bundled DataTables and asserts no 
element
   is injected into the cell. Both fail when the escaping is reverted.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Opus 4.8


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to