Skip to content

fix(security): bind promiscuous viewer access to the dashboard's and chart's own requests - #44215

Merged
villebro merged 17 commits into
apache:masterfrom
villebro:villebro/fix-promiscuous-dashboard-charts
Nov 7, 2026
Merged

villebro merged 17 commits into
apache:masterfrom
villebro:villebro/fix-promiscuous-dashboard-charts

Conversation

@villebro

@villebro villebro commented Sep 13, 2026 •

Copy link
Copy Markdown
Member

SUMMARY

Fixes #44133. VIEWER_PROMISCUOUS_MODE (with ENABLE_VIEWERS) is meant to let a viewer of a published dashboard render that dashboard's charts without explicit chart or dataset grants, as the legacy DASHBOARD_RBAC did. In practice charts hung on the loading spinner. The chart-data query already honored the flag, but to issue it the frontend first calls GET /dashboard/<id>/charts for each chart's form_data, and that endpoint (and GET /dashboard/<id>/datasets) narrowed members through can_access_chart/can_access_datasource, which know nothing about the dashboard. This regressed with #42716, whose tests mocked exactly those checks.

DESIGN

The grant follows the DASHBOARD_RBAC model. Its rules:

  1. Who. has_promiscuous_dashboard_access(dashboard) holds only for the dashboard's listed viewers (is_listed_viewer: on the viewer list directly or through a role or group, not merely an editor), only for a published dashboard, never for embedded guests (who keep their token-scoped grant), and only with ENABLE_VIEWERS and VIEWER_PROMISCUOUS_MODE on. Editors keep their regular access only.

  2. Where. The grant applies only to requests bound to that dashboard:

    • chart data, where the request's dashboardId is validated against what it names: a member chart on its own datasource, a native filter in the dashboard's configuration targeting that datasource, a multi-layer child configured in a member parent, or drill, plus can_access_dashboard;
    • drill info, for member datasources only;
    • the dashboard's chart list, /charts and /datasets endpoints (the Promiscuous viewer mode requires access to charts in addition to dashboard #44133 fix).

    Charts. The flag also grants a chart's data to the chart's own listed viewers, on the same terms (has_promiscuous_chart_access(chart)): listed viewers only, never editors or embedded guests, and only for chart-data requests whose slice_id names that chart on its own datasource. Charts have no publish state, so there's no published check.

    Nothing else counts either grant: can_access_chart/can_access_datasource, Explore, SQL Lab, chart create, repoint and Save as, the MCP tools. So neither grant can become access to a dataset outside the dashboard's or chart's own requests.

  3. What a dashboard may gain. A dashboard's charts and native-filter targets are editor-written configuration, and editors control the viewer list, so anything a dashboard newly gains must be readable by the editor in their own right:

    What the dashboard already has stays accepted, so a save never fails over something it doesn't change.

Consequences:

  • Editors can still share a dashboard's or chart's data with anyone they add as a viewer, themselves included, as DASHBOARD_RBAC owners could with roles. SECURITY.md documents the flag as an opt-in relaxation and lists what stays in scope.
  • Dashboard imports are not covered by rule 3. Like chart attachment under fix(dashboard): validate dashboard layout chart references on the server #45538, they need import permission rather than dashboard editing.

Earlier revisions propagated dashboard access to charts and datasets everywhere and opted write paths out one by one; review kept finding new paths (attach, create, repoint, Save as, copy, MCP). Binding the grant to the dashboard's own requests closes that class by design, leaving rule 3 as the only write-side check.

This changes behavior on master: dashboard and chart editors who aren't listed viewers no longer get the grant, a viewer's grant now also requires a published dashboard on the chart-data path, and copy now checks chart and filter-target access. UPDATING.md covers it.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A

TESTING INSTRUCTIONS

