Re: should we allow users with a predefined role to access pg_backend_memory_contexts view and pg_log_backend_memory_contexts function? - Mailing list pgsql-hackers

From Bharath Rupireddy
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
Msg-id CALj2ACWgkGZ7vkioK6ZkweHaayi4kvGEjanSapFxYQdgeKyh9w@mail.gmail.com
Whole thread Raw
In response to Re: should we allow users with a predefined role to access pg_backend_memory_contexts view and pg_log_backend_memory_contexts function?  (Jeff Davis <pgsql@j-davis.com>)
Responses Re: should we allow users with a predefined role to access pg_backend_memory_contexts view and pg_log_backend_memory_contexts function?  ("Bossart, Nathan" <bossartn@amazon.com>)
List pgsql-hackers
On Fri, Oct 15, 2021 at 11:53 PM Jeff Davis <pgsql@j-davis.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

pgsql-hackers by date:

Previous
From: Ronan Dunklau
Date:
Subject: Re: pg_receivewal starting position
Next
From: "houzj.fnst@fujitsu.com"
Date:
Subject: RE: Added schema level support for publication.