Re: Possible problem with PQescapeStringConn and standard_conforming_strings - Mailing list pgsql-general

From Tom Lane
Subject Re: Possible problem with PQescapeStringConn and standard_conforming_strings
Date
Msg-id 27152.1161906364@sss.pgh.pa.us
Whole thread Raw
In response to Possible problem with PQescapeStringConn and standard_conforming_strings  (Jeff Davis <pgsql@j-davis.com>)
Responses Re: Possible problem with PQescapeStringConn and
List pgsql-general
Jeff Davis <pgsql@j-davis.com> writes:
> You can set standard_conforming_strings in postgresql.conf at any time
> and reload the config, changing the value for all active connections.
> That means that if a client opens a connection, and you SIGHUP postgres,
> and then the client issues a PQescapeStringConn, the client will get an
> incorrectly-escaped string.

The window for this is pretty narrow, because PQescapeStringConn will
use the latest-delivered parameter status, but it's certainly true that
randomly changing standard_conforming_strings wouldn't be a bright idea.
Probably a documentation note recommending against changing it via
SIGHUP would be sufficient.

> This could be a security vulnerability. Webservers which hold open
> connections for long periods of time could be incorrectly escaping
> values for long periods of time

Not if they're using PQescapeStringConn.  Handmade escaping code
that thinks it needn't recheck the status could be at risk ...
but realistically, handmade escaping code is likely already broken
by the mere existence of standard_conforming_strings.

            regards, tom lane

pgsql-general by date:

Previous
From: Jeff Davis
Date:
Subject: Re: Possible problem with PQescapeStringConn and
Next
From: Richard Broersma Jr
Date:
Subject: Re: pg_dumpall failing from possible corrupted shared memory