github-advanced-security[bot] commented on code in PR #39925:
URL: https://github.com/apache/superset/pull/39925#discussion_r3291730258


##########
superset/views/core.py:
##########
@@ -448,7 +423,18 @@
         key: str | None = None,
     ) -> FlaskResponse:
         if request.method == "GET":
-            return redirect(Superset.get_redirect_url())
+            # Share the form_data → form_data_key cache-and-redirect contract
+            # with `ExploreView.root` via the lifted helper. Helper returns
+            # ``None`` for: empty/non-dict form_data, missing datasource,
+            # malformed datasource (AF-2), invalid `DatasourceType` (AF-2),
+            # cache-write failure (loop guard), and "already at target" loop
+            # guard. Falling through to `super().render_app_template()` kills
+            # the typed-entry `/explore/<dst>/<int:dsid>/` GET loop that the
+            # `isinstance(dict)` gate alone missed.
+            redirect_url = get_explore_redirect_url()
+            if redirect_url:
+                return redirect(redirect_url)

Review Comment:
   ## CodeQL / URL redirection from remote source
   
   Untrusted URL redirection depends on a [user-provided value](1).
   
   [Show more 
details](https://github.com/apache/superset/security/code-scanning/2287)



##########
superset/views/explore.py:
##########
@@ -33,11 +35,26 @@
     @permission_name("read")
     @event_logger.log_this
     def root(self) -> FlaskResponse:
+        # After `Superset.route_base = ""`, both `Superset.explore` and this
+        # view register at `/explore/`; this view wins. Preserve the legacy
+        # form_data → form_data_key cache-and-redirect contract via the
+        # shared `get_explore_redirect_url` helper (lives in `views/utils.py`
+        # so both callers share the same guards: AF-2 malformed datasource,
+        # AF-3 non-numeric slice_id, cache-write failure, loop guard). The
+        # helper returns ``None`` for any case that would otherwise loop;
+        # we render the SPA in that branch.
+        if redirect_url := get_explore_redirect_url():
+            return redirect(redirect_url)

Review Comment:
   ## CodeQL / URL redirection from remote source
   
   Untrusted URL redirection depends on a [user-provided value](1).
   
   [Show more 
details](https://github.com/apache/superset/security/code-scanning/2288)



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