sha174n opened a new pull request, #45622: URL: https://github.com/apache/superset/pull/45622
### SUMMARY A chart's datasource can be served through a dashboard the chart belongs to: drill-to-detail resolves the datasource by dashboard membership, and viewers of a published dashboard reach member datasources under `VIEWER_PROMISCUOUS_MODE`. `raise_for_access` already enforces datasource access on those read paths. This applies the same datasource-access check on the write paths that add a chart to a dashboard, so the two stay consistent: - `DashboardDAO.set_dash_metadata` (dashboard create/update, and copy that rebuilds membership from a supplied layout) checks the acting user's access to each newly added member chart's datasource, resolved across datasource types via `Slice.iter_resolved_datasources`. - `UpdateChartCommand` applies the same check when a chart is linked to a new dashboard. It mirrors the existing `_raise_for_guest_token_datasource_access` helper. Admins are exempt, charts already on the dashboard are left untouched (existing saves keep working), the clone path is exempt (it duplicates charts from a source dashboard the user can already edit), and an unresolvable datasource is skipped (the read paths resolve access again at query time). ### TESTING INSTRUCTIONS Added unit tests: - `tests/unit_tests/dao/dashboard_test.py`: `set_dash_metadata` requires access for a newly added chart's datasource; admins, charts already on the dashboard, soft-deleted members, and the clone path are exempt; a copy that rebuilds membership from a supplied layout is checked. - `tests/unit_tests/charts/commands/test_update_dashboard_access.py`: linking a chart to a new dashboard requires datasource access, with admin and unresolvable-datasource exemptions. ### ADDITIONAL INFORMATION - [ ] 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 consequences of this change 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
