pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Tineo <adriantineo@softhome.net>
To: pgsql-php@postgresql.org, "Davi Leal" <davileal@terra.es>
Subject: Re: postgreSQL web form; Security
Date: Sat, 19 Jul 2003 10:53:04 +0200
Message-ID: <001d01c34dd3$2fdf08d0$926bd9d9@clairvo> (raw)
References: <200307132144.02772.davileal@terra.es>
	<20030713200102.GA15127@wilbur.25thandClement.com>
	<200307142110.14069.davileal@terra.es>

> 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





view thread (4+ messages)  latest in thread

Message-ID: <001d01c34dd3$2fdf08d0$926bd9d9@clairvo>
Permalink:  ../001d01c34dd3$2fdf08d0$926bd9d9@clairvo/
Also on:    postgresql.org/message-id/001d01c34dd3$2fdf08d0$926bd9d9@clairvo

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: adriantineo@softhome.net, davileal@terra.es
  Subject: Re: postgreSQL web form; Security
  In-Reply-To: <001d01c34dd3$2fdf08d0$926bd9d9@clairvo>
  References: <200307132144.02772.davileal@terra.es> <20030713200102.GA15127@wilbur.25thandClement.com> <200307142110.14069.davileal@terra.es> <001d01c34dd3$2fdf08d0$926bd9d9@clairvo>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox