File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -319,6 +319,13 @@ def _get_schema_using_query(self, query: str) -> sch.Schema:
319
319
# us to pre-filter the columns we want back.
320
320
# The syntax is:
321
321
# `sys.dm_exec_describe_first_result_set(@tsql, @params, @include_browse_information)`
322
+ #
323
+ # Yes, this *is* a SQL injection risk, but it's not clear how to avoid
324
+ # that since we allow users to pass arbitrary SQL.
325
+ #
326
+ # SQLGlot has a bug that forces capitalization of
327
+ # `dm_exec_describe_first_result_set`, so we can't even use its builder
328
+ # APIs. That doesn't really solve the injection problem though.
322
329
query = f"""
323
330
SELECT
324
331
name,
@@ -330,7 +337,7 @@ def _get_schema_using_query(self, query: str) -> sch.Schema:
330
337
error_message
331
338
FROM sys.dm_exec_describe_first_result_set(N{ tsql } , NULL, 0)
332
339
ORDER BY column_ordinal
333
- """
340
+ """ # noqa: S608
334
341
with self ._safe_raw_sql (query ) as cur :
335
342
rows = cur .fetchall ()
336
343
You can’t perform that action at this time.
0 commit comments