With ENABLE_VIEWERS on and VIEWER_PROMISCUOUS_MODE = True, add a role as a viewer of a published dashboard with no chart or dataset grants:

  • As that viewer, the dashboard's charts and native filters work; GET /api/v1/dashboard/<id>/charts returns form_data and /datasets returns full metadata.
  • The same user can't open those charts or datasets outside the dashboard (chart API, Explore), and Save as from Explore is refused.
  • An editor who isn't a listed viewer gets narrowed metadata; adding them as a viewer restores it.
  • Add the role as a viewer of a chart (not on the dashboard): it loads that chart's data, while the chart's editors without dataset access don't.
  • Unpublish the dashboard, or turn VIEWER_PROMISCUOUS_MODE off, and the metadata is narrowed again.
  • As an editor without access to some dataset, saving a native filter that targets it (via PUT /api/v1/dashboard/<id> or /filters) returns 422, as does copying a dashboard whose charts or filter targets you can't read.

Automated:

  • tests/unit_tests/subjects/test_promiscuous_dashboard_access.py, against real rows:
    • a viewer reads a published dashboard only through its requests, and a listed chart viewer reads only that chart's data;
    • dashboard and chart editors, strangers, guests and the flag off get no grant;
    • charts and filter targets a dashboard gains (layout, filters API, copy) need the editor's own access, and existing targets stay accepted;
    • an operator override of raise_for_access with the original signature keeps working.
  • tests/integration_tests/dashboards/api_tests.py: a Gamma listed viewer gets form_data and dataset metadata, an editor-only Gamma doesn't, plus the unpublished and flag-off cases.

ADDITIONAL INFORMATION

  • Has associated issue: Fixes Promiscuous viewer mode requires access to charts in addition to dashboard #44133
  • Required feature flags: ENABLE_VIEWERS (with VIEWER_PROMISCUOUS_MODE)
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • 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

@bito-code-review

bito-code-review Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #86542b

Actionable Suggestions - 0
Additional Suggestions - 1
  • superset/dashboards/api.py - 1
    • O(n²) drill-access recompute · Line 774-782
      For restricted users, `_serialize_dashboard_chart` calls `can_drill_dataset_via_dashboard_access` per chart, and that method rebuilds the full `dashboard.datasources` id set each time (manager.py:2330), giving O(n²) in-memory work. Compute the drillable datasource id set once in `get_charts` and pass it down to avoid the redundant recomputation.
Review Details
  • Files reviewed - 4 · Commit Range: 752ec86..752ec86
    • superset/daos/dashboard.py
    • superset/dashboards/api.py
    • tests/integration_tests/dashboards/api_tests.py
    • tests/unit_tests/subjects/test_raise_for_access.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 an incremental AI Review.

  • /review full - 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 Sep 13, 2026
Comment thread superset/dashboards/api.py Outdated
Comment on lines +777 to +780
chart.datasource is not None
and security_manager.can_drill_dataset_via_dashboard_access(
chart.datasource, dashboard
)

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: Semantic-view charts have no chart.datasource, so this check never runs and removes form_data even when the chart's resolved datasource is dashboard-authorized. [api mismatch]

Assessment: 🟠 Major · 🔁 Occurrence: Sometimes

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/dashboards/api.py
**Line:** 777:780
**Comment:**
	*Api Mismatch: Semantic-view charts have no `chart.datasource`, so this check never runs and removes `form_data` even when the chart's resolved datasource is dashboard-authorized.

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
👍 | 👎

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good catch — semantic-view charts have no table-backed chart.datasource, so the original guard skipped the check and stripped form_data for them.

Rather than patch the guard, I reworked the approach to match the intended model: full dashboard → chart → dataset access inheritance. A dashboard's /charts and /datasets sub-resources only ever return members of that dashboard, so the correct test is a pure dashboard-entitlement predicate, not a per-dataset membership check. Added SecurityManager.can_inherit_access_via_dashboard(dashboard) (embedded guest with access, or viewer of a published dashboard under VIEWER_PROMISCUOUS_MODE) and the serializers now use it. This is datasource-type agnostic, so semantic-view charts render correctly, and it's resolved once per request instead of per member. can_drill_dataset_via_dashboard_access still layers the dataset-membership guard on top for the drill endpoints, which resolve the dataset from an untrusted request param. Fixed in 1cf6da5.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Addressed structurally in 3f094b1. Rather than guard chart.datasource in the serializer, the access inheritance now lives in the access primitive (raise_for_access): can_access_chart / can_access_datasource themselves recognize a promiscuous viewer of a published dashboard the chart/dataset belongs to. Because that check is dashboard-level rather than per-datasource, it's datasource-type agnostic — semantic-view charts (whose table-only chart.datasource is None) render correctly with no special-casing. The dashboard serializers revert to pristine as a result. The tangled datasource branch of raise_for_access was also refactored into named helpers, preserving the embedded-guest strict per-request binding (validated against the existing guest/drill/multi-layer suite).

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.

