You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "alexandrusoare (via GitHub)" <gi...@apache.org> on 2026/03/09 12:30:48 UTC
[PR] fix(matrixify): Matrixify to not override slice id [superset]
alexandrusoare opened a new pull request, #38515:
URL: https://github.com/apache/superset/pull/38515
### SUMMARY
Matrixify charts throws access errors when it is embedded.
#### Root Cause
When a chart is matrixified, it generates multiple cells that each make independent API requests. The `MatrixifyGridGenerator.ts` was explicitly setting `slice_id: undefined` in each cell's formData (line 130).
The backend permission check for embedded/guest users (`superset/security/manager.py:2559-2604`) requires **both**:
1. `dashboardId` - to identify the dashboard context
2. `slice_id` - to verify the chart belongs to the dashboard
When `slice_id` was removed, the backend couldn't verify the chart belonged to the dashboard, so it denied access and required `all_datasource_access` instead.
#### Possible Solutions
| Solution | Description | Pros | Cons |
| --- | --- | --- | --- |
| **1. Preserve `slice_id` (Implemented)** | Remove `slice_id: undefined` from overrides so cells inherit parent's `slice_id` | Minimal change (1 line), no backend changes, works immediately | Cells share same `slice_id` (but this is semantically correct) |
| **2. Add `parent_slice_id`** | Keep `slice_id: undefined` but add new `parent_slice_id` field; modify backend to check both | Explicit separation of concerns | Requires frontend + backend changes, more complex |
| **3. Pass permission context separately** | Send `slice_id`/`dashboardId` as API query params instead of in formData | Clean separation between query data and permissions | Requires changes to StatefulChart, API handling, and backend |
#### Implemented Fix
**Solution 1** - Removed `slice_id: undefined` from the overrides in `MatrixifyGridGenerator.ts`.
This is safe because:
- Matrixify uses `StatefulChart` which doesn't use Redux or the dashboard's chart action system
- Backend cache keys are based on query parameters (metrics, filters), not `slice_id`
- Cells ARE derived from the parent chart, so sharing `slice_id` is semantically correct
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
<!--- Skip this if not applicable -->
### TESTING INSTRUCTIONS
<!--- Required! What steps can be taken to manually verify the changes? -->
### ADDITIONAL INFORMATION
<!--- Check any relevant boxes with "x" -->
<!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
- [ ] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] 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
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(matrixify): Matrixify to not override slice id [superset]
Posted by "michaelmorera-preset (via GitHub)" <gi...@apache.org>.
michaelmorera-preset commented on PR #38515:
URL: https://github.com/apache/superset/pull/38515#issuecomment-4038976843
Memo and Alexandru helped me to the get embedded part completed on my local. The application is working as expected.
# Scenario
The user is able to embed a Map Multiple Layer chart.
## Preconditions
Superset must have CORS enabled for embedded.
`FEATURE_FLAGS = { "EMBEDDED_SUPERSET": True, "MATRIXIFY": True }`
## Steps
1. Go to the Superset application
2. Create a new chart (use matrixify)
3. Save the Chart (may be with a new dashboard)
4. Create a embed ID
5. Use it the Embed Dashboard ID, Domain, user, and pass to display the dashboard as embedded in another app.
## Expected result
After the step 5, the dashboard is correctly displayed embedded.
## Evidence
1.
<img width="1915" height="986" alt="image" src="https://github.com/user-attachments/assets/493b0c22-1ac3-4da0-ae2b-67444380af43" />
2.

--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(matrixify): Matrixify to not override slice id [superset]
Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on PR #38515:
URL: https://github.com/apache/superset/pull/38515#issuecomment-4027018867
## **Sequence Diagram**
The PR removes the explicit clearing of slice_id so matrixified cells inherit the parent's slice_id and dashboardId. This ensures each cell's API request includes the dashboard context so the backend permission check can verify chart membership and return data for embedded dashboards.
```mermaid
sequenceDiagram
participant Renderer
participant MatrixifyGridGenerator
participant Cell as "StatefulChart Cell"
participant API
participant Backend as "Backend (permission check)"
Renderer->>MatrixifyGridGenerator: generateMatrixifyGrid(baseFormData with slice_id & dashboardId)
MatrixifyGridGenerator->>Cell: create cell with formData (preserve slice_id & dashboardId)
Cell->>API: Request chart data (formData includes slice_id + dashboardId)
API->>Backend: Validate request (check dashboardId and slice_id for embedded user)
Backend-->>API: Authorized -> chart data
API-->>Cell: Return chart data
Cell-->>Renderer: Render cell with data
```
---
*Generated by [CodeAnt AI](https://codeant.ai)*
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(matrixify): Matrixify to not override slice id [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #38515:
URL: https://github.com/apache/superset/pull/38515#issuecomment-4023422029
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(matrixify): Matrixify to not override slice id [superset]
Posted by "alexandrusoare (via GitHub)" <gi...@apache.org>.
alexandrusoare merged PR #38515:
URL: https://github.com/apache/superset/pull/38515
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org