public inbox for [email protected]help / color / mirror / Atom feed
Re: current_role of caller of a DEFINER function 3+ messages / 3 participants [nested] [flat]
* Re: current_role of caller of a DEFINER function @ 2024-06-26 12:42 David G. Johnston <[email protected]> 2024-06-26 12:58 ` Re: current_role of caller of a DEFINER function Isaac Morland <[email protected]> 2024-06-26 12:58 ` Re: current_role of caller of a DEFINER function Dominique Devienne <[email protected]> 0 siblings, 2 replies; 3+ messages in thread From: David G. Johnston @ 2024-06-26 12:42 UTC (permalink / raw) To: Dominique Devienne <[email protected]>; +Cc: [email protected] <[email protected]> On Wednesday, June 26, 2024, Dominique Devienne <[email protected]> wrote: > Only session_user > is representative of the caller, and reliable (modulo SUPERUSER and > SET AUTHORIZATION, but that's a different story and kinda normal) > Why can you not use session_user then? David J. ^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: current_role of caller of a DEFINER function 2024-06-26 12:42 Re: current_role of caller of a DEFINER function David G. Johnston <[email protected]> @ 2024-06-26 12:58 ` Isaac Morland <[email protected]> 1 sibling, 0 replies; 3+ messages in thread From: Isaac Morland @ 2024-06-26 12:58 UTC (permalink / raw) To: David G. Johnston <[email protected]>; +Cc: Dominique Devienne <[email protected]>; [email protected] <[email protected]> On Wed, 26 Jun 2024 at 08:42, David G. Johnston <[email protected]> wrote: > On Wednesday, June 26, 2024, Dominique Devienne <[email protected]> > wrote: > >> Only session_user >> is representative of the caller, and reliable (modulo SUPERUSER and >> SET AUTHORIZATION, but that's a different story and kinda normal) >> > > Why can you not use session_user then? > Speaking only for myself, if I am writing a security definer and I go to check the calling role, I want to know the role which was used in the privilege check as to whether the function would even be permitted to be called. What I would be looking for is to behave differently depending on who called me. The original role which connected to the database is totally irrelevant, and could even be a security problem: if superuser does a set role, I shouldn't then be doing security checks which report back that the current role is superuser. Imagine code like this: select objects from table where owner = [calling role] … I think this ties into the related discussions on questions like what search_path should be in effect during trigger execution and during REFRESH MATERIALIZED VIEW and other maintenance commands. It also relates into the question of what role executes triggers and performs calculations during REFRESH MATERIALIZED VIEW and other maintenance commands. Essentially the current behaviour is quirky and built up over time by a series of individual decisions, and does not appear to have any systematic theory of operation which would answer all these questions all at once. ^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: current_role of caller of a DEFINER function 2024-06-26 12:42 Re: current_role of caller of a DEFINER function David G. Johnston <[email protected]> @ 2024-06-26 12:58 ` Dominique Devienne <[email protected]> 1 sibling, 0 replies; 3+ messages in thread From: Dominique Devienne @ 2024-06-26 12:58 UTC (permalink / raw) To: David G. Johnston <[email protected]>; +Cc: [email protected] <[email protected]> On Wed, Jun 26, 2024 at 2:42 PM David G. Johnston <[email protected]> wrote: > On Wednesday, June 26, 2024, Dominique Devienne <[email protected]> wrote: >> Only session_user >> is representative of the caller, and reliable (modulo SUPERUSER and >> SET AUTHORIZATION, but that's a different story and kinda normal) > > Why can you not use session_user then? Hi. As I already wrote above, the current_role matters in our security model. The LOGIN user (i.e. session_user) is used only for authentication to the DB and to connect. All other security concerns are on other app-maintained (NOLOGIN) roles, used for authorization. --DD ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2024-06-26 12:58 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2024-06-26 12:42 Re: current_role of caller of a DEFINER function David G. Johnston <[email protected]> 2024-06-26 12:58 ` Isaac Morland <[email protected]> 2024-06-26 12:58 ` Dominique Devienne <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox