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


##########
superset/commands/sql_lab/execute.py:
##########
@@ -151,6 +151,15 @@ def _run_sql_json_exec_from_scratch(self) -> 
SqlJsonExecutionStatus:
             self._validate_access(query, 
self._execution_context.template_params)
             self._execution_context.set_query(query)
             rendered_query = 
self._sql_query_render.render(self._execution_context)
+            # The check above authorizes a render of query.sql + 
template_params
+            # performed before rendering, so that macros with side effects are
+            # gated before they run. self._sql_query_render.render() above is 
an
+            # independent second render of the same source; for a
+            # nondeterministic template (e.g. one using Jinja's `random` filter
+            # to pick a table) the two renders can diverge, letting a query
+            # read a table the first check never saw. Re-validate the literal
+            # rendered text that is about to execute.
+            self._validate_rendered_access(query, rendered_query)

Review Comment:
   ✅ **Customized review instruction saved!**
   
   **Instruction:**
   > Do not flag SQL_QUERY_MUTATOR rewrites as authorization gaps; treat 
operator-configured mutators as trusted code and focus validation findings on 
untrusted template-rendering behavior.
   
   **Applied to:**
     - `superset/commands/sql_lab/execute.py`
   
   ---
   💡 *To manage or update this instruction, visit: [CodeAnt AI 
Settings](https://app.codeant.ai/org/settings/learnings)*



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