bito-code-review[bot] commented on code in PR #38392:
URL: https://github.com/apache/superset/pull/38392#discussion_r2882811826


##########
superset/mcp_service/chart/tool/generate_chart.py:
##########
@@ -384,6 +509,67 @@ async def generate_chart(  # noqa: C901
                 if form_data_key_list:
                     form_data_key = form_data_key_list[0]
 
+            # Compile check for preview-only mode
+            await ctx.report_progress(3, 5, "Running compile check (test 
query)")
+            numeric_dataset_id: int | None = None
+            if isinstance(request.dataset_id, int):
+                numeric_dataset_id = request.dataset_id
+            elif isinstance(request.dataset_id, str) and 
request.dataset_id.isdigit():
+                numeric_dataset_id = int(request.dataset_id)
+            else:
+                from superset.daos.dataset import DatasetDAO
+
+                ds = DatasetDAO.find_by_id(request.dataset_id, 
id_column="uuid")
+                if ds:
+                    numeric_dataset_id = ds.id

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Security: Missing permission check in preview 
compile</b></div>
   <div id="fix">
   
   The preview compile check fetches datasets without permission validation, 
unlike the save_chart path. This could allow users to probe compilation of 
inaccessible datasets via UUID. Add has_dataset_access checks after dataset 
lookup to prevent unauthorized information disclosure.
   </div>
   
   
   </div>
   
   <details>
   <summary><b>Citations</b></summary>
   <ul>
   
   <li>
   Rule Violated: <a 
href="https://github.com/apache/superset/blob/a570d28/superset/mcp_service/CLAUDE.md#L202";>CLAUDE.md:202</a>
   </li>
   
   </ul>
   </details>
   
   
   
   
   <small><i>Code Review Run #146e02</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a 
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



-- 
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