X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 060E6CCA33 for ; Thu, 17 Jul 2003 15:16:35 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 24586-10 for ; Thu, 17 Jul 2003 15:16:54 +0000 (GMT) Received: from webmail.muc.domues.com (webmail.muc.domeus.com [62.67.54.176]) by svr1.postgresql.org (Postfix) with ESMTP id 768C2CCA2B for ; Thu, 17 Jul 2003 12:16:22 -0300 (ADT) Received: from coppola.ecircle.de ([192.168.1.142]) by webmail.muc.domues.com (8.11.3/8.11.3/SuSE Linux 8.11.1-0.5) with ESMTP id h6HFEck18732; Thu, 17 Jul 2003 17:14:38 +0200 Subject: Re: Prepared Statements From: Csaba Nagy To: Dmitry Tkach Cc: Paul Thomas , "pgsql-jdbc @ postgresql " ". org" In-Reply-To: <3F16B715.4010006@openratings.com> References: <200307161624.39340.julien.legoff@laposte.net> <20030717002329.A26390@bacon> <3F16B715.4010006@openratings.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 (1.0.8-11) Date: 17 Jul 2003 17:14:37 +0200 Message-Id: <1058454878.25132.214.camel@coppola.ecircle.de> Mime-Version: 1.0 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/80 X-Sequence-Number: 7464 On Thu, 2003-07-17 at 16:47, Dmitry Tkach wrote: [snip] > > > > This is a security hole known as SQL injection. > > No, it isn't :-) > The "hole" you are referring to is letting the users type in entire > queries, not just input parameters. > As long as you have control over how your sql is constructed, you not > any less (nor any more) safe with plain Statements than you would be > with PreparedStatements. The do the same exact thing. In my understanding the prepared statement will properly escape any parameter so it can be trusted that the resulting query will not contain something you wouldn't expect. Example (< and > are delimiters, ignore them): query: