You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "jfrag1 (via GitHub)" <gi...@apache.org> on 2023/08/16 20:02:31 UTC

[GitHub] [superset] jfrag1 commented on a diff in pull request #25008: fix: Address regression introduced in #24789

jfrag1 commented on code in PR #25008:
URL: https://github.com/apache/superset/pull/25008#discussion_r1296370781


##########
superset/security/manager.py:
##########
@@ -1858,9 +1858,13 @@ def raise_for_access(
                 or self.can_access("datasource_access", datasource.perm or "")
                 or self.is_owner(datasource)
                 or (
+                    # Check whether the datasource is associated with a dashboard in a
+                    # trustworthy manner, i.e., we need to validate that the specified
+                    # dashboard is actually associated with said datasource.
                     form_data
                     and (dashboard_id := form_data.get("dashboardId"))
                     and (dashboard := DashboardDAO.find_by_id(dashboard_id))
+                    and any(slc.datasource == datasource for slc in dashboard.slices)
                     and self.can_access_dashboard(dashboard)

Review Comment:
   Another thing that occurred to me recently, shouldn't we only be doing this check if dashboard rbac is enabled (or if the user is a guest user for embedded purposes).
   
   For example before https://github.com/apache/superset/pull/24789 there was the following logic:
   ```python
   should_check_dashboard_access = (
       feature_flag_manager.is_feature_enabled("DASHBOARD_RBAC")
       or self.is_guest_user()
   )
   
   if not (
       self.can_access_schema(datasource)
       or self.can_access("datasource_access", datasource.perm or "")
       or self.is_owner(datasource)
       or (
            should_check_dashboard_access
            and self.can_access_based_on_dashboard(datasource)
   ```
   but now, we're checking if if the user can access the dataset via the dashboard no matter what



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org