Skip to content

fix(dashboard): count extra_editors when deciding who may edit a dashboard - #42708

Merged
rusackas merged 2 commits into
apache:masterfrom
mikebridge:sc-extra-editors-edit-gate
Aug 3, 2026
Merged

fix(dashboard): count extra_editors when deciding who may edit a dashboard#42708
rusackas merged 2 commits into
apache:masterfrom
mikebridge:sc-extra-editors-edit-gate

Conversation

@mikebridge

@mikebridge mikebridge commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

SUMMARY

The server's is_editor (superset/security/manager.py) unions the explicit editor list with subjects resolved by a deployment's EXTRA_EDITORS_RESOLVER, and the dashboard GET attaches those ids as extra_editors after the response schema is dumped (superset/dashboards/api.py:614), so they survive the columns projection. The frontend predicate canUserEditDashboard checked editors alone.

Result: anyone whose editorship comes only through the resolver sees no Edit button on a dashboard the API would happily let them write to. This bites exactly — and only — in deployments that configure the resolver.

This PR widens the shared predicate in permissionUtils.ts to editors ∪ extra_editors, matching the server, and types the field on Dashboard. Since dash_edit_perm is derived from this function at hydrate time, every consumer of that flag is corrected together. Behaviour is unchanged for deployments without the resolver.

Split out of #41551, where the gap was found during review (thanks @kgabryje) — it is a platform-wide fix independent of version history and shouldn't ride inside a feature-flagged PR.

Disclosure: this change was developed with AI assistance (Claude), on behalf of and reviewed by @mikebridge.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A — no visual change except the Edit button appearing for users the API already authorizes.

TESTING INSTRUCTIONS

  1. Configure EXTRA_EDITORS_RESOLVER in superset_config.py to return a subject id for a non-admin test user on some dashboard, e.g. a resolver granting a specific role's subject.
  2. As that user (no explicit editor entry on the dashboard, no Admin role), open the dashboard.
  3. Before: no Edit button, though PUT /api/v1/dashboard/{id} succeeds for this user. After: Edit button shows and editing works.
  4. Unit coverage: npm run test -- permissionUtils.test.ts — includes cases for editorship granted through extra_editors and for extra_editors belonging to other subjects.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • 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

Scope boundary (from review): this PR fixes the dashboard single-entity surface only, deliberately. Two adjacent gaps are known and out of scope here:

  • Chart-side Explore gates: the chart payloads also carry extra_editors (superset/models/slice.py, superset/charts/api.py), and the in-flight version-history PR feat(versioning): version-history UI #41551 already fixes the Save-modal/menu gates via its shared canOverwriteSlice helper. The remaining chart gap after both merge is the editable-title canEdit gate in ExploreChartHeader, tracked as a follow-up.
  • List pages (DashboardCard/ChartCard/list views) cannot be fixed client-side: the list endpoints never attach extra_editors (only the single-entity GETs do, post-dump). Extra editors see hover-edit hidden on cards while the entity itself is editable once opened — attaching per-row extra_editors in list payloads has a resolver-cost × page-size question and needs a backend decision.

…board

The server's is_editor unions the explicit editor list with subjects
resolved by EXTRA_EDITORS_RESOLVER (security/manager.py), and the dashboard
GET attaches those ids as `extra_editors` after the response schema is
dumped, so they survive the `columns` projection. The frontend predicate
`canUserEditDashboard` checked `editors` alone, so anyone whose editorship
came only through the resolver saw no Edit button on a dashboard the API
would happily let them write to.

Widen the shared predicate to editors union extra_editors, matching the
server, and type the field on Dashboard. `dash_edit_perm` is derived from
this function at hydrate time, so every consumer of that flag is corrected
together.

Only deployments that configure EXTRA_EDITORS_RESOLVER are affected;
behaviour is unchanged everywhere else.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@dosubot dosubot Bot added authentication:access-control Rlated to access control change:frontend Requires changing the frontend dashboard Namespace | Anything related to the Dashboard labels Aug 3, 2026
@bito-code-review

bito-code-review Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #0e627b

Actionable Suggestions - 0
Review Details
  • Files reviewed - 3 · Commit Range: e2dfcd5..e2dfcd5
    • superset-frontend/src/dashboard/util/permissionUtils.test.ts
    • superset-frontend/src/dashboard/util/permissionUtils.ts
    • superset-frontend/src/types/Dashboard.ts
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Eslint (Linter) - ✔︎ 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 evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@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 65.43%. Comparing base (22c305f) to head (dc827a7).
⚠️ Report is 37 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #42708      +/-   ##
==========================================
- Coverage   65.43%   65.43%   -0.01%     
==========================================
  Files        2810     2810              
  Lines      159460   159466       +6     
  Branches    36396    36398       +2     
==========================================
  Hits       104350   104350              
- Misses      53068    53074       +6     
  Partials     2042     2042              
Flag Coverage Δ
javascript 71.55% <100.00%> (-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.

…ments

Review follow-ups from a clean-code + tidy-first + react panel:

- New test pins the true union: non-matching explicit editors plus a
  matching extra_editors grant. The existing cases all used editors: [],
  so a refactor that consulted extra_editors only when editors is empty
  would have stayed green. Also covers the resolver-returns-nothing shape.
- The doc and test comments narrated the bug history ("hid the Edit
  button"); they now state the timeless contract — the predicate must
  stay in step with the server's is_editor — per the project's
  timeless-comments rule.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@netlify

netlify Bot commented Aug 3, 2026

Copy link
Copy Markdown

Deploy Preview for superset-docs-preview ready!

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

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

Thanks for splitting this out of #41551, easier to review on its own. Tests look solid, especially the union-vs-preference case and the mismatched-subject one. LGTM!

@bito-code-review

bito-code-review Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #96b0c3

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: e2dfcd5..dc827a7
    • superset-frontend/src/dashboard/util/permissionUtils.test.ts
    • superset-frontend/src/dashboard/util/permissionUtils.ts
  • Files skipped - 0
  • Tools
    • Eslint (Linter) - ✔︎ 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 evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@rusackas
rusackas merged commit da9f421 into apache:master Aug 3, 2026
78 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

authentication:access-control Rlated to access control change:frontend Requires changing the frontend dashboard Namespace | Anything related to the Dashboard size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants