neondatabase / serverless

Connect to Neon PostgreSQL from serverless/worker/edge functions
https://www.npmjs.com/package/@neondatabase/serverless
MIT License
318 stars 11 forks source link

What is the correct way to avoid sql injections for client and pool queries? #52

Closed DrevaSergii closed 7 months ago

DrevaSergii commented 7 months ago

Documentation says that I can avoid sql injections by calling sql as the tag function. I couldn't find any information on how to avoid sql injections for Client and Pool queries. Could you recommend some solution? For example, squid/pg exports sql method directly from the library and pg provides utilities to avoid sql injections.

jawj commented 7 months ago

For Client and Pool it's exactly the same deal as for node-postgres: parameterized queries using $1, $2, etc.

See documentation here: https://node-postgres.com/features/queries#parameterized-query