It's very easy to create security issues when using template literals....
const email = 'test@acme.org';
const res = sql.query`select * from where email = ${email}`; <-- Sanitized
const res = sql.query(`select * from where email = ${email}`) <-- Not sanitized
Maybe take inspiration from Prisma (which fixed it in version 2.30 some time ago)
It would be nice to add a queryUnsafe part of the feature (the $queryRawUnsafe in prisma). That would be an escape hatch to give insights of the nature of the query
It's very easy to create security issues when using template literals....
For example
Related:
Expected behaviour:
Don't accept the
()version.Actual behaviour:
Using as a function -> doesn't sanitize !Risk !
Suggestion
Maybe take inspiration from Prisma (which fixed it in version 2.30 some time ago)
It would be nice to add a queryUnsafe part of the feature (the $queryRawUnsafe in prisma). That would be an escape hatch to give insights of the nature of the query
Software versions