X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id ACA14CCB87 for ; Sat, 19 Jul 2003 08:52:36 +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 12376-07 for ; Sat, 19 Jul 2003 08:52:55 +0000 (GMT) Received: from jive.SoftHome.net (jive.SoftHome.net [66.54.152.27]) by svr1.postgresql.org (Postfix) with SMTP id 6C326CB576 for ; Sat, 19 Jul 2003 05:52:21 -0300 (ADT) Received: (qmail 17154 invoked by uid 417); 19 Jul 2003 08:52:56 -0000 Received: from shunt-smtp-out-0 (HELO softhome.net) (172.16.3.12) by shunt-smtp-out-0 with SMTP; 19 Jul 2003 08:52:56 -0000 Received: from clairvo ([217.217.107.146]) (AUTH: LOGIN adriantineo@softhome.net) by softhome.net with esmtp; Sat, 19 Jul 2003 02:52:49 -0600 Message-ID: <001d01c34dd3$2fdf08d0$926bd9d9@clairvo> From: "Adrian Tineo" To: pgsql-php@postgresql.org, "Davi Leal" References: <200307132144.02772.davileal@terra.es> <20030713200102.GA15127@wilbur.25thandClement.com> <200307142110.14069.davileal@terra.es> Subject: Re: postgreSQL web form; Security Date: Sat, 19 Jul 2003 10:53:04 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/38 X-Sequence-Number: 2150 > How can we avoid this security risk using PHP & postgreSQL?. Every system has its security caveats. But that doesn't mean it can't be taken care of. Check this link for some important security issues regarding PHP and SQL. http://forums.devshed.com/t20525/s7cec8677087e43c40ce670ad005d327c.html http://es2.php.net/manual/en/security.database.php What I do is verify all user input ($_GET and $_POST array) and not allow certain characters, most importantly ";". If they can't put a ";" they can't close a query and they can't do SQL injection. That is if you want to build the security wall at the application level. For extra security or for security at DB level you could connect as a previously created user with only read-access permission. Although at some point you might need to insert/delete stuff, you can use the read-only user while you don't need to write. A lot of times you have some public pages that everybody can access that don't need write permission. Then you can have other password-protected pages intended only for admins or people you trust that need write/delete so the security risk would be lower. Hope that helps. Adrian Tineo