Skip to content

fix(dashboard): save an unreadable layout chart as a missing-chart tile - #45800

Merged
rebenitez1802 merged 15 commits into
apache:masterfrom
mikebridge:sc-129218-layout-unreadable-placeholder
Nov 6, 2026
Merged

rebenitez1802 merged 15 commits into
apache:masterfrom
mikebridge:sc-129218-layout-unreadable-placeholder

Conversation

@mikebridge

Copy link
Copy Markdown
Member

SUMMARY

Saving a dashboard layout that contains a tile for a chart you can't read no longer fails. The chart isn't attached to the dashboard, and its tile is saved as the same "This chart no longer exists." placeholder a deleted chart gets. This typically happens with a stale tile left after a chart was detached. Because the result is identical, a save doesn't reveal whether a chart you can't read exists.

This is stacked on #45538 and changes its behaviour for that one case. #45538 returns 422 for such a chart; this PR leaves it unlinked as a placeholder instead.

  • Unchanged: charts already on the dashboard (archived ones included) and a copy's source charts aren't checked, and readable charts are linked as in fix(dashboard): validate dashboard layout chart references on the server #45538.
  • Copy with charts: a readable chart outside the source still refuses the copy with 422.
  • Routes covered: dashboard PUT (both json_metadata.positions and raw position_json), POST, and the copy endpoint, which the MCP duplicate_dashboard tool also uses.

Stacked on #45538. Until that merges, this PR also shows #45538's commits; the change here is the last two commits. Master will be merged in once #45538 lands.

TESTING INSTRUCTIONS

  • pytest tests/unit_tests/dao/dashboard_test.py tests/unit_tests/mcp_service/dashboard/tool/test_duplicate_dashboard.py
  • pytest tests/integration_tests/dashboards/api_tests.py -k "layout_chart_access or matches_missing_chart or layout_detached_chart"

ADDITIONAL INFORMATION

mikebridge and others added 13 commits October 20, 2026 12:06
A dashboard save, create or copy rebuilds chart membership from the layout
it is sent. Only link a chart the layout adds if the caller can read it;
charts already on the dashboard (archived ones included) and, for a copy,
the source dashboard's charts stay accepted, so existing saves keep working.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The update command refuses a layout chart the caller cannot read in
validate(), before tab and native-filter removals deactivate reports
and email their owners. The editors and viewers of the charts being
checked are loaded in two queries instead of per chart. Tests cover a
chart the caller reads through a granted dataset but does not edit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… charts in the layout check

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…art-ids

Keep both sides in set_dash_metadata: install the stored membership
baseline, refuse unreadable new layout charts against the stored
dashboard_slices rows, then keep archived members the layout omits.
Kept archived charts are limited to stored members.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Being archived does not exempt a chart from the layout access check: an
archived chart that is not already a member and that the caller cannot
read is refused, and the stored membership is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Saving a dashboard layout that adds a chart the user cannot read is refused on update, create and copy. Existing members, archived ones included, and a copy's source charts are not checked.
A dashboard save, create or copy whose layout adds a chart the caller cannot read no longer fails with 422. The chart is left unlinked and its tile is saved as the same placeholder a nonexistent chart gets, so the response does not reveal that the chart exists. Existing members, archived ones included, and a copy's source charts are not checked.

Copying with charts handles a tile for a chart outside the source the same way when the caller cannot read it; a readable one still refuses the copy.
A PUT that sends only position_json kept a tile for an existing chart the caller cannot read, while a nonexistent chart's tile became the missing-chart placeholder, so reading the layout back revealed which charts exist. The raw path and the copy-with-charts layout now repair a non-member chart the caller cannot read like a missing one.

The copy-with-charts handling moves into that shared repair, which also covers every save route with a parity test.
@netlify

netlify Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 430acac
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6aeba4585e0177876d15c1d7
😎 Deploy Preview https://deploy-preview-45800--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.

@codecov

codecov Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.00%. Comparing base (c0b27ee) to head (430acac).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #45800      +/-   ##
==========================================
- Coverage   85.00%   85.00%   -0.01%     
==========================================
  Files        3080     3080              
  Lines      209252   209251       -1     
  Branches    49292    49292              
==========================================
- Hits       177881   177878       -3     
- Misses      27990    27991       +1     
- Partials     3381     3382       +1     
Flag Coverage Δ
hive 34.19% <25.00%> (+<0.01%) ⬆️
mysql 52.02% <100.00%> (+<0.01%) ⬆️
postgres 52.04% <100.00%> (+<0.01%) ⬆️
presto 35.85% <25.00%> (+<0.01%) ⬆️
python 87.96% <100.00%> (-0.01%) ⬇️
sqlite 51.78% <100.00%> (+<0.01%) ⬆️
unit 82.91% <93.75%> (+<0.01%) ⬆️

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.

@github-actions github-actions Bot added the requires:rebase Requires rebasing on top of current master label Oct 30, 2026
@github-actions github-actions Bot removed the requires:rebase Requires rebasing on top of current master label Nov 1, 2026
@mikebridge
mikebridge marked this pull request as ready for review November 4, 2026 23:26
Comment on lines +887 to +892
unreadable_ids: set[int] = _unreadable_new_chart_ids(
current_slices, member_ids | (allowed_chart_ids or set())
)
current_slices = [
chart for chart in current_slices if chart.id not in unreadable_ids
]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggestion: If chart access is revoked after this check but before the membership update commits, the stale result still links it, allowing dashboard membership to grant access.

Assessment: 🔴 Critical · 🔁 Occurrence: Rarely · 🏷️ Race condition

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset/daos/dashboard.py
**Line:** 887:892
**Comment:**
	*Race Condition: If chart access is revoked after this check but before the membership update commits, the stale result still links it, allowing dashboard membership to grant access.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

@codeant-ai-for-open-source

Copy link
Copy Markdown
Contributor

CodeAnt  CodeAnt PR Risk

🟡  Medium Risk

  • The PR needs attention before merging.
  • A concurrent permission revocation after the access check but before the dashboard save commits can leave the chart linked and expose it through dashboard membership.

Assessed commit: 430acac81f1d

@gabotorresruiz gabotorresruiz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @mikebridge, LGTM!

I ran the unit and integration selections from the description locally on sqlite (all green here, and the new tests fail against master as expected), and compared every save route with a nonexistent chart against an unreadable one: same status, response, stored layout, metadata and membership. CI is green.

@rebenitez1802
rebenitez1802 merged commit bab549f into apache:master Nov 6, 2026
123 checks passed
hainenber pushed a commit that referenced this pull request Nov 14, 2026
villebro added a commit that referenced this pull request Nov 14, 2026
…chart's own requests (reduced backport of #44215)

The security manager change applies as is. On 7.0 the copy and native-filter
checks build on the reduced #45538 layout check rather than master's #44028
and #45800 helpers: a copy checks the source charts it carries (all of them
when duplicating or without a layout, else those its layout places) and its
native-filter targets, and the update command checks new filter targets
before its side effects. The dashboard datasets endpoint passes the grant to
the serializer, since 7.0's DAO takes no access callback. Tests for files
absent on 7.0 are left out, and 7.0's copy test now expects the refusal.

(cherry picked from commit 2645396, reduced)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants