codeant-ai-for-open-source[bot] commented on code in PR #44351:
URL: https://github.com/apache/superset/pull/44351#discussion_r4138841290
##########
superset/mcp_service/chart/tool/get_chart_sql.py:
##########
@@ -454,6 +455,17 @@ async def get_chart_sql(
try:
return await _handle_chart_sql_request(request, ctx)
+ except SQLAlchemyError as e:
+ await ctx.error(
+ "Chart SQL retrieval failed due to database session error: "
+ "identifier=%s, error_type=%s, error=%s"
+ % (request.identifier, type(e).__name__, str(e))
+ )
+ logger.exception("SQLAlchemy error in get_chart_sql: %s", e)
+ return ChartError(
+ error=f"Chart SQL retrieval failed due to a database session
error: {e}",
+ error_type="DatabaseError",
+ )
Review Comment:
**Suggestion:** Returning `str(e)` exposes SQLAlchemy details to MCP
callers, including possible table names, SQL fragments, constraint names, and
connection information.
**Assessment:** ๐ `Major` ยท ๐ `Occurrence: Rarely` ยท ๐ท๏ธ `Security`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=0977adc146584e43809a32fa87a6d938&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=0977adc146584e43809a32fa87a6d938&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/get_chart_sql.py
**Line:** 465:468
**Comment:**
*Security: Returning `str(e)` exposes SQLAlchemy details to MCP
callers, including possible table names, SQL fragments, constraint names, and
connection information.
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%2F44351&comment_hash=f5b00bb4d8c9b2f0aa7135a9c1b33614a31c008f720fa82ecad574e538e00fa1&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44351&comment_hash=f5b00bb4d8c9b2f0aa7135a9c1b33614a31c008f720fa82ecad574e538e00fa1&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]