Skip to content

fix: apply dashboard access check in related_objects endpoints#40333

Draft
sha174n wants to merge 11 commits into
apache:masterfrom
sha174n:fix/related-objects-dashboard-access-check
Draft

fix: apply dashboard access check in related_objects endpoints#40333
sha174n wants to merge 11 commits into
apache:masterfrom
sha174n:fix/related-objects-dashboard-access-check

Conversation

@sha174n
Copy link
Copy Markdown
Contributor

@sha174n sha174n commented May 21, 2026

Security fix for authorization bypass in related_objects endpoints

sha174n and others added 2 commits May 21, 2026 12:35
Add object access validation to both CreateCustomTagCommand and
DeleteTaggedObjectCommand to prevent unauthorized tag operations on
dashboards, charts, and queries that users don't have access to.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Prevents authorization bypass where authenticated users could access
dashboard metadata through dataset/database related_objects endpoints
even when those dashboards are hidden by DASHBOARD_RBAC controls.

Fixes:
- superset/datasets/api.py: Filter dashboards before serialization
- superset/databases/api.py: Filter dashboards before serialization

Both endpoints now use security_manager.can_access_dashboard() to
ensure only accessible dashboards are returned in related objects.

Reported-by: Mitchell Benjamin <mitchell@revampstudio.com.au>
Security-fix-for: CWE-863 Authorization bypass in related_objects
@dosubot dosubot Bot added the authentication:access-control Rlated to access control label May 21, 2026
Comment thread superset/commands/tag/create.py Outdated
Comment thread superset/commands/tag/delete.py Outdated
@github-actions github-actions Bot added the api Related to the REST API label May 21, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 21, 2026

Codecov Report

❌ Patch coverage is 41.30435% with 27 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.19%. Comparing base (965ec47) to head (258ab9d).

Files with missing lines Patch % Lines
superset/commands/tag/create.py 27.77% 10 Missing and 3 partials ⚠️
superset/commands/tag/delete.py 52.38% 9 Missing and 1 partial ⚠️
superset/commands/tag/utils.py 42.85% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #40333      +/-   ##
==========================================
- Coverage   64.20%   64.19%   -0.02%     
==========================================
  Files        2592     2592              
  Lines      139232   139260      +28     
  Branches    32327    32326       -1     
==========================================
+ Hits        89389    89393       +4     
- Misses      48308    48328      +20     
- Partials     1535     1539       +4     
Flag Coverage Δ
hive 39.22% <15.21%> (-0.02%) ⬇️
mysql 58.75% <41.30%> (-0.02%) ⬇️
postgres 58.83% <41.30%> (-0.02%) ⬇️
presto 40.90% <15.21%> (-0.02%) ⬇️
python 60.38% <41.30%> (-0.02%) ⬇️
sqlite 58.47% <41.30%> (-0.02%) ⬇️
unit 100.00% <ø> (ø)

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

☔ View full report in Codecov by Sentry.
📢 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.

Copy link
Copy Markdown
Contributor

@bito-code-review bito-code-review Bot left a comment

Choose a reason for hiding this comment

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

Code Review Agent Run #a54e91

Actionable Suggestions - 3
  • superset/databases/api.py - 1
  • superset/commands/tag/create.py - 1
  • superset/commands/tag/delete.py - 1
    • CWE-285: Missing dataset access check · Line 98-98
Additional Suggestions - 1
  • superset/commands/tag/delete.py - 1
    • SEMANTIC_DUPLICATION: Identical method · Line 93-106
      The `_validate_object_access` method is semantically duplicated in both `delete.py` (lines 93-106) and `create.py` (lines 71-82). Identical code in multiple locations creates maintenance divergence risk. Extract to a shared utility function.
Filtered by Review Rules

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

  • superset/commands/tag/create.py - 1
Review Details
  • Files reviewed - 4 · Commit Range: e08dc2e..16fa073
    • superset/commands/tag/create.py
    • superset/commands/tag/delete.py
    • superset/databases/api.py
    • superset/datasets/api.py
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ 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

Comment thread superset/databases/api.py Outdated
Comment thread superset/commands/tag/create.py Outdated
Comment thread superset/commands/tag/delete.py Outdated
@sha174n sha174n marked this pull request as draft May 21, 2026 19:06
sha174n and others added 2 commits May 22, 2026 10:41
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@pull-request-size pull-request-size Bot added size/L and removed size/M labels May 22, 2026
sha174n and others added 4 commits May 22, 2026 11:18
Update chart filtering to use `can_access_chart()` per-object validation
instead of generic permission checks, matching dashboard filtering pattern
for consistent security enforcement across related objects.

Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
…d_objects

Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
@netlify
Copy link
Copy Markdown

netlify Bot commented May 23, 2026

Deploy Preview for superset-docs-preview ready!

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

sha174n and others added 3 commits May 23, 2026 19:22
Skip base filter when resolving the target model so we can tell
"object missing" from "user lacks access". When the object is gone,
allow the tag operation to proceed (preserves prior behavior for
orphan references) rather than rejecting with 422.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…ects filters

Tests calling CreateCustomTagCommand.run() directly need a Flask user
context for the new raise_for_access() checks. Add self.login(ADMIN_USERNAME)
in the affected tests.

Also collapse the two-pass list comprehensions in databases/datasets
related_objects endpoints and move security_manager import to module level
in tag/delete.py for consistency with tag/create.py.
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 authentication:access-control Rlated to access control size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant