Skip to content

SQL Lab "Create chart" broken for non-admin users #42389

Closed

Description

@joezeon

Bug description

Cannot create a chart via "Create Chart" button from SQL Lab

Steps to reproduce

  1. Create a user with the Gamma and sql_lab roles (or any custom non-admin role that has SQL Lab access to a database but no all_datasource_access).
  2. Grant the role database_access on the target database so the user can run queries in SQL Lab.
  3. Log in as that user, open SQL Lab, run any query. The results panel loads normally.
  4. Click the Create chart button in the results toolbar.
  5. Observe the errors below.

Actual result

Two errors surface:

  • Backend (from superset/security/manager.py:837 via raise_for_access):

    This endpoint requires the datasource , database or all_datasource_access permission

  • Frontend (from superset-frontend/src/explore/components/controls/DatasourceControl/index.tsx:543):

    Missing URL parameters
    The URL is missing the dataset_id or slice_id parameters.

Screenshots/recordings

Image

Superset version

6.1.0

Python version

3.11

Node version

Not applicable

Browser

Chrome

Additional context

No response

Checklist

  • I have searched Superset docs and Slack and didn't find a solution to my problem.
  • I have searched the GitHub issue tracker and didn't find a similar bug report.
  • I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.

Activity

  1. dosubot commented on Jul 24, 2026

    @dosubot

    This looks related to the authorization hardening introduced in PR #40409, which tightened SQL Lab access so that operations now require a matching Superset dataset-level permission — database_access or schema_access alone is no longer sufficient for Gamma-style users.

    Here's what's happening in the "Create chart" flow:

    1. When you click Create chart, the frontend calls /api/v1/dataset/get_or_create/ to create a dataset from the CTAS/CVAS result [1].
    2. The CreateDatasetCommand validates access via raise_for_access(database=database, sql=sql, ...) [2]. For a Gamma user with only database_access (no all_datasource_access), this check fails because the hardened authorization now demands explicit datasource-level permission for the newly created/referenced table [3].
    3. Because the backend rejects the request, no valid dataset_id is returned, so the frontend navigation to Explore fails with the "Missing URL parameters" error.

    Workarounds:

    • Grant all_datasource_access to the role (which you've noted you want to avoid).
    • Grant schema-level access (schema_access) on the schema where CTAS tables are created (configured via CTAS_SCHEMA_NAME_FUNC in superset_config.py). This should satisfy raise_for_access at the schema level.
    • Ensure the user is set as owner of any datasets created, since ownership bypasses the datasource permission check [4].

    This may be an unintended regression from the authorization hardening wave (PRs #40409, #38952, #40497) — the "Create chart" flow inherently creates new datasets that the user wouldn't have pre-existing permissions for. You may want to check whether the dataset created via get_or_create properly assigns the creating user as owner, which would allow the subsequent Explore access to succeed.

    To reply, just mention @dosu.


    Share context across your team and agents. Try Dosu.

    Leave Feedback Learn about superset with Dosu Add Dosu to your team

  2. durgaprasadml commented on Jul 27, 2026

    @durgaprasadml
    Contributor

    I've opened a PR with a proposed fix for this issue:

    #42479 – fix(sqllab): allow SQL Lab query owners to create charts without all_datasource_access

    The fix preserves the existing RBAC behavior while allowing authorized SQL Lab users to create charts from their own queries.

    Feedback is welcome. Thanks!

  3. rusackas commented on Jul 28, 2026

    @rusackas
    Member

    Thanks for opening the PR... will review.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    authentication:RBACRelated to RBACsqllabNamespace | Anything related to the SQL Labvalidation:requiredA committer should validate the issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions