codeant-ai-for-open-source[bot] commented on code in PR #44338:
URL: https://github.com/apache/superset/pull/44338#discussion_r4059769438


##########
superset/mcp_service/chart/tool/get_chart_info.py:
##########
@@ -86,6 +91,106 @@ def _build_unsaved_chart_info(form_data_key: str) -> 
ChartInfo | ChartError:
     )
 
 
+def _get_explore_permalink(
+    permalink_key: str,
+) -> ExplorePermalinkValue | ChartError:
+    """Read an Explore permalink, enforcing the same access checks as Explore.
+
+    ``GetExplorePermalinkCommand`` checks access to the permalink's datasource
+    and, when it references a saved chart, to that chart.
+    """
+    from superset.commands.explore.permalink.get import 
GetExplorePermalinkCommand
+
+    try:
+        value = GetExplorePermalinkCommand(permalink_key).run()
+    except ForbiddenError:
+        return ChartError(
+            error="You do not have access to the chart or dataset in this 
permalink.",
+            error_type="PermalinkAccessDenied",
+        )
+    except (CommandException, SQLAlchemyError, ValidationError, ValueError) as 
ex:

Review Comment:
   ✅ **CodeAnt verified this suggestion was addressed in subsequent commits and 
marked this thread resolved** as of `7fdc69e`.
   
   Added handling for SupersetTemplateException and SupersetParseError, logging 
the failure and returning an InvalidPermalink ChartError instead of letting the 
exception escape.
   
   <sub>If that's not right, unresolve this thread and CodeAnt will leave it 
open.</sub>
   
   <!-- codeant-auto-resolve-reply -->



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