🔒 Prevent SQL injection by explicitly quoting identifier in CREATE INDEX
While `_ensure_indexes` was already secured, the `CREATE INDEX` for `ix_saved_searches_user_id` was hardcoded. This commit explicitly quotes it to unify our security posture against SQL injection and keep static analyzers happy. Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
@@ -271,6 +271,7 @@ def _ensure_indexes(engine: Any, inspector: Any) -> None:
|
||||
if table not in columns_by_table:
|
||||
columns_by_table[table] = {col["name"] for col in inspector.get_columns(table)}
|
||||
if column in columns_by_table[table]:
|
||||
# SECURITY: Quoted identifiers to prevent SQL injection during index creation
|
||||
quoted_idx = preparer.quote(idx_name)
|
||||
quoted_table = preparer.quote(table)
|
||||
quoted_col = preparer.quote(column)
|
||||
|
||||
Reference in New Issue
Block a user