Re: Just View create privilege to user user2

From: Erik Wienhold <ewie(at)ewie(dot)name>
To: M Sarwar <sarwarmd02(at)outlook(dot)com>, "pgsql-admin(at)lists(dot)postgresql(dot)org" <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Re: Just View create privilege to user user2
Date: 2023-05-04 09:08:50
Message-ID: 1679699150.1638077.1683191330069@office.mailbox.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

> On 04/05/2023 01:07 CEST M Sarwar <sarwarmd02(at)outlook(dot)com> wrote:
>
> I want user u2 to have only CREATE VIEW privilege in schema s2. I do not want
> u2 to create any other type of objects in s2 schema.

You can setup a second database db2 just for u2 and have them access your
database db1 via foreign tables. u2 still only has the SELECT privilege in db1
but can create objects in db2 and mess it up as they see fit.

If you go with a single database and event triggers as Tom wrote you must also
consider function security[0]. Otherwise u2 can override relations in s1 just
by creating compatible views in s2 and set search_path=s2,s1. u2 can thus
inject data into functions that have no explicit search_path.

[0] https://www.postgresql.org/docs/current/perm-functions.html

--
Erik

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Erik Wienhold 2023-05-04 10:19:03 pg_stat_activity.client_addr sometimes null for host connections
Previous Message Holger Jakobs 2023-05-04 08:16:28 Re: unknown postgres ssl error "could not accept SSL connection: Success" and timeout