Node-postgres: SQL Injection

Created on 16 Aug 2011  路  6Comments  路  Source: brianc/node-postgres

Hey guys,

Just curious about constructing parameterized queries.....usually this entails some level of mitigation against sql injection attacks. Is that also true for this module? Thanks!

Most helpful comment

Absolutely true for this module. That's why the parameterized query support in node-postgres is first class. All escaping is done by the postgresql server ensuring proper behavior across dialects, encodings, etc...

All 6 comments

Absolutely true for this module. That's why the parameterized query support in node-postgres is first class. All escaping is done by the postgresql server ensuring proper behavior across dialects, encodings, etc...

Cool! So does that mean I don't need to do any pre-parsing of user input to check for sql injection?

Correct. For example, this will not inject sql:

INSERT INTO user(name) VALUES($1), ["'; DROP TABLE user;"]

Awesome. Thanks for the quick feedback :)

@jwingy thanks for raising this i was wondering too. @brianc thanks for already doing the "right thing". i added this to the FAQ in the wiki.

awesome! Thank you!

Was this page helpful?
0 / 5 - 0 ratings