About access to the table metadata:
As Islingre commented, there is no good way to hide that information from users.
You would have to deny the user access to the pg_class
, pg_namespace
and pg_proc
and similar tables. This can be done if you set allow_system_table_mods
to on
, and PostgreSQL will continue functioning, but a lot of things will no longer work:
Essentially, you won't be able to see any metadata any more.
There is no way to allow a user to see only some of the metadata, it is all or nothing.
But that is not a problem. There is no good reason to keep metadata from anybody - that is public information.
PostgreSQL doesn't consider that a security problem. Just because I know that there is a table customer
with a column credit_card_number
doesn't get me any closer to accessing it if permissions are set properly.
About access to the objects in public
:
A REVOKE
that removes a privilege that has never been granted will silently do nothing.
The USAGE
privilege on schema public
is granted to PUBLIC
, not just_one_schema_user
.
Use this to show the permissions in psql
:
dn+
You are looking for:
REVOKE CREATE, USAGE ON SCHEMA public FROM public;
I would recommend storing no application data in public
, only extensions. Then don't revoke USAGE
, only CREATE
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…