Personal-Blog-System
Personal-Blog-System copied to clipboard
Use Parameterized Queries in TypeORM query Method
Currently, some queries in the codebase use string interpolation to pass user input into raw SQL queries via the query method in TypeORM. This approach can lead to SQL injection vulnerabilities if untrusted input is used.
e.g. https://github.com/CQBoyBrand/Personal-Blog-System/blob/master/server/apps/frontend/src/article/article.service.ts#L104
This approach directly interpolates user input, making it susceptible to SQL injection attacks. Refactor queries to use parameterized inputs instead of string interpolation.
example:
const users = await dataSource.query(
"SELECT * FROM user WHERE email = $1",
[email]
);
Thanks for the feedback, I will deal with this problem as soon as possible