Apache Superset Codebase Exposes Multiple XSS Vulnerabilities via markupsafe.Markup
A security scan of the Apache Superset codebase has flagged a critical pattern of insecure coding practices, exposing the popular data visualization platform to potential cross-site scripting (XSS) attacks. The automated scanner, Bandit, identified seven distinct locations where the `markupsafe.Markup` class is being used on untrusted data. This practice effectively disables the library's built-in HTML escaping, creating a direct vector for attackers to inject malicious scripts into web pages rendered by Superset.
The vulnerability, classified as CWE-79 with a 'MEDIUM' severity and 'HIGH' confidence rating, is not a single bug but a systemic issue. The affected code spans core models and helper functions, including `superset/connectors/sqla/models.py`, `superset/models/dashboard.py`, `superset/models/slice.py`, and multiple instances within `superset/models/helpers.py`. Each instance represents a point where user-controlled or external data could be passed to `Markup()`, bypassing security safeguards and allowing script execution in a victim's browser context.
For an application like Apache Superset, which handles complex user-generated queries, dashboard configurations, and slice definitions, this class of vulnerability poses a significant risk. A successful exploit could lead to session hijacking, data theft, or unauthorized actions performed on behalf of authenticated users. The presence of this pattern across multiple files suggests a need for a comprehensive code review and remediation effort to replace unsafe `Markup` usage with proper escaping or safe string construction methods before the project's next release.