codeant-ai-for-open-source[bot] commented on code in PR #43066:
URL: https://github.com/apache/superset/pull/43066#discussion_r3761651481
##########
superset/dashboards/filters.py:
##########
@@ -192,24 +193,13 @@ def _apply_viewers(self, query: Query) -> Query:
if user_id:
filters.append(Dashboard.id.in_(extra_dashboards_filter(user_id)))
- # (D) Embedded: preserved as-is
+ # Reuse the shared guest scoping so the dashboard list and chart list
+ # agree on visibility.
if is_feature_enabled("EMBEDDED_SUPERSET") and
security_manager.is_guest_user(
g.user
):
- guest_user: GuestUser = g.user
- embedded_dashboard_ids = [
- r["id"]
- for r in guest_user.resources
- if r["type"] == GuestTokenResourceType.DASHBOARD.value
- ]
- condition = (
- Dashboard.embedded.any(
- EmbeddedDashboard.uuid.in_(embedded_dashboard_ids)
- )
- if any(is_uuid(id_) for id_ in embedded_dashboard_ids)
- else Dashboard.id.in_(embedded_dashboard_ids)
- )
- filters.append(condition)
+ if (guest_condition := guest_embedded_dashboard_filter()) is not
None:
+ filters.append(guest_condition)
Review Comment:
**Suggestion:** Appending `guest_condition` to the existing access
alternatives and later combining them with `or_` does not scope guests to their
token dashboards. A guest who has ordinary viewer, editor, dataset, or
extra-filter access can still receive dashboards absent from the guest token.
Apply the guest condition as the sole access predicate for guest users, as
`ChartFilter` does; the same issue exists in the legacy branch where it is
added to `feature_flagged_filters`. [security]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ⚠️ Guest dashboard listings can include dashboards absent from token
resources.
- ⚠️ Dashboard metadata visibility becomes broader than token scoping.
- ⚠️ Legacy and viewer-enabled filters exhibit the same widening.
```
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=ef321cd7f2664609b0964d1270a46ffd&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=ef321cd7f2664609b0964d1270a46ffd&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/dashboards/filters.py
**Line:** 196:203
**Comment:**
*Security: Appending `guest_condition` to the existing access
alternatives and later combining them with `or_` does not scope guests to their
token dashboards. A guest who has ordinary viewer, editor, dataset, or
extra-filter access can still receive dashboards absent from the guest token.
Apply the guest condition as the sole access predicate for guest users, as
`ChartFilter` does; the same issue exists in the legacy branch where it is
added to `feature_flagged_filters`.
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=a23645d2457324828b2fd136a838c48b67eb74176e64528df6950afa2e7e6872&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43066&comment_hash=a23645d2457324828b2fd136a838c48b67eb74176e64528df6950afa2e7e6872&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]