mirror of
https://github.com/GSA/notifications-api.git
synced 2026-09-11 10:28:55 -04:00
notify-api-91 sanitize SQL inputs against injection
This commit is contained in:
@@ -14,19 +14,20 @@ from flask import current_app
|
||||
|
||||
service_id = current_app.config['NOTIFY_SERVICE_ID']
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.get_bind()
|
||||
|
||||
# modify name of default service user in services
|
||||
table_name = 'services'
|
||||
col = 'name'
|
||||
val = 'US Notify'
|
||||
select_by_col = 'id'
|
||||
select_by_val = service_id
|
||||
op.execute(f"update {table_name} set {col}='{val}' where {select_by_col} = '{select_by_val}'")
|
||||
# table_name = 'services'
|
||||
# col = 'name'
|
||||
# val = 'US Notify'
|
||||
# select_by_col = 'id'
|
||||
# select_by_val = service_id
|
||||
op.execute("update services set name='US Notify' where id = '{}'".format(service_id))
|
||||
|
||||
table_name = 'services_history'
|
||||
op.execute(f"update {table_name} set {col}='{val}' where {select_by_col} = '{select_by_val}'")
|
||||
# table_name = 'services_history'
|
||||
op.execute("update services_history set name='US Notify' where id = '{}'".format(service_id))
|
||||
|
||||
|
||||
def downgrade():
|
||||
|
||||
Reference in New Issue
Block a user