Skip to content

fix(dashboard): consistently apply the datasource-access check when serializing member charts and datasets - #42716

Merged
sha174n merged 9 commits into
apache:masterfrom
sha174n:fix/dashboard-member-access-consistency
Aug 11, 2026
Merged

sha174n merged 9 commits into
apache:masterfrom
sha174n:fix/dashboard-member-access-consistency

Conversation

@sha174n

@sha174n sha174n commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

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 in DashboardDatasetSchema.post_dump. Identifying fields (id, table_name, schema, type) are kept.
  • GET /<id>/charts: for a chart the caller can't access, withhold its form_data (datasource/query config). Identifying fields are kept so the response shape is unchanged.
  • GET /<id>: the charts name 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.

…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]>
@dosubot dosubot Bot added api:dashboard Related to the REST endpoints of the Dashboard authentication:access-control Rlated to access control labels Aug 3, 2026
@bito-code-review

bito-code-review Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #048744

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: db9ff93..db9ff93
    • superset/dashboards/api.py
    • tests/integration_tests/dashboards/api_tests.py
  • Files skipped - 0
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@github-actions github-actions Bot added the api Related to the REST API label Aug 3, 2026
@codecov

codecov Bot commented Aug 3, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.55%. Comparing base (5ee2793) to head (4af8df8).

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           
Flag Coverage Δ
hive 38.15% <20.00%> (+<0.01%) ⬆️
mysql 57.68% <100.00%> (+<0.01%) ⬆️
postgres 57.74% <100.00%> (+<0.01%) ⬆️
presto 40.11% <20.00%> (ø)
python 59.12% <100.00%> (+<0.01%) ⬆️
sqlite 57.35% <100.00%> (+<0.01%) ⬆️
unit 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…-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]>
@netlify

netlify Bot commented Aug 3, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 4af8df8
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6a7af0bdbf3942000848aa8e
😎 Deploy Preview https://deploy-preview-42716--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@bito-code-review

bito-code-review Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #d51866

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: db9ff93..62e0b3f
    • superset/dashboards/api.py
    • tests/integration_tests/dashboards/api_tests.py
  • Files skipped - 0
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

sha174n and others added 4 commits August 10, 2026 11:41
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]>
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]>
@pull-request-size pull-request-size Bot added size/M and removed size/L labels Aug 10, 2026
@bito-code-review

bito-code-review Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #111a89

Actionable Suggestions - 0
Filtered by Review Rules

Bito filtered these suggestions based on rules created automatically for your feedback. Manage rules.

  • tests/integration_tests/dashboards/api_tests.py - 1
Review Details
  • Files reviewed - 2 · Commit Range: 62e0b3f..211a439
    • superset/dashboards/api.py
    • tests/integration_tests/dashboards/api_tests.py
  • Files skipped - 0
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@rusackas rusackas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]>
@sha174n

sha174n commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor Author

@rusackas good catch, thanks. Not intentional, the chart-side narrowing got dropped in an intermediate revision. Restored it in the latest commit: GET /<id>/charts now withholds form_data for charts the caller can't access, and GET /<id> only lists accessible charts. Dataset narrowing unchanged, and I've updated the description to match.

@bito-code-review

bito-code-review Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #0dfed4

Actionable Suggestions - 0
Additional Suggestions - 1
  • superset/dashboards/api.py - 1
    • Missing test for security-filtered charts · Line 656-664
      The new security narrowing logic (lines 656–664) filters slices by caller access before serializing, but no test in `tests/integration_tests/dashboards/api_tests.py` exercises this path — existing `test_get_dashboard` creates a dashboard with zero slices. Without a test, future refactors can silently break this behavior.
Filtered by Review Rules

Bito filtered these suggestions based on rules created automatically for your feedback. Manage rules.

  • superset/dashboards/api.py - 1
Review Details
  • Files reviewed - 2 · Commit Range: 211a439..4af8df8
    • superset/dashboards/api.py
    • tests/integration_tests/dashboards/api_tests.py
  • Files skipped - 0
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api:dashboard Related to the REST endpoints of the Dashboard api Related to the REST API authentication:access-control Rlated to access control size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants