codeant-ai-for-open-source[bot] commented on code in PR #44968:
URL: https://github.com/apache/superset/pull/44968#discussion_r4179128289
##########
superset/commands/sql_lab/estimate.py:
##########
@@ -91,7 +92,7 @@ def validate(self) -> None:
catalog=self._catalog,
schema=self._schema or None,
template_params=self._template_params,
- force_dataset_match=True,
+ force_dataset_match=requires_dataset_match(),
Review Comment:
**Suggestion:** With nonempty template parameters, `validate()` authorizes
one Jinja rendering while `run()` renders again, allowing cost estimation of a
table without its dataset grant.
**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=61fb8a68a209457b8cef8199b2474e36&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=61fb8a68a209457b8cef8199b2474e36&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/commands/sql_lab/estimate.py
**Line:** 95:95
**Comment:**
*Security: With nonempty template parameters, `validate()` authorizes
one Jinja rendering while `run()` renders again, allowing cost estimation of a
table without its dataset grant.
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%2F44968&comment_hash=34cc3d14d31e89aca4f198bbd99c0991ef62c5d520752481337cb4649a871430&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44968&comment_hash=34cc3d14d31e89aca4f198bbd99c0991ef62c5d520752481337cb4649a871430&reaction=dislike'>๐</a>
##########
superset/mcp_service/sql_lab/tool/execute_sql.py:
##########
@@ -182,17 +183,16 @@ async def execute_sql(request: ExecuteSqlRequest, ctx:
Context) -> ExecuteSqlRes
# Authorize through the same entry point as the SQL Lab
# execution path (``superset/sqllab/validators.py``), so both
- # surfaces scope a query the same way: it covers database-level
- # access and, for a user without it, requires every table the
- # query references to resolve to a dataset they are granted.
+ # surfaces scope a query the same way, including
+ # ``SQLLAB_REQUIRE_DATASET_MATCH``.
try:
security_manager.raise_for_access(
database=database,
sql=request.sql,
catalog=request.catalog,
schema=request.schema_name,
template_params=template_params,
- force_dataset_match=True,
+ force_dataset_match=requires_dataset_match(),
Review Comment:
**Suggestion:** `raise_for_access` checks one Jinja rendering, but
`database.execute` renders the source again; a changing template can execute
against a table the user cannot access.
**Assessment:** ๐ด `Critical` ยท ๐ `Occurrence: Rarely` ยท ๐ท๏ธ `Security`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=fe2943a15c5f4afe9fd0f72de2d9bf8d&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=fe2943a15c5f4afe9fd0f72de2d9bf8d&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/sql_lab/tool/execute_sql.py
**Line:** 195:195
**Comment:**
*Security: `raise_for_access` checks one Jinja rendering, but
`database.execute` renders the source again; a changing template can execute
against a table the user cannot access.
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%2F44968&comment_hash=445499ca73402e98ed6e2222ab0c0d32b2f60c8ad469744e88351eaea5b30d50&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44968&comment_hash=445499ca73402e98ed6e2222ab0c0d32b2f60c8ad469744e88351eaea5b30d50&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]