sha174n commented on code in PR #45453:
URL: https://github.com/apache/superset/pull/45453#discussion_r4314144666
##########
superset/connectors/sqla/utils.py:
##########
@@ -203,6 +203,25 @@ def get_columns_description(
limit = database.get_column_description_limit_size()
query = database.apply_limit_to_sql(query, limit=limit)
mutated_query = database.mutate_sql_based_on_config(query)
+ # Callers validate the pre-mutation SQL is a single statement, but
+ # the mutator runs afterwards. Re-assert it on the mutated text so
a
+ # mutator that rewrites the query cannot turn one statement into
+ # several. Fail open when the dialect's parser cannot read the
+ # mutated text, to avoid blocking a legitimate probe.
+ try:
+ mutated_statement_count = len(
+ SQLScript(mutated_query,
engine=db_engine_spec.engine).statements
+ )
+ except SupersetParseError:
+ mutated_statement_count = 1
+ if mutated_statement_count > 1:
Review Comment:
The post-mutation recheck also rejects non-SELECT output, via a helper
shared with the caller's check, in c06fd1d2c0.
--
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]