codeant-ai-for-open-source[bot] commented on code in PR #45984:
URL: https://github.com/apache/superset/pull/45984#discussion_r4457305341
##########
superset/mcp_service/auth.py:
##########
@@ -185,11 +185,16 @@ def _get_token_scopes() -> set[str] | None:
if access_token is None:
return None
- scopes = getattr(access_token, "scopes", None)
- if not scopes:
+ scopes_from_token = getattr(access_token, "scopes", None)
+ if not scopes_from_token:
# Token present but no scopes advertised: do NOT enforce scope checks.
return None
- return {str(s) for s in scopes}
+ ignored_scopes = current_app.config.get("MCP_IGNORED_SCOPES", {})
+ scopes = {str(s) for s in scopes_from_token if str(s) not in
ignored_scopes}
Review Comment:
**Suggestion:** `access_token` can be an API key, so this removes per-key
scopes too. If all match, scope checks are skipped and RBAC alone can authorize
actions the key forbids.
**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=15298079e8d2400cb9947f9cde83e78a&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=15298079e8d2400cb9947f9cde83e78a&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/auth.py
**Line:** 193:193
**Comment:**
*Security: `access_token` can be an API key, so this removes per-key
scopes too. If all match, scope checks are skipped and RBAC alone can authorize
actions the key forbids.
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%2F45984&comment_hash=3aa2929e2de815e843a7a5293f05f7d8b614b432538bd04911222c417cfd52b6&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45984&comment_hash=3aa2929e2de815e843a7a5293f05f7d8b614b432538bd04911222c417cfd52b6&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]