1

Is it fully effective when using Postgres 11 in Node.js backend? I've tested the code with a lot of cheatsheets and everything was fine.

PostgreSQL Query:

INSERT INTO test(a, b) VALUES ('${Utils.esc(a)}', '${Utils.esc(b)}')

Code to prevent SQL Injection:

esc: (str) => {
    return str.toString().replace(/(['])/g, "'$1");
},

Preliminary tests didn't show me any susceptibility, but maybe one of you knows more.

blaxckv
  • 175
  • 1
  • 8

0 Answers0