Re: Protection from SQL injection - Mailing list pgsql-sql

From Tom Lane
Subject Re: Protection from SQL injection
Date
Msg-id 13670.1209267734@sss.pgh.pa.us
Whole thread Raw
In response to Re: Protection from SQL injection  ("Scott Marlowe" <scott.marlowe@gmail.com>)
Responses Re: Protection from SQL injection  ("Scott Marlowe" <scott.marlowe@gmail.com>)
Re: Protection from SQL injection  ("Thomas Mueller" <thomas.tom.mueller@gmail.com>)
List pgsql-sql
"Scott Marlowe" <scott.marlowe@gmail.com> writes:
> Wouldn't it be much simpler to have a version of the libpq client lib
> that only understands prepared queries?

You could do that, but there's still no way for it to know exactly how
the submitted query was constructed.  This would block off the types of
injections that want to add whole SQL commands, but not ones that just
subvert the current query (eg adding OR TRUE to see data you shouldn't).

This is really a client problem and only client-side solutions will
provide meaningful traction for it.  In perl, for instance, the "taint"
mechanism is a good way to notice whether any insecure strings are
getting into database queries.
        regards, tom lane


pgsql-sql by date:

Previous
From: "Scott Marlowe"
Date:
Subject: Re: Protection from SQL injection
Next
From: "Scott Marlowe"
Date:
Subject: Re: Protection from SQL injection