codeant-ai-for-open-source[bot] commented on code in PR #37516:
URL: https://github.com/apache/superset/pull/37516#discussion_r3610259194
##########
superset/common/query_context_processor.py:
##########
@@ -551,7 +1013,7 @@ def raise_for_access(self) -> None:
# come first to avoid rendering caller-supplied input for a resource
the
# caller is not allowed to access.
if self._qc_datasource.type == DatasourceType.QUERY:
- security_manager.raise_for_access(query=self._qc_datasource)
+ cast("SqlLabQuery", self._qc_datasource).raise_for_explore_access()
else:
security_manager.raise_for_access(query_context=self._query_context)
Review Comment:
**Suggestion:** Use `security_manager.raise_for_access(...)` for the query
datasource access check as well, so query-bearing resources are consistently
authorized via the centralized access API. [custom_rule_security]
**Severity Level:** Critical 🚨
<details>
<summary><b>Why it matters? ⭐ </b></summary>
The rule requires `security_manager.raise_for_access(...)` for data-bearing
resources, including queries and query contexts. This code uses
`raise_for_explore_access()` for `DatasourceType.QUERY` instead of the
centralized security manager call, so the suggestion identifies a real rule
violation.
</details>
<details>
<summary><b>Rule source 📖 </b></summary>
=== .github/copilot-instructions.md === (line 79)
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=16a8d9c684a3420f83b9452ff49697ad&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=16a8d9c684a3420f83b9452ff49697ad&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/common/query_context_processor.py
**Line:** 1015:1018
**Comment:**
*Custom Rule Security: Use `security_manager.raise_for_access(...)` for
the query datasource access check as well, so query-bearing resources are
consistently authorized via the centralized access API.
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%2F37516&comment_hash=cf913e4c2aa6b7f95fa4d8d2187c6e3ec2f0bcec492415f593895adf91376fa3&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F37516&comment_hash=cf913e4c2aa6b7f95fa4d8d2187c6e3ec2f0bcec492415f593895adf91376fa3&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]