Skip to content

Conversation

amaannawab923
Copy link
Contributor

@amaannawab923 amaannawab923 commented Jun 17, 2025

SUMMARY

screen-capture.45.webm

Fixes: #33771

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

Copy link

@korbit-ai korbit-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review by Korbit AI

Korbit automatically attempts to detect when you fix issues in new commits.
Category Issue Status
Documentation Missing security and environment documentation ▹ view ✅ Fix detected
Functionality Unreliable HTML Detection ▹ view ✅ Fix detected
Files scanned
File Path Reviewed
superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx

Explore our documentation to understand the languages and file types we support and the files we ignore.

Check out our docs on how you can make Korbit work best for you and your team.

Loving Korbit!? Share us on LinkedIn Reddit and X

Copy link
Contributor

@sadpandajoe Processing your ephemeral environment request here. Action: up. More information on how to use or configure ephemeral environments

Copy link
Contributor

@sadpandajoe Ephemeral environment spinning up at http://35.89.173.179:8080. Credentials are 'admin'/'admin'. Please allow several minutes for bootstrapping and startup.

const getNoResultsMessage = (filter: string) =>
filter ? t('No matching records found') : t('No records found');

const isHtml = (value: any): boolean => {
Copy link
Member

@mistercrunch mistercrunch Aug 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment crafted with Claude ->


Hi @amaannawab923, thanks for working on this fix!

For handling HTML content in table cells, we already have comprehensive HTML utilities available in the codebase that should be used:

📍 HTML Utilities Location: @superset-ui/core/src/utils/html

Key functions available:

  • removeHTMLTags(str) - Strips all HTML tags from a string (useful for getting plain text for context menu operations)
  • sanitizeHtml(htmlString) - Safely sanitizes HTML content using XSS filtering
  • isProbablyHTML(text) - Detects if a string contains valid HTML
  • safeHtmlSpan(possiblyHtmlString) - Returns a safe React component for rendering HTML

The table chart already uses these utilities in superset-frontend/plugins/plugin-chart-table/src/utils/formatValue.ts:54 for sanitizing HTML content when allowRenderHtml is enabled.

For the context menu issue with HTML tags, you might want to use removeHTMLTags() to extract the plain text value for drill-down operations. This is already being done in the drill detail menu items (see
DrillDetailMenuItems.tsx:93).

Example usage:
import { removeHTMLTags } from '@superset-ui/core';

// When handling context menu for HTML cells
const plainTextValue = removeHTMLTags(htmlCellValue);

This approach ensures consistency with how HTML is handled throughout the codebase and maintains proper security sanitization.

@mistercrunch mistercrunch marked this pull request as draft August 12, 2025 20:43
@mistercrunch
Copy link
Member

Converting to draft until adjusted / ready for another round of review

@pull-request-size pull-request-size bot added size/S and removed size/M labels Aug 14, 2025
@amaannawab923
Copy link
Contributor Author

Converting to draft until adjusted / ready for another round of review

Did the changes as per recommendation @mistercrunch

@amaannawab923 amaannawab923 marked this pull request as ready for review August 14, 2025 05:58
@dosubot dosubot bot added the viz:charts:table Related to the Table chart label Aug 14, 2025
Copy link

@korbit-ai korbit-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review by Korbit AI

Korbit automatically attempts to detect when you fix issues in new commits.
Category Issue Status
Security Insufficient HTML Sanitization ▹ view ✅ Fix detected
Files scanned
File Path Reviewed
superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx

Explore our documentation to understand the languages and file types we support and the files we ignore.

Check out our docs on how you can make Korbit work best for you and your team.

Loving Korbit!? Share us on LinkedIn Reddit and X

const getNoResultsMessage = (filter: string) =>
filter ? t('No matching records found') : t('No records found');

const sanitizeHtmlValue = (value: DataRecordValue): DataRecordValue => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't use the sanitizeHtml from the utils? Guessing this is different? does this function belongs in the utils or is it component-specific?

Copy link
Contributor Author

@amaannawab923 amaannawab923 Aug 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes this is different , its about extracting value from Html Tag ->
Input :
< /a href="https://www.google.com/search?q=United Kingdom">United Kingdom</a>"

Expected Output:
United Kingdom

Sanitise Html function would just sanitise that html to remove malicious code

For now , i guess this is component specific , because it will only come to use here in Table

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the function name is causing confusion with html sanitisation , should probably rename it to , ExtractTextFromHtml

@mistercrunch
Copy link
Member

Add simple covering unit tests and I think this is mergeable!

@pull-request-size pull-request-size bot added size/L and removed size/S labels Aug 15, 2025
@amaannawab923
Copy link
Contributor Author

Add simple covering unit tests and I think this is mergeable!

Done ! Added Unit tests & Thanks for the review

@amaannawab923 amaannawab923 reopened this Aug 15, 2025
@msyavuz msyavuz added the hold! On hold label Aug 15, 2025
Copy link
Member

@mistercrunch mistercrunch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mistercrunch
Copy link
Member

@msyavuz why the hold?

@msyavuz
Copy link
Member

msyavuz commented Aug 15, 2025

@mistercrunch The issue has a bounty assigned. We need to remove that before this get's merged.

@msyavuz msyavuz removed the hold! On hold label Sep 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using Drill by in a dashboard doesn't work in columns created with <a> tags
4 participants