From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Maxim Boguk <maxim.boguk@gmail.com>
To: Heikki Linnakangas <hlinnaka@iki.fi>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18387: Erroneous permission checks and/or misleading error messages with refresh materialized view
Date: Tue, 12 Mar 2024 13:22:33 +0100
Message-ID: <09970dbb6f95a34d9427c32b09517ea709c77d02.camel@cybertec.at> (raw)
In-Reply-To: <CAK-MWwQBrjfAPu=nfWS9B_Y5QK147xU2Y-EpDYAvsrdni97HCw@mail.gmail.com>
References: <18387-12041858d9efb6f6@postgresql.org>
<36bb333d-13ec-4f8e-af33-48249ca2fe69@iki.fi>
<CAK-MWwQBrjfAPu=nfWS9B_Y5QK147xU2Y-EpDYAvsrdni97HCw@mail.gmail.com>
On Tue, 2024-03-12 at 12:40 +0200, Maxim Boguk wrote:
> May I suggest a change to always allow superuser run
> REFRESH MATERIALIZED VIEW (may be via set role or similar mechanics)?
If the query ran with superuser permissions, that would be
a security problem:
CREATE TABLE log (t text);
CREATE FUNCTION f() RETURNS integer LANGUAGE sql
AS 'INSERT INTO log VALUES (''x''); SELECT 42';
CREATE MATERIALIZED VIEW v AS SELECT f();
Now imagine you create a malicious trigger on "log" and
get a superuser to refresh the materialized view.
I don't see why it should be a problem if a superuser gets
"permission denied" in such a case. They can also get it if
they call a SECURITY DEFINER function owned by a non-superuser.
Yours,
Laurenz Albe
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-bugs@postgresql.org
Cc: laurenz.albe@cybertec.at, maxim.boguk@gmail.com, hlinnaka@iki.fi
Subject: Re: BUG #18387: Erroneous permission checks and/or misleading error messages with refresh materialized view
In-Reply-To: <09970dbb6f95a34d9427c32b09517ea709c77d02.camel@cybertec.at>
References: <18387-12041858d9efb6f6@postgresql.org> <36bb333d-13ec-4f8e-af33-48249ca2fe69@iki.fi> <CAK-MWwQBrjfAPu=nfWS9B_Y5QK147xU2Y-EpDYAvsrdni97HCw@mail.gmail.com> <09970dbb6f95a34d9427c32b09517ea709c77d02.camel@cybertec.at>
* 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