From: Tom Lane <tgl@sss.pgh.pa.us>
To: Marcin BarczyĆski <mba.ogolny@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Inconsistent permission enforcement for schemas
Date: Mon, 01 Aug 2022 12:49:51 -0400
Message-ID: <1846618.1659372591@sss.pgh.pa.us> (raw)
In-Reply-To: <CAK61bT-uP8rS9fYyc8SEjUNvXfra51+iaRchncnuzk2XJ=Cthg@mail.gmail.com>
References: <CAK61bT-uP8rS9fYyc8SEjUNvXfra51+iaRchncnuzk2XJ=Cthg@mail.gmail.com>
=?UTF-8?Q?Marcin_Barczy=C5=84ski?= <mba.ogolny@gmail.com> writes:
> Why can a user access a table from a forbidden schema if the table is
> explicitly specified in the definition of a view in an allowed schema? And
> not if the table is accessed by a function used in the view.
(1) Whether a view can access a table is determined by the ownership of
the view, not of the user using the view.
(2) It might be nice if the view's permissions were inherited by functions
called by the view, but we've not made that happen. You might be able to
approximate it by marking such functions SECURITY DEFINER; although that
makes the function's permissions those of the function's owner not the
view's owner.
regards, tom lane
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-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, mba.ogolny@gmail.com
Subject: Re: Inconsistent permission enforcement for schemas
In-Reply-To: <1846618.1659372591@sss.pgh.pa.us>
References: <CAK61bT-uP8rS9fYyc8SEjUNvXfra51+iaRchncnuzk2XJ=Cthg@mail.gmail.com> <1846618.1659372591@sss.pgh.pa.us>
* 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