-
Notifications
You must be signed in to change notification settings - Fork 14.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add check_ownership call in save_or_overwrite_slice #3498
Comments
Have you read the security documentation section? |
@xmrx Yes, as explained here: https://superset.incubator.apache.org/security.html#permissions The roles given to the test user:
Neither of these permissions allow a user to create or edit slices and dashboards. The problem comes from the
|
My understanding is that |
@xmrx The documentation implies that From the security documentation:
I'm reading that as "Granting Meanwhile, Model permissions are used to let a user add / edit slices and dashboards. If I don't give the user
Am I reading that wrong? If so, is there no way to let users see existing dashboards while preventing them from creating dashboards? |
That's right, it looks like there's a |
@jaylindquist check these lines we checked all permissions and passing down to |
Hi @graceguo-supercat Unfortunately I can't get SuperSet to build locally right now so I can't test, but... The dialog presented to the user gives them the option to save / overwrite slices as well as save / overwrite dashboards. So, the above check that gives the user an error when saving / overwriting the slice will need to be two-fold: if action == 'overwrite' and not slice_overwrite_perm:
return json_error_response("You don't have the rights to alter this slice", status=400)
if action == 'saveas' and not slice_add_perm:
return json_error_response("You don't have the rights to create a slice", status=400) If the user has those permissions, a dashboard permission check would be needed before the section saving / creating dashboards: dash = ... # find dashboard from request
check_ownership(dash, raise_if_false=True)
... # update dashboard dash_add_perm = self.can_access('can_add', 'DashboardModelView')
if request.args.get('add_to_dash') == 'new' and not dash_add_perm:
return json_error_response("You don't have the rights to create a dashboard", status=400)
# ... save dashboard That is mostly psuedo-code since I can't actually test it right now and I'm not sure the best design for error handling here. Also, from a UX viewpoint, it would be nice to have the "Save" button in the explore view be disabled if the user doesn't have the ability to save / alter slices, but I have no idea what those changes would look like. |
Doesn't this problem also exist on a dashboard level? Users with read only access are able to delete slices from the dashboard and save the dashboard. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue |
Make sure these boxes are checked before submitting your issue - thank you!
Superset version
Expected results
Only users with proper permissions can create or update dashboards or change slices
Actual results
A user with the following two permissions can add a slice to a new dashboard, add a slice to an existing dashboard, overwrite the definition of an existing slice.
can explore on Superset
all datasource access on all_datasource_access
Steps to reproduce
ReadOnly
with the following permissionscan explore on Superset
all datasource access on all_datasource_access
test
and add the user to theReadOnly
roletest
This will create a new dashboard called 'new-dash' owned by the
test
user.Simplifying the URL can cause a lot of other issues. For instance if the
test
user goes toThey can overwrite slice ID 22 while creating the new dashboard
Changing the parameters to
add_to_dash=existing&save_to_dashboard_id=1
will allow them to add slices to existing dashboards as well.The text was updated successfully, but these errors were encountered: