Repository navigation
fix(dashboard): consistently apply the datasource-access check when serializing member charts and datasets - #42716
Conversation
…erializing member charts and datasets The dashboard datasets endpoint already narrows a member dataset's payload when the caller cannot access that datasource on its own (_serialize_dashboard_dataset). Apply the same treatment consistently to the other places where a dashboard's members are serialized: - get_datasets: extend the narrowing to the remaining schema/connection fields (database, column definitions, verbose map, edit/perm links, ordering choices) so it matches the guest-user treatment in DashboardDatasetSchema.post_dump. - get_charts: add _serialize_dashboard_chart, which includes the chart configuration payload only for charts the caller can access, while keeping the chart's identifying fields so the response shape stays stable for existing clients. - GET /<id>: include only the names of member charts the caller can access in the charts list. Field-narrowing (rather than omitting members) keeps the response shape backward compatible for dashboard rendering. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Code Review Agent Run #048744Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #42716 +/- ##
=======================================
Coverage 66.55% 66.55%
=======================================
Files 2864 2864
Lines 161894 161899 +5
Branches 37305 37305
=======================================
+ Hits 107742 107752 +10
+ Misses 52106 52101 -5
Partials 2046 2046
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…-name narrowing Extract the inaccessible-datasource field list into a module-level constant shared between the serializer and its test, and assign the accessible chart names directly instead of via an intermediate variable. Co-Authored-By: Claude Opus 4.8 <[email protected]>
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
…r-access-consistency
Code Review Agent Run #d51866Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Omitting inaccessible members wholesale removes the datasets and charts that embedded guest sessions rely on to render, since the guest carve-out in raise_for_access applies to the dashboard-scoped chart-data path rather than to a bare datasource or chart check. Go back to keeping every member in the response and narrowing the fields that require per-object access. Co-Authored-By: Claude Opus 5 <[email protected]>
…ber-access-consistency
Dashboard hydration dereferences a member chart's form_data unconditionally (superset-frontend/src/dashboard/actions/hydrate.ts), so leaving that key out for a caller who reaches the chart through the dashboard blanks the whole page rather than degrading it. Narrow only the dataset payload, where every consumer of the affected fields already guards for their absence. Also assert the withheld dataset fields from a literal list rather than the production constant, so shrinking that constant fails the test. Co-Authored-By: Claude Opus 5 <[email protected]>
Code Review Agent Run #111a89Actionable Suggestions - 0Filtered by Review RulesBito filtered these suggestions based on rules created automatically for your feedback. Manage rules.
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
rusackas
left a comment
There was a problem hiding this comment.
Title and description still talk about narrowing _serialize_dashboard_chart and the charts name list on GET /<id>, but the last commit (211a439) reverted both of those back to the original unfiltered dump. Only the dataset field list in _serialize_dashboard_dataset is actually tightened now. Was that on purpose, or did the chart-side fix get dropped by accident during the rebase/squash? As written the description oversells what the diff does. That said, LGTM as a fix goes.
Restore the chart-side narrowing to match the dataset treatment: GET /<id>/charts now withholds a member chart's form_data (its datasource and query configuration) from callers who cannot access that chart on their own, and GET /<id> only names the member charts the caller can access. Chart identifying fields are kept so the response shape is unchanged for existing clients. The dataset narrowing is unchanged. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
@rusackas good catch, thanks. Not intentional, the chart-side narrowing got dropped in an intermediate revision. Restored it in the latest commit: |
Code Review Agent Run #0dfed4Actionable Suggestions - 0Additional Suggestions - 1
Filtered by Review RulesBito filtered these suggestions based on rules created automatically for your feedback. Manage rules.
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
The dashboard's member charts and datasets were serialized after only a whole-dashboard access check, so a caller who can reach the dashboard through a single accessible slice received the full definitions of the other members. This narrows each sub-resource to what the caller can access:
GET /<id>/datasets: for a dataset the caller can't access, drop the schema/connection/query fields (sql,select_star,columns,database,verbose_map, …), matching the narrowing already applied to guest users inDashboardDatasetSchema.post_dump. Identifying fields (id,table_name,schema,type) are kept.GET /<id>/charts: for a chart the caller can't access, withhold itsform_data(datasource/query config). Identifying fields are kept so the response shape is unchanged.GET /<id>: thechartsname list only includes charts the caller can access.Field-narrowing rather than omission keeps every member present with a stable shape, so dashboard rendering for legitimate viewers is unaffected. Tests cover both the dataset and chart narrowing.