Re: should we allow users with a predefined role to access pg_backend_memory_contexts view and pg_log_backend_memory_contexts function?

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: Stephen Frost <sfrost(at)snowman(dot)net>, Robert Haas <robertmhaas(at)gmail(dot)com>, Isaac Morland <isaac(dot)morland(at)gmail(dot)com>, "Bossart, Nathan" <bossartn(at)amazon(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: should we allow users with a predefined role to access pg_backend_memory_contexts view and pg_log_backend_memory_contexts function?
Date: 2021-10-21 06:44:34
Message-ID: CALj2ACWgkGZ7vkioK6ZkweHaayi4kvGEjanSapFxYQdgeKyh9w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Oct 15, 2021 at 11:53 PM Jeff Davis <pgsql(at)j-davis(dot)com> wrote:
>
> On Fri, 2021-10-15 at 13:52 -0400, Stephen Frost wrote:
> > While I appreciate that
> > it
> > isn't really addressing the complaint you have that it'd be nice if
> > we
> > made things simpler for administrators by making it so they don't
> > have
> > to GRANT access to both the view and the function, and I can see how
> > that would be nice, it seems like we should probably be documenting
> > these functions too and I don't know that it's correct to
> > characterize
> > them as 'internal'.
>
> I'm content with that explanation.
>
> It would be nice if there was some kind of improvement here, but I
> won't push too hard for it if there are security concerns.

I tried to go through the discussion that happened upthread, following
is what I could grasp:
1) Documenting internal functions that are being used by some of the
views in system_views.sql: These functions have entries in the pg_proc
catalog and users are not restricted from using them. I agree that the
same permissions should be applied for the views and those functions.
If at all, others agree to document them, it should be discussed
separately and not in this thread as there are lots of functions.
Personally, I'm against documenting them all.
2) Removal of superuser() checks in all (if possible) or some of the
functions as suggested in [1]: actually the list of functions having
superuser() checks is huge and I'm not sure all agree on this. It
should be discussed separately and not in this thread.

I would like to confine this thread to allowing non-superusers with a
predefined role (earlier suggestion was to use pg_read_all_stats) to
access views pg_backend_memory_contexts and pg_shmem_allocations and
functions pg_get_backend_memory_contexts and pg_get_shmem_allocations.
Attaching the previous v2 patch here for further review and thoughts.

[1] - https://www.postgresql.org/message-id/CAOuzzgpp0dmOFjWC4JDvk57ZQGm8umCrFdR1at4b80xuF0XChw%40mail.gmail.com

Regards,
Bharath Rupireddy.

Attachment Content-Type Size
v2-0001-change-privileges-of-pg_backend_memory_contexts-a.patch application/octet-stream 6.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message houzj.fnst@fujitsu.com 2021-10-21 06:58:06 RE: Added schema level support for publication.
Previous Message Ronan Dunklau 2021-10-21 06:29:54 Re: pg_receivewal starting position