Repository navigation
security: enable Jinja2 autoescape to prevent XSS in HTML reprs - #12423
Conversation
Unit Test ResultsSee test report for an extended history of previous test failures. This is useful for diagnosing flaky tests. 25 files ± 0 25 suites ±0 6h 58m 40s ⏱️ - 6m 22s Results for commit 487e742. ± Comparison against base commit a0856a0. ♻️ This comment has been updated with latest results. |
Signed-off-by: Security Researcher <[email protected]>
|
Hi maintainers, I checked the remaining failing check. The PR-specific jobs are green (pre-commit, build, docs, codecov, and the main test matrix). The only red job is the That looks unrelated to this Jinja2 autoescape/XSS change, which only touches HTML rendering/templates. Happy to adjust anything in this PR if reviewers spot a direct issue, but I don't think the nightly failure is caused by this patch. |
|
Thank you! |
|
The PR broke distributed widgets; everything that was consciously building nested structures by injecting HTML from a widget into another widget started outputting text More importantly, it broke all third-party widgets that install themselves in dask.widgets.TEMPLATE_PATHS. I cannot see a soft way to do a transition. |



This PR fixes a cross-site scripting (XSS) vulnerability in dask HTML widgets.
CWE: CWE-79 (Cross-site Scripting)
File: dask/widgets/widgets.py
The Jinja2 Environment used for rendering HTML representations (repr_html) did not have �utoescape enabled. User-influenceable strings such as dask graph layer names, task keys, and dependency names were rendered as raw HTML. A malicious actor could craft a dask graph with keys containing HTML/JS payloads (e.g., <img src=x onerror=alert(1)>), and when another user views the object in Jupyter, the payload executes.
Fix:
Templates updated: