Re: Protect extension' internal tables - how? - Mailing list pgsql-hackers

From Aleksander Alekseev
Subject Re: Protect extension' internal tables - how?
Date
Msg-id CAJ7c6TOQVQRLjrEqZXwKTNQH_UkYt0fzXRr2w0vTQG5oEYGrHA@mail.gmail.com
Whole thread Raw
In response to Protect extension' internal tables - how?  (Nikita Malakhov <hukutoc@gmail.com>)
Responses Re: Protect extension' internal tables - how?
List pgsql-hackers
Hi,

> Could you please advise or give some hint on what is the correct (and
> secure) way to implement this?
>
> Currently I use the owner of the extension as owner when creating
> such a table inside the function, but maybe there are some pitfalls
> in this kind of solution?

If the goal is to protect the user from an _accidental_ access to the
tables, placing them into a separate schema _my_extension_private or
something will be enough.

Otherwise consider using corresponding access control abilities of
PostgreSQL and creating functions with SECURITY DEFINER [1]. Be
mindful that your functions will become a target for privilege
escalation, so you should be extra careful with the implementation.

[1]: https://www.postgresql.org/docs/current/sql-createfunction.html

-- 
Best regards,
Aleksander Alekseev



pgsql-hackers by date:

Previous
From: Aleksander Alekseev
Date:
Subject: Re: ObjectIdGetDatum() missing from SearchSysCache*() callers
Next
From: Amit Kapila
Date:
Subject: Re: [PoC] pg_upgrade: allow to upgrade publisher node