postgresql-migration icon indicating copy to clipboard operation
postgresql-migration copied to clipboard

Escape table name to prevent SQL injection via optTableName option

Open jhrcek opened this issue 2 years ago • 0 comments

It is a bad practice to concatenate user input directly into SQL queries. This opens easily exploitable SQL injection vulnerabilities.

A proper way to do it is to wrap table name into Identifier and interpolate it into query using the same mechanism as other inputs. Identifier's ToField instance makes sure that table name is properly quoted/escaped.

jhrcek avatar Oct 05 '23 06:10 jhrcek