Re: copy.c handling for RLS is insecure

Поиск
Список
Период
Сортировка
Искать
От
Robert Haas
Тема
Re: copy.c handling for RLS is insecure
Дата
Msg-id
CA+TgmoZ73i3S=yR+qts6_WKG9PazR2zNkK1ymbCtr3jZ6RPvXw@mail.gmail.com
Ответ на
Список
Дерево обсуждения
copy.c handling for RLS is insecure Robert Haas <robertmhaas@gmail.com>
Re: copy.c handling for RLS is insecure Stephen Frost <sfrost@snowman.net>
Re: copy.c handling for RLS is insecure Stephen Frost <sfrost@snowman.net>
Re: copy.c handling for RLS is insecure Robert Haas <robertmhaas@gmail.com>
Re: copy.c handling for RLS is insecure Stephen Frost <sfrost@snowman.net>
Re: copy.c handling for RLS is insecure Noah Misch <noah@leadboat.com>
Re: copy.c handling for RLS is insecure Stephen Frost <sfrost@snowman.net>
Re: copy.c handling for RLS is insecure Stephen Frost <sfrost@snowman.net>
Re: copy.c handling for RLS is insecure Noah Misch <noah@leadboat.com>
Re: copy.c handling for RLS is insecure Andres Freund <andres@anarazel.de>
Re: copy.c handling for RLS is insecure Stephen Frost <sfrost@snowman.net>
Re: copy.c handling for RLS is insecure Stephen Frost <sfrost@snowman.net>
Re: copy.c handling for RLS is insecure Tom Lane <tgl@sss.pgh.pa.us>
Re: copy.c handling for RLS is insecure Robert Haas <robertmhaas@gmail.com>
Re: copy.c handling for RLS is insecure Stephen Frost <sfrost@snowman.net>
Re: copy.c handling for RLS is insecure David Fetter <david@fetter.org>
Re: copy.c handling for RLS is insecure Stephen Frost <sfrost@snowman.net>
Re: copy.c handling for RLS is insecure Robert Haas <robertmhaas@gmail.com>
I left out a few words there.

On Mon, Oct 6, 2014 at 3:07 PM, Robert Haas  wrote:
>> Hmm, that's certainly an interesting point, but I'm trying to work out
>> how this is different from normal COPY..?  pg_analyze_and_rewrite()
>> happens for both cases down in BeginCopy().
>
> As far as I can see, the previous code only looked up any given name
> once.  If you got a relation name, DoCopy() looked it up, and then
> BeginCopy() references it only by the passed-down Relation descriptor;
> if you got a query, DoCopy() ignores it, and then BeginCopy.

...passes it to pg_analyze_and_rewrite(), which looks up any names it contains.

> All of
> which is fine, at least AFAICS; if you think otherwise, that should be
> reported to pgsql-security.  The problem with your code is that you
> start with a relation name (and thus look it up in DoCopy()) and then
> construct a query (which causes the name to be looked up again when
> the query is passed to pg_analyze_and_rewrite() from BeginCopy()) --
> and the lookup might not get the same answer both times.  That is, not
> to put to fine a point on it, bad news.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


В списке pgsql-hackers по дате отправления
От: Robert Haas
Дата:
От: Stephen Frost
Дата:
FAQ