✅ CodeAnt verified this suggestion was addressed in subsequent commits and marked this thread resolved as of 4fb6f17.

The current code no longer contains the chart.datasource check or the form_data removal it referred to; this section now filters dashboard charts by can_access_chart.

If that's not right, unresolve this thread and CodeAnt will leave it open.

@codecov

codecov Bot commented Sep 13, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.65517% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.14%. Comparing base (ec542a6) to head (8a9ab90).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
superset/daos/dashboard.py 87.93% 5 Missing and 2 partials ⚠️
superset/security/manager.py 90.47% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #44215      +/-   ##
==========================================
- Coverage   85.17%   85.14%   -0.03%     
==========================================
  Files        3082     3080       -2     
  Lines      210328   210375      +47     
  Branches    49592    49549      -43     
==========================================
- Hits       179144   179128      -16     
- Misses      27798    27854      +56     
- Partials     3386     3393       +7     
Flag Coverage Δ
hive 34.11% <13.79%> (-0.03%) ⬇️
mysql 51.89% <68.96%> (-0.03%) ⬇️
postgres 51.91% <68.96%> (-0.03%) ⬇️
presto 35.77% <13.79%> (-0.03%) ⬇️
python 88.05% <89.65%> (+<0.01%) ⬆️
sqlite 51.65% <68.96%> (-0.03%) ⬇️
unit 83.10% <81.60%> (+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.

@bito-code-review

Copy link
Copy Markdown
Contributor

The flagged issue is correct. Semantic-view charts often lack a direct chart.datasource reference, causing the current security check to fail and incorrectly strip form_data even when access is authorized via the dashboard.

To resolve this, you should update the check to handle cases where the datasource is resolved through the dashboard context, even if chart.datasource is None. You can modify _serialize_dashboard_chart in superset/dashboards/api.py to check the chart's resolved datasource if available.

Would you like me to implement this fix and check the rest of the PR comments for you?

superset/dashboards/api.py

if not (
            security_manager.can_access_chart(chart)
            or (
                (chart.datasource is not None or hasattr(chart, 'get_datasource'))
                and security_manager.can_drill_dataset_via_dashboard_access(
                    chart.datasource or chart.get_datasource(), dashboard
                )
            )
        ):

@villebro

Copy link
Copy Markdown
Member Author

/review

@bito-code-review

Copy link
Copy Markdown
Contributor

Bito Review Skipped - Review Already In Progress

Bito didn't start a new review because a review for this pull request is already in progress. Please wait for the current review to complete; its feedback will be posted on this pull request.

To run another review after it completes, type /review in a comment and save.

@bito-code-review

bito-code-review Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #a42f83

Actionable Suggestions - 0
Additional Suggestions - 1
  • superset/dashboards/api.py - 1
    • Disallowed Any type · Line 761-761
      `Any` is disallowed in type annotations. Replace `Any` with a more specific type, e.g., `BaseDatasource` or a Protocol. Similar issue exists at line 771.
Review Details
  • Files reviewed - 4 · Commit Range: 752ec86..1cf6da5
    • superset/dashboards/api.py
    • superset/security/manager.py
    • tests/integration_tests/dashboards/api_tests.py
    • tests/unit_tests/subjects/test_raise_for_access.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 an incremental AI Review.

  • /review full - 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 removed the api Related to the REST API label Sep 13, 2026
@villebro

Copy link
Copy Markdown
Member Author

/review

@bito-code-review

bito-code-review Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #ee4ed3

Actionable Suggestions - 0
Additional Suggestions - 4
  • superset/dashboards/api.py - 1
    • Guest dataset access regression · Line 759-759
      `_serialize_dashboard_dataset` now relies solely on `can_access_datasource`, which for the datasets endpoint (no `form_data`) returns False for embedded guests via `_has_request_bound_dashboard_datasource_access`. Previously `inherits_access` from `can_inherit_access_via_dashboard` granted them full metadata. Guests now get `columns`/`sql`/`database` stripped. Verify the embedded `DashboardPage` (`useDashboardDatasets`) still renders; same pattern in `_serialize_dashboard_chart` strips `form_data`.
  • superset/subjects/utils.py - 1
    • Editor published-filter divergence · Line 104-104
      `get_inherited_slice_ids_subquery` applies `Dashboard.published.is_(True)` to both editor and viewer branches, but `_apply_viewers` in `dashboards/filters.py` deliberately lets editors see unpublished dashboards (branch A has no published filter). An editor of an unpublished dashboard can see it in the list yet won't inherit its charts via `_promiscuous_viewer_inherits_chart`. Confirm this divergence is intended; if not, gate `published` on the viewer branch only.
  • superset/security/manager.py - 1
    • Guest exclusion inconsistency · Line 2428-2438
      `_has_promiscuous_chart_access` does not exclude embedded guests, unlike the sibling `_promiscuous_viewer_inherits_chart`/`_promiscuous_viewer_inherits_datasource` whose docstrings state guests are "deliberately excluded". A guest who is a viewer/editor of a chart could obtain datasource access via this path, bypassing the request-bound dashboard binding that `_has_request_bound_dashboard_datasource_access` enforces for guests. Add `not self.is_guest_user()` to the guard for consistency.
  • tests/unit_tests/subjects/test_raise_for_access.py - 1
    • Datasource path untested · Line 623-623
      The datasource helper only gets a guest-exclusion test; the chart helper gets a full membership test (True/False on subquery match). Add an analogous positive-path test for `_promiscuous_viewer_inherits_datasource` patching `get_inherited_datasource_ids_subquery` to cover the grant/deny branch.
Review Details
  • Files reviewed - 7 · Commit Range: 1cf6da5..3f094b1
    • superset/daos/dashboard.py
    • superset/dashboards/api.py
    • superset/security/manager.py
    • superset/subjects/utils.py
    • tests/integration_tests/dashboards/api_tests.py
    • tests/unit_tests/security/test_embedded_guest_chart_access.py
    • tests/unit_tests/subjects/test_raise_for_access.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 an incremental AI Review.

  • /review full - 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

@netlify

netlify Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 01aa1a0
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6aee458ff578e7f0faf6e657
😎 Deploy Preview https://deploy-preview-44215--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 Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #854f1f

Actionable Suggestions - 0
Review Details
  • Files reviewed - 3 · Commit Range: 3f094b1..cab0def
    • superset/subjects/utils.py
    • tests/integration_tests/dashboards/api_tests.py
    • tests/unit_tests/subjects/test_raise_for_access.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 an incremental AI Review.

  • /review full - 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

Comment thread superset/subjects/utils.py Resolved
Comment thread superset/security/manager.py Outdated
# chart itself, so its definition (``form_data``) can be served for
# rendering. This is datasource-type agnostic and covers charts
# whose datasource cannot be resolved above.
if self._promiscuous_viewer_inherits_chart(chart):

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 for picking this up, we have been bitten by needing per-chart grants on top of dashboard access. So this is very welcome 🎉

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thanks! That per-chart grant toil is exactly what prompted it — good to know it lands for your setup too. Your review also caught the editor/unpublished hole in the same area, which is now fixed in f8ac8a3.

villebro added a commit to villebro/superset that referenced this pull request Sep 19, 2026
…ublished

The dashboard read gate in raise_for_access admits editors with no publication
requirement and viewers only for a published dashboard. The inheritance paths
applied the published gate to both, so an editor added to someone else's
unpublished dashboard could open it while every chart lost form_data and the
dashboard rendered empty. Reported by @madhushreeag on apache#44215.

- get_inherited_slice_ids_subquery: gate published on the viewers leg only.
- can_inherit_access_via_dashboard: admit editors regardless of published, so
  drill-to-detail works on an editor's own unpublished dashboard too.

Covers the editor/viewer x published/draft matrix with tests that build real
dashboards, charts, users and subjects and execute the generated SQL.
@bito-code-review

bito-code-review Bot commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #43bd0a

Actionable Suggestions - 0
Additional Suggestions - 2
  • tests/unit_tests/subjects/test_raise_for_access.py - 1
    • Test coverage regression · Line 419-419
      This deletion removes the only direct unit tests for `can_drill_dataset_via_dashboard_access`, the viewer branches of `can_inherit_access_via_dashboard`, and both `_promiscuous_viewer_inherits_*` helpers. `tests/unit_tests/subjects/test_inherited_access.py` covers the dashboard-level branches via real-DB fixtures, but the guest-exclusion branches of the two private helpers keep no direct test (only a stub at `test_embedded_guest_chart_access.py:62`). Please restore or relocate those cases.
  • tests/unit_tests/subjects/test_inherited_access.py - 1
    • Missing docstring on helper · Line 193-201
      The helper ``_inherited_slice_ids`` carries a docstring but ``acting_as`` does not, so the file is internally inconsistent and the org rule requiring docstrings on every new function (including helpers) is unmet. One line restores compliance. ([BITO.md](BITO.md))
Review Details
  • Files reviewed - 4 · Commit Range: cab0def..f8ac8a3
    • superset/security/manager.py
    • superset/subjects/utils.py
    • tests/unit_tests/subjects/test_inherited_access.py
    • tests/unit_tests/subjects/test_raise_for_access.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 an incremental AI Review.

  • /review full - 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 requires:rebase Requires rebasing on top of current master label Oct 7, 2026
@rusackas

Copy link
Copy Markdown
Member

@villebro checking back in, holler if we can help move this forward. This still looks like the right fix for #44133.

It needs a rebase: #45002, #44993 and #45060 all touched raise_for_access in manager.py after your last merge, so the new inheritance branches will need to be reconciled with the datasource type/id binding from #45002 in particular.

@madhushreeag, the editors-leg published issue you flagged was fixed in f8ac8a3. Could you take another look once the rebase lands, and re-approve if it looks right to you?

Happy to take a pass at the conflict resolution myself if you're swamped, just say the word.

@villebro

Copy link
Copy Markdown
Member Author

Rebased onto current master (the branch history is now a single commit, so the earlier SHAs such as f8ac8a3 no longer exist; the content is unchanged).

The inheritance helpers in raise_for_access now bind on the (datasource_id, datasource_type) match from #45002 (_datasource_matches), including the native-filter target (datasetId / datasourceType), the member-chart and multi-layer child legs, and the chart-viewer leg. The allow_editorship opt-out applies to the editor leg of the datasource branch. The published gate stays on the viewers leg only, so the editor-of-an-unpublished-dashboard case is still covered.

Also added a test showing that embedded guests are excluded from the two _promiscuous_viewer_inherits_* helpers. @madhushreeag, could you take another look and re-approve if this looks right to you?

@codeant-ai-for-open-source

codeant-ai-for-open-source Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

CodeAnt  CodeAnt PR Risk

🟢  Low Risk

  • The PR appears safe to merge; dashboard-bound chart serialization uses the viewer grant, including for semantic-view charts without table-backed datasources.

Assessed commit: 01aa1a0e5c4c

@github-actions github-actions Bot removed the requires:rebase Requires rebasing on top of current master label Oct 19, 2026
… requests, for viewers only

Rework the promiscuous-mode fix on the legacy DASHBOARD_RBAC model instead of
dashboard-to-chart/dataset inheritance:

- has_promiscuous_dashboard_access(dashboard) grants a dashboard's data only to
  its listed viewers (is_listed_viewer: on the viewer list, not merely an
  editor), only for a published dashboard, and never to embedded guests.
- The grant applies only on requests bound to that dashboard: the existing
  chart-data leg (member chart on its own datasource, native filter target,
  multi-layer child, drill), drill info, and the dashboard's own chart list,
  /charts and /datasets endpoints. Nothing else counts it, so it can't become
  access to a chart or datasource outside the dashboard, and the per-path
  opt-outs (dashboard_inheritance_disabled, the inheritance SQL, the resolver
  fallback, the chart command and MCP wrappers) are removed.
- Copying a dashboard, with or without duplicating its charts, requires access
  to each source chart in its own right, since the copy keeps them.
- SECURITY.md, the config comment, the admin docs and UPDATING.md describe the
  model; tests are rewritten against real rows.
@github-actions github-actions Bot added the api Related to the REST API label Nov 3, 2026
@villebro

villebro commented Nov 3, 2026

Copy link
Copy Markdown
Member Author

Reworked in 8bfcc78, following the legacy DASHBOARD_RBAC model. The review rounds kept finding write paths (attach, create, repoint, Save as, copy, MCP) that turned the dashboard inheritance into lasting access. Instead of opting each one out, the grant is now:

  • for listed viewers of a published dashboard only: editors keep their regular access, and guests keep their token grant;
  • bound to that dashboard's requests: chart data for a member chart on its own datasource, native filter, multi-layer child, drill, and the dashboard's chart list, /charts and /datasets. The request's dashboardId is validated against the chart, filter or datasource it names.

Nothing outside those requests counts the grant, which removes the inheritance SQL, the context manager and the per-path opt-outs. Copying a dashboard now requires access to its charts. The description, SECURITY.md, the admin docs and UPDATING.md (which covers editors losing the grant) are updated. @sadpandajoe @madhushreeag @rusackas, could you take another look?

@madhushreeag madhushreeag 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.

Under VIEWER_PROMISCUOUS_MODE, the native-filter branch of raise_for_access grants access to any datasource named as a filter target in a dashboard's json_metadata. Unlike the chart branch, it never checks has_member_datasource, and no save path verifies that the editor can read the target dataset, so a listed viewer of a published dashboard can read a dataset that no chart on the dashboard uses. Verified on 8bfcc785e1: as gamma (no access to cleaned_sales_data, id 397) and a listed viewer of published dashboard 612, a native filter targeting 397 loaded that dataset's year values in gamma's filter bar, even though gamma has no grant on it. Because an editor can add themselves to the viewer list and publish, one person can reach a dataset they otherwise can't. The UI picker and the MCP tool both refuse an inaccessible dataset, so persisting such a filter needs a direct PUT /api/v1/dashboard/<id> with a crafted datasetId - the same reachability as the chart-attach issue fixed in f2b559120b. The master is worse actually, since it uses is_viewer with no published gate, the PR rework narrows it without closing it.
Suggested fix: check native-filter targets on save, mirroring the chart-attach gate, so a newly added target must be readable by the editor in their own right.

… save

The promiscuous grant lets a dashboard's viewers query its native-filter
targets, and an editor can add themselves as a viewer, so a filter targeting a
dataset the editor can't read gave them its values. Saving a native filter now
requires access to any datasource it newly targets, mirroring the chart layout
check: through the dashboard (update and create, with the update command
refusing before its side effects) and the filters API (including the MCP filter
tool). Targets the dashboard already had stay accepted. Copying a dashboard
also requires access to the source's filter targets, which the copy keeps.
@villebro

villebro commented Nov 4, 2026

Copy link
Copy Markdown
Member Author

@madhushreeag, thanks, confirmed and fixed in 687ac32, following your suggestion. Saving a native filter now requires access to any datasource it newly targets, mirroring the chart layout check:

  • through the dashboard (PUT and create, via set_dash_metadata; the update command refuses before its report side effects);
  • through the filters API (PUT /api/v1/dashboard/<id>/filters, which the MCP manage_native_filters tool also uses).

Targets the dashboard already had stay accepted, so a save never fails over a filter it doesn't change. Copying a dashboard also requires access to the source's filter targets, since the copy keeps them. test_carrying_charts_or_filter_targets_onto_a_dashboard_takes_access covers both save paths, the existing-target case and copy against real rows; the new-target case wasn't refused before this change. SECURITY.md and UPDATING.md are updated. Dashboard imports aren't covered: like chart attachment in #45538, they're an import-permission path, not an editor save.

@github-actions github-actions Bot added the requires:rebase Requires rebasing on top of current master label Nov 4, 2026

@madhushreeag madhushreeag 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.

LGTM!

The up-front copy check refused a copy whenever any source chart was
unreadable, even one the copy's layout left out. Check the charts each copy
mode actually carries: the source charts it clones (duplicate_slices), the
layout's charts (set_dash_metadata, no longer exempting the source's
members), or every source chart when there's no layout. The source's filter
targets are checked unless the copy replaces its metadata.

