superset: /api/v1/chart/{pk}/data does not respect Guest Token resource limitations
When creating a guest token with resources to allow access to (namely dashboards), access to charts should be limited to those on that dashboard.
How to reproduce the bug
- Create a guest token using the /api/v1/security/guest_token endpoint, giving it some dashboard:
{
"user": {},
"resources": [
{
"type": "dashboard",
"id": "user-dash"
}
],
"rls": []
}
- Use this guest token with the header X-Guesttoken (or whatever the config is set to for guest token headers) to grab a chart at /api/v1/chart/{pk}/data with a chart NOT on the above given dashboard
- See data is pulled back
Expected results
Some unauthorized error.
Actual results
Data is correctly pulled back from any chart.
Screenshots
If applicable, add screenshots to help explain your problem.
Environment
(please complete the following information):
- browser type and version:
- superset version:
superset version - python version:
python --version - node.js version:
node -v - any feature flags active: EMBEDDED_SUPERSET
Checklist
Make sure to follow these steps before submitting your issue - thank you!
- I have checked the superset logs for python stacktraces and included it here as text if there are any.
- I have reproduced the issue with at least the latest released version of superset.
- I have checked the issue tracker for the same issue and I haven’t found one similar.
Additional context
This could also be considered a security issue, since RLS is also applied to guest tokens. In our case, we have some dashboards that do not need RLS and some that absolutely need them. The only way (without changing the dataset) to disable RLS for embedded dashboards is by creating a guest token without them, there are no settings on dashboards/charts to ignore it.
The workaround we’re doing is to add false as rls_required to our datasets, and either having RLS clauses per user or having the clause “rls_required=false” which will error out charts without that column. This isn’t a desirable workaround.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 2
- Comments: 15 (6 by maintainers)
Hi @jfrag1 let me simplify this : -> We have created a role for embed_dashboard, which is assigned to the user who creates the guest token. -> Now embed_dashboard role has all dataset access -> User-created guest token with dashboard_id 1 -> dashboard_id 1 uses two datasets which are dataset_1 and dataset_2. -> Now when the user creates a guest token with resource_id (dashboard in this case) can get all datasets data by hitting the above-mentioned API. Ideally, user should be able to access the dataset which is used in that resource only(In this case dataset_1 and dataset_2). (Mapping of permission in guest token about which dataset to show and which dataset not, also have to consider the resource it is being created on.)*
@jfrag1 thanks for the help I got your point
Summary on conversation
which is correct
I think we can close this issue as well (For resourse access we can raise a new issue)