Commit 3000255
Fix potential SQL injection in
This commit adds a defense-in-depth enhancement to `_migrate_database_schema`
in `metadata_generator.py`. The `ALTER TABLE` DDL statement uses an f-string
to insert column names. By validating the column name with `str.isidentifier()`,
we ensure that it is a safe SQL column name, preventing SQL injection if the
column configuration is ever exposed to user input.
Co-authored-by: thebearwithabite <216692431+thebearwithabite@users.noreply.github.com>metadata_generator.py
1 parent 613e4ba commit 3000255
2 files changed
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
| 234 | + | |
| 235 | + | |
234 | 236 | | |
235 | 237 | | |
236 | 238 | | |
| |||
0 commit comments