anupamme commented on code in PR #40026:
URL: https://github.com/apache/superset/pull/40026#discussion_r3220150286


##########
superset/security/api.py:
##########
@@ -171,6 +171,19 @@ def guest_token(self) -> Response:
         try:
             body = guest_token_create_schema.load(request.json)
             
self.appbuilder.sm.validate_guest_token_resources(body["resources"])
+            # Verify requesting user has access to each specified resource
+            for resource in body["resources"]:
+                if resource["type"] == GuestTokenResourceType.DASHBOARD.value:
+                    from superset.models.embedded_dashboard import 
EmbeddedDashboard  # noqa: PLC0415
+                    embedded = (
+                        db.session.query(EmbeddedDashboard)
+                        .filter_by(uuid=resource["id"])
+                        .one_or_none()
+                    )
+                    if embedded and not 
self.appbuilder.sm.can_access_dashboard(
+                        embedded.dashboard
+                    ):
+                        raise ForbiddenError()

Review Comment:
   @orbisai0security can you address the code review comments?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to