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


##########
superset-frontend/src/pages/SqlLab/LocationContext.tsx:
##########
@@ -41,12 +41,18 @@ export const LocationProvider: FC<{ children?: ReactNode }> 
= ({
   const queryParams = new URLSearchParams(location.search);
   const permalink = location.pathname.match(/\/p\/\w+/)?.[0].slice(3);
   if (queryParams.size > 0 || permalink) {
-    const autorun = queryParams.get('autorun') === 'true';
+    // SECURITY: never honor `autorun` from the URL querystring. A crafted
+    // cross-site GET link (?dbid=..&sql=..&autorun=true) is a top-level
+    // navigation, so SameSite=Lax cookies are sent and the attacker-chosen
+    // SQL would execute in the victim's session the moment SQL Lab mounts.
+    // Only in-app navigations that pass `location.state` (handled above)
+    // may request autorun; deep links prefill the editor and wait for the
+    // user to press Run.
     const isDataset = queryParams.get('isDataset') === 'true';
     const queryParamsState = {
       requestedQuery: {
         ...Object.fromEntries(queryParams),
-        autorun,
+        autorun: false,

Review Comment:
   **Suggestion:** The forced `autorun: false` is not preserved end to end: 
`PopEditorTab` later merges `bootstrapData.requested_query` after this 
`requestedQuery`, so a server-provided `autorun: true` can overwrite the 
protected value before `addQueryEditor` receives it. Sanitize or override 
`autorun` at the final merge/consumer boundary so URL-derived requests can 
never auto-execute SQL. [security]
   
   <details>
   <summary><b>Severity Level:</b> Critical 🚨</summary>
   
   ```mdx
   - ❌ URL-derived SQL can execute automatically in the user session.
   - ❌ SQL Lab's new autorun trust boundary is bypassed.
   - ⚠️ The vulnerable path requires a crafted POST/bootstrap payload.
   ```
   </details>
   
   [![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)
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/src/pages/SqlLab/LocationContext.tsx
   **Line:** 55:55
   **Comment:**
        *Security: The forced `autorun: false` is not preserved end to end: 
`PopEditorTab` later merges `bootstrapData.requested_query` after this 
`requestedQuery`, so a server-provided `autorun: true` can overwrite the 
protected value before `addQueryEditor` receives it. Sanitize or override 
`autorun` at the final merge/consumer boundary so URL-derived requests can 
never auto-execute SQL.
   
   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%2F43398&comment_hash=497c90e5164dee25c06d2ba071c94636c6c6b7039d6cb51ef032a3076596e235&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43398&comment_hash=497c90e5164dee25c06d2ba071c94636c6c6b7039d6cb51ef032a3076596e235&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