serverless-mysql
serverless-mysql copied to clipboard
SQL Injection/Sanitization
I'm assuming that by doing the queries with the question marks:
const sql = "UPDATE clients SET series_daily = 0, series_daily_date = ? WHERE uid = ?"; await utils.mysql.query({ sql, timeout: 10000, values: [todayDate, req.clientUid] }); await utils.mysql.end();
serverless-mysql will sanitize the inputs, but I would rather not assume and it's better to ask: does it sanitize the inputs?
Thanks!
actually serverless-mysql uses mysql by doug wilson underneath it all, https://github.com/mysqljs/mysql. This is where you will get your answer about sanitization.
For anyone wondering, the answer to @gente21's question is that the inputs are sanitized just as one would expect.
It is also well worth looking at the documentation link that @StephaneP recommended. Reading through that page before writing queries will save a great deal of frustration.