You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2026/03/16 23:45:43 UTC
(superset) 01/01: fix(dashboard): validate current_slice type and guard against key collision
This is an automated email from the ASF dual-hosted git repository.
rusackas pushed a commit to branch fix/excel-dashboard-export-overload
in repository https://gitbox.apache.org/repos/asf/superset.git
commit a9e400d3bc9b94fc55a9438b5624fa4f9588b465
Author: Claude <cl...@anthropic.com>
AuthorDate: Mon Mar 16 16:45:28 2026 -0700
fix(dashboard): validate current_slice type and guard against key collision
Use isinstance check instead of truthiness to prevent non-Slice values
(e.g. from user-supplied JSON payloads) from being trusted as slice_.
Merge kwargs so stored query_context cannot collide with current_slice.
Co-Authored-By: Claude Sonnet 4.6 <no...@anthropic.com>
---
superset/common/query_context_factory.py | 2 +-
superset/models/slice.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/superset/common/query_context_factory.py b/superset/common/query_context_factory.py
index 712cc276d09..0d1539a9a16 100644
--- a/superset/common/query_context_factory.py
+++ b/superset/common/query_context_factory.py
@@ -59,7 +59,7 @@ class QueryContextFactory: # pylint: disable=too-few-public-methods
datasource_model_instance = self._convert_to_model(datasource)
slice_ = None
- if current_slice:
+ if isinstance(current_slice, Slice):
slice_ = current_slice
elif form_data and form_data.get("slice_id") is not None:
slice_ = self._get_slice(form_data.get("slice_id"))
diff --git a/superset/models/slice.py b/superset/models/slice.py
index bd96309d103..8b864f4ddc2 100644
--- a/superset/models/slice.py
+++ b/superset/models/slice.py
@@ -274,7 +274,7 @@ class Slice( # pylint: disable=too-many-public-methods
if self.query_context:
try:
return self.get_query_context_factory().create(
- current_slice=self, **json.loads(self.query_context)
+ **{**json.loads(self.query_context), "current_slice": self}
)
except json.JSONDecodeError as ex:
logger.error("Malformed json in slice's query context", exc_info=True)