From: Greg Stark <gsstark@mit.edu>
To: Nigel J. Andrews <nandrews@investsystems.co.uk>
Cc: pgsql-general@postgresql.org
Cc: pgsql-interfaces@postgresql.org
Subject: Re: More PHP DB abstraction layer stuff
Date: 24 Jan 2003 12:22:42 -0500
Message-ID: <87k7gupin1.fsf@stark.dyndns.tv> (raw)
In-Reply-To: <Pine.LNX.4.21.0301241529130.28504-100000@ponder.fairway2k.co.uk>
References: <Pine.LNX.4.21.0301241529130.28504-100000@ponder.fairway2k.co.uk>
"Nigel J. Andrews" <nandrews@investsystems.co.uk> writes:
> One thing that always gets me is why people think quoting the ' in a string is
> a security feature when they don't allow for someone giving \' in the
> string. On the other hand I'm never sure how to protect against such 'odd
> number of escapes' attacks. Anyone got any clues? Does PQescape do it?
That just means you have to escape \ as well as '.
But the best way to deal with this is to use placeholders and prepared queries
and provide the data out of band. This completely sidesteps the issue and
guarantees you can't get it wrong by mistake ever. Mixing user-provided data
with program code is a recipe for security holes.
--
greg
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 using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: gsstark@mit.edu, nandrews@investsystems.co.uk, pgsql-general@postgresql.org
Subject: Re: More PHP DB abstraction layer stuff
In-Reply-To: <87k7gupin1.fsf@stark.dyndns.tv>
* 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