Re: Unauthorized users can see db schema and read functions - Mailing list pgsql-general

From Richard Huxton
Subject Re: Unauthorized users can see db schema and read functions
Date
Msg-id 45BF11FD.6080408@archonet.com
Whole thread Raw
In response to Unauthorized users can see db schema and read functions  ("Willy-Bas Loos" <willybas@gmail.com>)
List pgsql-general
Willy-Bas Loos wrote:
> Hi,
>
> I've noticed that any user who can logon to a db cluster can read the
> schema
> of all databases in it, including the code of all plpgsql functions.
> Even in
> schema's he/she doesn't have access to.
[snip]
> o  Why is schema information not restricted?
> o  Is there any way to prevent this, other than starting another cluster
> for
> this user's database

The short answer is "because it's always been this way".

The long answer is that users are per-cluster not per-database. So, they
need a certain amount of access to the system tables just to connect and
do anything. Now, in some cases there are views over the system tables
that provide restricted access (compare pg_user to pg_shadow) but they
aren't everywhere.

However, you can use pg_hba.conf to restrict access to a database entirely.

--
   Richard Huxton
   Archonet Ltd

pgsql-general by date:

Previous
From: "Joris Dobbelsteen"
Date:
Subject: Re: Unauthorized users can see db schema and read functions
Next
From: Jorge Godoy
Date:
Subject: Re: PostgreSQL 9.0