codeant-ai-for-open-source[bot] commented on code in PR #45644:
URL: https://github.com/apache/superset/pull/45644#discussion_r4368957550


##########
superset/dashboards/api.py:
##########
@@ -2596,14 +2596,11 @@ def should_enqueue(cache_payload: 
ScreenshotCachePayload) -> bool:
                         )
                         return lock_response
 
+                    guest_user = 
security_manager.get_current_guest_user_if_guest()
                     try:
                         cache_dashboard_screenshot.delay(
                             username=get_current_user(),
-                            guest_token=(
-                                g.user.guest_token
-                                if get_current_user() and isinstance(g.user, 
GuestUser)
-                                else None
-                            ),
+                            guest_token=guest_user.guest_token if guest_user 
else None,

Review Comment:
   **Suggestion:** Guest attributes can change Jinja-rendered dashboard data, 
but the cache key excludes them; guests sharing a dashboard digest and state 
can receive a screenshot rendered with another guest’s attributes.
   
   **Assessment:** 🔴 `Critical` · 🔁 `Occurrence: Sometimes` · 🏷️ `Security`
   
   [![Use CodeAnt 
Skill](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/use-codeant-skill-flat-v2.svg)](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
 [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=4d39c6344a6b498eb083d6628515f4d4&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=4d39c6344a6b498eb083d6628515f4d4&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/api.py
   **Line:** 2603:2603
   **Comment:**
        *Security: Guest attributes can change Jinja-rendered dashboard data, 
but the cache key excludes them; guests sharing a dashboard digest and state 
can receive a screenshot rendered with another guest’s attributes.
   
   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%2F45644&comment_hash=cf062fd17cba6339db1868b5eff9833a62ec2622d1853f64d67c3cc10a38cc22&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45644&comment_hash=cf062fd17cba6339db1868b5eff9833a62ec2622d1853f64d67c3cc10a38cc22&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]

Reply via email to