Skip to content

fix: Allow embedded guest user datasource access with dashboard context - #25081

Merged
eschutho merged 4 commits into
apache:masterfrom
preset-io:jack/embedded-guest-user-datasource-permissions
Aug 28, 2023
Merged

eschutho merged 4 commits into
apache:masterfrom
preset-io:jack/embedded-guest-user-datasource-permissions

Conversation

@jfrag1

@jfrag1 jfrag1 commented Aug 25, 2023 •

Copy link
Copy Markdown
Member

BACKGROUND

Recently, #24789 changed the way that datasource access is granted, specifically in the case that a user should have access to a datasource because they have access to a dashboard. Before #24789, datasource access was only granted as a result of dashboard access when DASHBOARD_RBAC was enabled, or when a guest user viewed an embedded dashboard while EMBEDDED_SUPERSET was enabled.

The PR made this process more secure, but only enabled it for DASHBOARD_RBAC, not embedded.

This PR is a follow-up that enables this for embedded. Without this PR, charts on embedded dashboards cannot load because guest users have no way to get access to the datasources.

Fixes #25006

cc @john-bodley

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

GIFs below are of a simple host app which renders an embedded superset dashboard

Before:
embedded_perms_before

After:
embedded_perms_after

TESTING INSTRUCTIONS

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

EMBEDDED_SUPERSET=True,
)
@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices_class_scope")

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.

This change speeds these tests up significantly

Comment thread superset/viz.py
query_obj["orderby"] = [(metric, asc)]
self.get_query_context_factory().create(
datasource={"id": self.datasource.id, "type": self.datasource.type},
form_data=self.form_data,

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.

This fixes #25006, form data wasn't being passed through to raise_for_access

@john-bodley
john-bodley self-requested a review August 25, 2023 16:50
},
)
}
)

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.

nice tests!

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

This lgtm. Not sure if @john-bodley or @Vitor-Avila wanted to look before we merge it.

)
session = db.session
session.add(dataset)
session.commit()

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.

I suspect the commit is unnecessary. This would mean that lines 240 and 241 become.

db.session.rollback()

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.

Yeah I guess it's unnecessary for these and we could instead just run these tests within an uncommitted transaction. Do you feel that's preferable? Here I pretty much just copied the pattern from existing fixtures I saw which all committed their changes.

@Vitor-Avila

Copy link
Copy Markdown
Contributor

Thanks for working on this PR! 🙏

@eschutho
eschutho merged commit 2b8d8da into apache:master Aug 28, 2023
@eschutho
eschutho deleted the jack/embedded-guest-user-datasource-permissions branch August 28, 2023 16:48
@michael-s-molina michael-s-molina added the v3.0 Label added by the release manager to track PRs to be included in the 3.0 branch label Aug 29, 2023
michael-s-molina pushed a commit that referenced this pull request Aug 30, 2023
cccs-rc pushed a commit to CybercentreCanada/superset that referenced this pull request Mar 6, 2024
@mistercrunch mistercrunch added 🍒 3.0.0 Cherry-picked to 3.0.0 🍒 3.0.1 Cherry-picked to 3.0.1 🍒 3.0.2 Cherry-picked to 3.0.2 🍒 3.0.3 Cherry-picked to 3.0.3 🍒 3.0.4 Cherry-picked to 3.0.4 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 3.1.0 First shipped in 3.1.0 labels Mar 8, 2024
@talk2morris

talk2morris commented Mar 13, 2024 •

Copy link
Copy Markdown

hello, how/when can we get this update in production?

@rusackas

Copy link
Copy Markdown
Member

hello, how/when can we get this update in production?

If you're running any of the versions tagged right above your comment, you should already have it :)

@talk2morris

Copy link
Copy Markdown

Thanks @rusackas I just upgraded to the latest release, however all my embeded charts stopped working. I am getting this error: 400 Bad Request: The CSRF session token is missing. Any thoughts on this?

@rusackas

Copy link
Copy Markdown
Member

Sorry, not sure what the cause of that would be.

@talk2morris

Copy link
Copy Markdown

okay, I was able to resolve that but now I have a new problem, the error is: Guest user cannot modify chart payload. Do you know how I can downgrade superset from 3.1.1 to 3.1.0?

@rusackas

Copy link
Copy Markdown
Member

@talk2morris that's being tracked here, you might want to ask on that thread if it's not already covered: #27177 (comment)

vinothkumar66 pushed a commit to vinothkumar66/superset that referenced this pull request Nov 11, 2024
sha174n pushed a commit to sha174n/superset that referenced this pull request Jan 2, 2026
This submission confirms that the Insecure Direct Object Reference (IDOR) vulnerability
in guest token chart access has been resolved.

