codeant-ai-for-open-source[bot] commented on code in PR #43066:
URL: https://github.com/apache/superset/pull/43066#discussion_r3768443814
##########
superset/utils/filters.py:
##########
@@ -87,4 +92,6 @@ def guest_embedded_dashboard_filter() ->
Optional[ColumnElement[bool]]:
# branch and has_guest_access); a guest is only ever scoped to embedded
# dashboards, never a plain internal id.
conditions.append(and_(Dashboard.id.in_(int_ids),
Dashboard.embedded.any()))
+ if slug_ids:
+ conditions.append(and_(Dashboard.slug.in_(slug_ids),
Dashboard.embedded.any()))
Review Comment:
**Suggestion:** The slug predicate can resolve a dashboard for a guest, but
the downstream `security_manager.has_guest_access()` contract only compares
token resources with `Dashboard.id` and the embedded dashboard UUID, not
`Dashboard.slug`. Consequently, slug-based charts pass the SQL lookup but
`guest_dashboard_id()` returns `None`, so the MCP data path does not attach the
dashboard context and the request is denied later instead of successfully
returning the authorized chart data. Resolve slugs to dashboard IDs before
applying this filter or extend the guest-access check to recognize slugs. [api
mismatch]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ❌ Slug-based guest MCP chart reads fail authorization.
- ⚠️ UUID- and numeric-resource tokens remain unaffected.
- ⚠️ Guest users receive an access error instead of chart data.
```
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=ed791d23c0e2428d8da04720e76d282d&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=ed791d23c0e2428d8da04720e76d282d&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/filters.py
**Line:** 95:96
**Comment:**
*Api Mismatch: The slug predicate can resolve a dashboard for a guest,
but the downstream `security_manager.has_guest_access()` contract only compares
token resources with `Dashboard.id` and the embedded dashboard UUID, not
`Dashboard.slug`. Consequently, slug-based charts pass the SQL lookup but
`guest_dashboard_id()` returns `None`, so the MCP data path does not attach the
dashboard context and the request is denied later instead of successfully
returning the authorized chart data. Resolve slugs to dashboard IDs before
applying this filter or extend the guest-access check to recognize slugs.
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%2F43066&comment_hash=a8fc76d36ffe5c808c1527eeff8e6ecf97c23ae8e28daa21acf1f62b909715c0&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43066&comment_hash=a8fc76d36ffe5c808c1527eeff8e6ecf97c23ae8e28daa21acf1f62b909715c0&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]