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


##########
superset/commands/dashboard/export.py:
##########
@@ -441,4 +450,7 @@ def _export(
                     if dataset_id is not None:
                         dataset = DatasetDAO.find_by_id(dataset_id)
                         if dataset:
-                            yield from 
ExportDatasetsCommand([dataset_id]).run()
+                            # Pass the shared seen set to the dataset export 
command
+                            yield from ExportDatasetsCommand([dataset_id]).run(
+                                seen=seen
+                            )

Review Comment:
   **Suggestion:** Apply the same dataset authorization enforcement in this 
second dataset-export path by calling 
`security_manager.raise_for_access(datasource=dataset)` before running the 
export command. [custom_rule_security]
   
   **Severity Level:** Critical 🚨
   <details>
   <summary><b>Why it matters? ⭐ </b></summary>
   
   This second dataset-export branch has the same issue: it exports a dataset 
without first enforcing access via `security_manager.raise_for_access(...)`. 
Since datasets are explicitly in scope for the rule, the violation is real here 
as well.
   </details>
   <details>
   <summary><b>Rule source 📖 </b></summary>
   
   === .github/copilot-instructions.md === (line 79)
   </details>
   
   [![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=f87e382b482e48968d2bcc091745fd96&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=f87e382b482e48968d2bcc091745fd96&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/commands/dashboard/export.py
   **Line:** 453:456
   **Comment:**
        *Custom Rule Security: Apply the same dataset authorization enforcement 
in this second dataset-export path by calling 
`security_manager.raise_for_access(datasource=dataset)` before running the 
export command.
   
   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%2F37120&comment_hash=4c1f5286703696e739e67c1e28561c257243000daf408d6cb2f01b6cf1e60b22&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F37120&comment_hash=4c1f5286703696e739e67c1e28561c257243000daf408d6cb2f01b6cf1e60b22&reaction=dislike'>👎</a>



##########
superset/commands/dashboard/export.py:
##########
@@ -430,7 +436,10 @@ def _export(
                     if dataset_id is not None:
                         dataset = DatasetDAO.find_by_id(dataset_id)
                         if dataset:
-                            yield from 
ExportDatasetsCommand([dataset_id]).run()
+                            # Pass the shared seen set to the dataset export 
command
+                            yield from ExportDatasetsCommand([dataset_id]).run(
+                                seen=seen
+                            )

Review Comment:
   **Suggestion:** Before exporting each referenced dataset, enforce an 
authorization check with 
`security_manager.raise_for_access(datasource=dataset)` so dataset content is 
only exported when the caller is permitted. [custom_rule_security]
   
   **Severity Level:** Critical 🚨
   <details>
   <summary><b>Why it matters? ⭐ </b></summary>
   
   Datasets are data-bearing resources covered by the custom rule, and this 
code exports them without calling `security_manager.raise_for_access(...)`. The 
absence of that authorization check is a real rule violation.
   </details>
   <details>
   <summary><b>Rule source 📖 </b></summary>
   
   === .github/copilot-instructions.md === (line 79)
   </details>
   
   [![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=be6be4939e2d459a933f5ecfa7b0e395&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=be6be4939e2d459a933f5ecfa7b0e395&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/commands/dashboard/export.py
   **Line:** 439:442
   **Comment:**
        *Custom Rule Security: Before exporting each referenced dataset, 
enforce an authorization check with 
`security_manager.raise_for_access(datasource=dataset)` so dataset content is 
only exported when the caller is permitted.
   
   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%2F37120&comment_hash=08beff19bcb96b76a5861219230c9f5ecbc9bfca9770038b726db93b0e14fe2b&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F37120&comment_hash=08beff19bcb96b76a5861219230c9f5ecbc9bfca9770038b726db93b0e14fe2b&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