From: | Isaac Morland <isaac(dot)morland(at)gmail(dot)com> |
---|---|
To: | Stephen Frost <sfrost(at)snowman(dot)net> |
Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, Jeff Davis <pgsql(at)j-davis(dot)com>, "Bossart, Nathan" <bossartn(at)amazon(dot)com>, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(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-14 18:03:11 |
Message-ID: | CAMsGm5cTS6RK-kCUsj6P1KUjW-JA1287TRstfQnGQscryfgOOg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, 14 Oct 2021 at 13:43, Stephen Frost <sfrost(at)snowman(dot)net> wrote:
> I feel this might relate to the discussion of triggers, which I claim
> > should execute in the context of the table owner (or maybe the trigger
> > owner, if that were a separate concept). There are lots of triggers one
> > might want to write that cannot be written because they execute in the
> > context of the user of the table; my recollection is that it is harder to
> > find examples of non-malware triggers that depend on executing in the
> > context of the user of the table.
>
> Triggers can call security definer functions, so I'm not quite sure I
> understand what the issue here is.
>
Even something as simple as a "log all table updates" cannot be implemented
as far as I can tell.
So you have table T and T_log. Trigger on T causes all INSERT/UPDATE/DELETE
actions to be logged to T_log. The only changes to T_log should be inserts
resulting from the trigger. But now in order to make changes to T the user
also needs INSERT on T_log. OK, so use a security definer function. That
doesn't help; now instead of needing INSERT on T_log they need EXECUTE on
the function. Either way, two privilege grants are required, and one of
them allows the user to make spurious entries in T_log.
But the desired behaviour is that the user has access *only* to T, and no
access whatsoever to T_log other than indirect changes by causing the
trigger to execute.
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2021-10-14 18:08:51 | Re: [PATCH] Proposal for HIDDEN/INVISIBLE column |
Previous Message | Josef Šimánek | 2021-10-14 18:01:55 | Re: [PATCH] Proposal for HIDDEN/INVISIBLE column |