codeant-ai-for-open-source[bot] commented on code in PR #44393:
URL: https://github.com/apache/superset/pull/44393#discussion_r4053927162
##########
superset/mcp_service/chart/tool/update_chart.py:
##########
@@ -834,8 +1005,30 @@ async def update_chart( # noqa: C901
# enforced by mcp_auth_hook.
from superset.mcp_service.auth import check_chart_data_access
- validation_result = check_chart_data_access(chart)
- if not validation_result.is_valid:
+ validation_result: DatasetValidationResult | None
+ if _chart_datasource_type(chart) == DatasourceType.SEMANTIC_VIEW.value:
+ # Views share the id space with datasets: never look the id up
+ # through DatasetDAO.
+ view_ok: bool = resolve_semantic_view(chart.datasource_id) is not
None
+ if not view_ok:
+ error_msg: str =
view_not_found_error(chart.datasource_id).message
+ return GenerateChartResponse.model_validate(
+ {
+ "chart": None,
+ "error": {
+ "error_type": "DatasetNotAccessible",
+ "message": error_msg,
+ "details": error_msg,
+ },
+ "success": False,
+ "schema_version": "2.0",
+ "api_version": "v1",
+ }
+ )
+ validation_result = None
+ else:
+ validation_result = check_chart_data_access(chart)
Review Comment:
**Suggestion:** Rebinding from a semantic view to a table checks only the
chart's current source, so users without target-dataset access can still
receive a preview URL.
**Assessment:** ๐ `Major` ยท ๐ `Occurrence: Sometimes` ยท ๐ท๏ธ `Security`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=ba0c48cb7a5a46caae352dc96118a677&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=ba0c48cb7a5a46caae352dc96118a677&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
<details>
<summary><b>Prompt for AI Agent ๐ค </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset/mcp_service/chart/tool/update_chart.py
**Line:** 1029:1030
**Comment:**
*Security: Rebinding from a semantic view to a table checks only the
chart's current source, so users without target-dataset access can still
receive a preview URL.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44393&comment_hash=bf7beb2a36dc150e69c92188e58ed9f3d761e1126a6c958649ac07422fed970f&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44393&comment_hash=bf7beb2a36dc150e69c92188e58ed9f3d761e1126a6c958649ac07422fed970f&reaction=dislike'>๐</a>
--
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]