codeant-ai-for-open-source[bot] commented on code in PR #43473:
URL: https://github.com/apache/superset/pull/43473#discussion_r3845832813
##########
superset/utils/decorators.py:
##########
@@ -238,6 +243,11 @@ def on_error(
logger.exception(ex.exception)
if reraise:
+ if preserve_message:
+ # Prefer the DBAPI cause (e.g. sqlite3's "database is locked")
over
+ # SQLAlchemy's wrapper, which appends the offending SQL.
+ cause = getattr(ex, "orig", None) or ex
+ raise reraise(str(cause), ex) from ex
Review Comment:
**Suggestion:** The new `preserve_message` path copies the raw DBAPI
exception text into the `SupersetException` message. Because task create/update
exceptions serialize this message through their API error response,
backend-specific errors can disclose schema, table, connection, or other
database details to clients. Preserve only a sanitized/allowlisted operational
message, or keep the detailed cause in server-side logs while returning the
generic task error externally. [security]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ⚠️ GTF task creation errors can reveal backend database details.
- ⚠️ Chart/task API clients may receive driver-specific exception text.
- ⚠️ Error messages can expose SQL, schema, host, or table metadata.
```
</details>
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=4f0df067a2f440eaa3d4ee985983cbc0&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=4f0df067a2f440eaa3d4ee985983cbc0&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/utils/decorators.py
**Line:** 249:250
**Comment:**
*Security: The new `preserve_message` path copies the raw DBAPI
exception text into the `SupersetException` message. Because task create/update
exceptions serialize this message through their API error response,
backend-specific errors can disclose schema, table, connection, or other
database details to clients. Preserve only a sanitized/allowlisted operational
message, or keep the detailed cause in server-side logs while returning the
generic task error externally.
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%2F43473&comment_hash=bf54995909b0bc767ba428f4c98560e48946a0831e54b04a9a3dd57fc34f0fb7&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43473&comment_hash=bf54995909b0bc767ba428f4c98560e48946a0831e54b04a9a3dd57fc34f0fb7&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]