Tests: update apache#45538's copy integration tests for the rule (a source member
is no longer exempt, and duplicating an unreadable source chart is refused),
with expected messages built from the fixture's ids; cover the three copy
modes in the real-row unit test; and make Gamma a real listed viewer in the
semantic-view native filter test instead of mocking is_viewer.
@github-actions github-actions Bot removed the requires:rebase Requires rebasing on top of current master label Nov 4, 2026
Align the chart-level VIEWER_PROMISCUOUS_MODE grant with the dashboard one:
only a chart's listed viewers load its data without dataset access, its
editors need regular access, and embedded guests never get it. Document the
chart grant alongside the dashboard grant.
@villebro villebro changed the title fix(dashboard): honor promiscuous viewer access for chart/dataset metadata fix(security): bind promiscuous viewer access to the dashboard's and chart's own requests Nov 4, 2026
@github-actions github-actions Bot added the requires:rebase Requires rebasing on top of current master label Nov 6, 2026
# Conflicts:
#	UPDATING.md
#	superset/commands/dashboard/update.py
#	superset/daos/dashboard.py
#	tests/integration_tests/dashboards/api_tests.py
@github-actions github-actions Bot removed the requires:rebase Requires rebasing on top of current master label Nov 6, 2026
… layouts

A copy that carries a source chart the caller cannot read is refused, so the
missing-chart parity cases for the copy routes save only the stale tile.
@villebro
villebro merged commit 2645396 into apache:master Nov 7, 2026
74 checks passed
Raman-Katiyar added a commit to Raman-Katiyar/superset that referenced this pull request Nov 8, 2026
Upstream apache#44215 binds VIEWER_PROMISCUOUS_MODE grants to dashboard-bound
requests: a listed viewer reads a member chart's data only through its
dashboard, never the chart or dataset themselves. The dashboard-membership
grants in raise_for_access (the chart branch and the slice_id datasource
helper) fired on any bare chart/datasource check, so they over-granted
under promiscuous mode -- the two new tests in
test_promiscuous_dashboard_access.py failed, and an unbound chart-data
request for a member chart was granted too. Gate both grants on
promiscuous mode not applying; the legacy dashboard-RBAC behaviour
(flags off) is unchanged. Also collapse the _current_subject_ids set
comprehension to the single line ruff-format requires (pre-commit
failure on the rebased head).
Raman-Katiyar added a commit to Raman-Katiyar/superset that referenced this pull request Nov 8, 2026
…harts listing

Upstream apache#44215 pins that a dashboard viewer without promiscuous mode
keeps form_data stripped for its inaccessible charts in the dashboard
charts listing, but the dashboard-membership chart grant in
raise_for_access also feeds can_access_chart, which the listing uses
to decide the stripping -- so the listing exposed form_data and its
test failed on all three database backends.

Thread an allow_dashboard_membership opt-out through raise_for_access
and can_access_chart (default True, preserving the Explore bootstrap
behaviour) and pass False from the dashboard charts serializer, so the
listing keeps stripping form_data for non-inherited charts while
Explore access through dashboard RBAC is unchanged.
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

api Related to the REST API doc Namespace | Anything related to documentation size/XXL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Promiscuous viewer mode requires access to charts in addition to dashboard

4 participants