Skip to content

Commit e009b8a

Browse files
committed
revert: Code security optimization
1 parent 7efa0a9 commit e009b8a

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

backend/apps/db/db.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -386,8 +386,7 @@ def get_tables(ds: CoreDatasource):
386386
password=conf.password,
387387
options=f"-c statement_timeout={conf.timeout * 1000}",
388388
**extra_config_dict) as conn, conn.cursor() as cursor:
389-
# Use parameterized query for security
390-
cursor.execute(sql, (sql_param,))
389+
cursor.execute(sql.format(sql_param))
391390
res = cursor.fetchall()
392391
res_list = [TableSchema(*item) for item in res]
393392
return res_list
@@ -438,8 +437,7 @@ def get_fields(ds: CoreDatasource, table_name: str = None):
438437
password=conf.password,
439438
options=f"-c statement_timeout={conf.timeout * 1000}",
440439
**extra_config_dict) as conn, conn.cursor() as cursor:
441-
# Use parameterized query for security
442-
cursor.execute(sql, (p1, p2))
440+
cursor.execute(sql.format(p1, p2))
443441
res = cursor.fetchall()
444442
res_list = [ColumnSchema(*item) for item in res]
445443
return res_list

0 commit comments

Comments
 (0)