- Verified that `tests/integration_tests/security/guest_token_security_tests.py` exists
  and contains `test_raise_for_access__chart_not_on_dashboard`.
- Ran the test successfully, confirming that attempting to access a chart not associated
  with the authorized dashboard raises a `SupersetSecurityException`.
- Identified PR apache#25081 as the one that enabled the secure logic for guest/embedded users.
- Confirmed that PR apache#24789 introduced the underlying security logic (Dashboard aware RBAC).

The vulnerability report is valid for older versions, but the issue is fixed in recent versions.
sha174n pushed a commit to sha174n/superset that referenced this pull request Jan 2, 2026
- Confirmed that the IDOR vulnerability allowing guest tokens to access
  charts from unauthorized dashboards is fixed.
- The fix was introduced in PR apache#25081 and released in Apache Superset 3.0.0.
- Verified by running existing integration tests in `tests/integration_tests/security/guest_token_security_tests.py`
  which explicitly check for this unauthorized access scenario and raise a `SupersetSecurityException`.
- No code changes were needed as the fix is already present in the codebase.
sha174n pushed a commit to sha174n/superset that referenced this pull request Jan 2, 2026
Confirmed that the vulnerability is fixed and identified the specific versions
and Pull Requests that addressed different aspects of the issue:

- **Strict IDOR (Accessing unauthorized charts):**
  - **Fixed in Version:** 3.0.0
  - **PR:** apache#25081 ("fix: Allow embedded guest user datasource access with dashboard context")
  - **Mechanism:** `raise_for_access` now validates that the chart belongs to the dashboard.

- **Payload Tampering (Modifying metrics/columns):**
  - **Fixed in Version:** 4.0.0
  - **PR:** apache#27484 ("fix: check if guest user modified query")
  - **Mechanism:** Introduced `query_context_modified` check.

- **Information Disclosure (Schema Leaks):**
  - **Fixed in Version:** 5.0.0
  - **PR:** apache#30858 ("fix(chart data): removing query from /chart/data payload when accessing as guest user")

Verified by running existing integration tests in `tests/integration_tests/security/guest_token_security_tests.py`
and temporarily adding a test case to simulate payload tampering, which successfully triggered a security exception.
sha174n pushed a commit to sha174n/superset that referenced this pull request Jan 2, 2026
- Confirmed strict IDOR fix (accessing unauthorized charts) was in 3.0.0 (PR apache#25081).
- Confirmed payload tampering fix (modifying metrics) was in 4.0.0 (PR apache#27484).
- Confirmed schema leak fix was in 5.0.0 (PR apache#30858).
- Verified via integration tests.
sha174n pushed a commit to sha174n/superset that referenced this pull request Jan 2, 2026
This commit confirms the fix for the reported Guest Token IDOR vulnerability
and payload tampering issues.

Findings:
- **Strict IDOR (Accessing unauthorized charts):**
  - **Fixed in Version:** 3.0.0
  - **PR:** apache#25081
  - **Verification:** Verified with standalone PoC `poc_idor.py`. Attempting to
    access a chart belonging to Dashboard B while authorized for Dashboard A
    raises a security exception.

- **Payload Tampering (Modifying metrics/columns):**
  - **Fixed in Version:** 4.0.0
  - **PR:** apache#27484
  - **Verification:** Verified with standalone PoC `poc_idor.py`. Attempting to
    modify metrics for an authorized chart raises a security exception.

- **Schema Leak:**
  - **Fixed in Version:** 5.0.0
  - **PR:** apache#30858

Verification method:
- Created and executed a standalone Proof-of-Concept script (`poc_idor.py`)
  that bootstraps the Superset app context, creates temporary dashboards/charts,
  issues a guest token, and attempts the exploits. Both exploits were blocked.
- Ran existing integration tests in `tests/integration_tests/security/guest_token_security_tests.py`.

No code changes required as fixes are already present.
qfcwell pushed a commit to qfcwell/superset that referenced this pull request May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/L v3.0 Label added by the release manager to track PRs to be included in the 3.0 branch 🍒 3.0.0 Cherry-picked to 3.0.0 🍒 3.0.1 Cherry-picked to 3.0.1 🍒 3.0.2 Cherry-picked to 3.0.2 🍒 3.0.3 Cherry-picked to 3.0.3 🍒 3.0.4 Cherry-picked to 3.0.4 🚢 3.1.0 First shipped in 3.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Filter box chart elements are returning an error asking for more permissions when embedded

8 participants