Open hf-13 opened 1 day ago
I found a similar issue related to HTML rendering in Superset. The issue of improper input validation and sanitization, which can affect how HTML tags are handled, was discussed in this closed issue. The suggested solution involved implementing a Content Security Policy (CSP) using the Talisman extension to mitigate XSS attacks by specifying valid sources for executable scripts.
In your case, since you are trying to render the <br>
tag in query results, you have already attempted to extend the HTML sanitization schema to include the br
tag. However, it seems that the sanitization process might still be stripping it out.
Here are a few things you can try:
Verify HTML Sanitization Settings: Ensure that your HTML_SANITIZATION_SCHEMA_EXTENSIONS
is correctly configured to allow the br
tag. It seems you have already done this, but double-checking might help.
Frontend Configuration: Check if the frontend configuration allows HTML rendering. The ResultSet
component in Superset's frontend has a property allowHTML
that controls HTML rendering in query results. This is set based on a local storage key LocalStorageKeys.SqllabIsRenderHtmlEnabled
, which defaults to true
[1].
Test HTML Rendering: You can test if the HTML rendering is working by checking the ResultSet
component's behavior. If the allowHTML
flag is set to true, it should render HTML content.
Review HTML Sanitization Tests: Superset includes tests for HTML sanitization, such as sanitizeHtml
and sanitizeHtmlIfNeeded
, which ensure that HTML content is handled safely [2]. Reviewing these tests might provide insights into how HTML tags are processed.
If these steps do not resolve the issue, it might be worth investigating further into the frontend code to ensure that the allowHTML
setting is correctly applied and that no other configurations are overriding your settings.
To continue talking to Dosu, mention @dosu.
Bug description
Description
When running a SQL query that includes an HTML
<br>
tag, Superset is not rendering the tag as expected. Instead, it's being stripped from the output.Steps to Reproduce
<br>
tag and subsequent text removed.Configuration Attempted
The following configuration has been applied in a Kubernetes deployment using Helm:
It all was confirmed with
superset shell
Additional Information
TALISMAN_ENABLED = False
).Environment
Question
Is there a way to configure Superset to properly render HTML tags, specifically the
<br>
tag, in query results while maintaining security?Screenshots/recordings
No response
Superset version
4.1.0
Python version
3.10
Node version
16
Browser
Chrome
Additional context
No response
Checklist