dpgaspar commented on code in PR #35345:
URL: https://github.com/apache/superset/pull/35345#discussion_r2415796698


##########
superset/views/core.py:
##########
@@ -765,13 +765,21 @@ def dashboard(
         dashboard = Dashboard.get(dashboard_id_or_slug)
 
         if not dashboard:
+            if g.user is None or g.user.is_anonymous:
+                return redirect_to_login()
             abort(404)
 
+        # Redirect anonymous users to login for unpublished dashboards,
+        # in the edge case where a dataset has been shared with public
+        if (g.user is None or g.user.is_anonymous) and not dashboard.published:
+            return redirect_to_login()
+
         try:
             dashboard.raise_for_access()
         except SupersetSecurityException:
-            # Return 404 to avoid revealing dashboard existence
-            return Response(status=404)
+            if g.user is None or g.user.is_anonymous:

Review Comment:
   use `get_current_user` ?



##########
superset/views/core.py:
##########
@@ -765,13 +765,21 @@ def dashboard(
         dashboard = Dashboard.get(dashboard_id_or_slug)
 
         if not dashboard:
+            if g.user is None or g.user.is_anonymous:

Review Comment:
   We could use `get_current_user` instead on `superset.utils`



##########
superset/views/core.py:
##########
@@ -765,13 +765,21 @@ def dashboard(
         dashboard = Dashboard.get(dashboard_id_or_slug)
 
         if not dashboard:
+            if g.user is None or g.user.is_anonymous:
+                return redirect_to_login()
             abort(404)
 
+        # Redirect anonymous users to login for unpublished dashboards,
+        # in the edge case where a dataset has been shared with public
+        if (g.user is None or g.user.is_anonymous) and not dashboard.published:

Review Comment:
   use `get_current_user` ?



-- 
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