aminghadersohi commented on code in PR #36933:
URL: https://github.com/apache/superset/pull/36933#discussion_r2911846394
##########
superset/security/manager.py:
##########
@@ -2810,6 +2821,17 @@ def validate_guest_token_resources(resources:
GuestTokenResources) -> None:
embedded =
EmbeddedDashboardDAO.find_by_id(str(resource["id"]))
if not embedded:
raise EmbeddedDashboardNotFoundError()
+ elif resource["type"] ==
GuestTokenResourceType.CHART_PERMALINK.value:
+ # Validate that the chart permalink exists
+ permalink_key = str(resource["id"])
+ try:
+ permalink_value =
GetExplorePermalinkCommand(permalink_key).run()
+ if not permalink_value:
+ raise EmbeddedChartPermalinkNotFoundError()
+ except EmbeddedChartPermalinkNotFoundError:
+ raise
+ except (ExplorePermalinkGetFailedError, ValueError) as ex:
+ raise EmbeddedChartPermalinkNotFoundError() from ex
Review Comment:
The exception handling is intentionally specific. If
`GetExplorePermalinkCommand.run()` raises a `ChartAccessDeniedError`, that
should propagate up as an access denial rather than being converted into a
'permalink not found' error — masking an access denial as 'not found' would be
a security concern. Only genuine lookup failures
(`ExplorePermalinkGetFailedError`, `ValueError`) should be treated as 'not
found'.
--
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]