Re: More PHP DB abstraction layer stuff - Mailing list pgsql-general

From Greg Stark
Subject Re: More PHP DB abstraction layer stuff
Date
Msg-id 87k7gupin1.fsf@stark.dyndns.tv
Whole thread Raw
In response to More PHP DB abstraction layer stuff  ("Nigel J. Andrews" <nandrews@investsystems.co.uk>)
Responses Re: More PHP DB abstraction layer stuff
List pgsql-general
"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

pgsql-general by date:

Previous
From: Mikhail Terekhov
Date:
Subject: Re: DBD-Pg
Next
From: "Josh Berkus"
Date:
Subject: Re: Compiling 7.2.3 on RH 8.0