codeant-ai-for-open-source[bot] commented on code in PR #42929:
URL: https://github.com/apache/superset/pull/42929#discussion_r3742441611
##########
superset/commands/report/alert.py:
##########
@@ -220,6 +235,17 @@ def _execute_query(self) -> pd.DataFrame:
raise ReportScheduleExecutorNotFoundError(username)
with override_user(user):
+ # Run table-level authorization as the executing user against
+ # the rendered SQL.
+ try:
+ security_manager.raise_for_access(
+ database=self._report_schedule.database,
+ sql=rendered_sql,
+ )
Review Comment:
**Suggestion:** Use strict dataset matching when authorizing the raw
rendered alert SQL. The default `raise_for_access` behavior permits catalog or
schema permissions and can authorize references to unregistered tables,
allowing an executor with broad database-level access to run alert queries
against tables for which no datasource access has been granted. [security]
<details>
<summary><b>Severity Level:</b> Critical 🚨</summary>
```mdx
- ❌ Executor can read unregistered database tables.
- ❌ Alert results can expose unauthorized datasource data.
- ⚠️ Authorization differs from SQL Lab strict scoping.
```
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=46e444fe6d9f4342be193fb5b62a15f9&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=46e444fe6d9f4342be193fb5b62a15f9&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
*(Use Cmd/Ctrl + Click for best experience)*
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset/commands/report/alert.py
**Line:** 241:244
**Comment:**
*Security: Use strict dataset matching when authorizing the raw
rendered alert SQL. The default `raise_for_access` behavior permits catalog or
schema permissions and can authorize references to unregistered tables,
allowing an executor with broad database-level access to run alert queries
against tables for which no datasource access has been granted.
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%2F42929&comment_hash=604c703278b1eda45254f35b7a74efa573827b68357563235551581d21afc09e&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42929&comment_hash=604c703278b1eda45254f35b7a74efa573827b68357563235551581d21afc09e&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]