Re: Permissions, "soft read failure" - wishful thinking?

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Jack Christensen <jack(at)jackchristensen(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Permissions, "soft read failure" - wishful thinking?
Date: 2015-12-15 03:09:37
Message-ID: CAKFQuwY+auEmdwwmNbYjqV_LdORZoKFTRcP5qGHe_wYnc-E51g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Monday, December 14, 2015, Jack Christensen <jack(at)jackchristensen(dot)com>
wrote:

> On 12/14/2015 11:55 AM, Benjamin Smith wrote:
>
>> Is there a way to set PG field-level read permissions so that a deny
>> doesn't
>> cause the query to bomb, but the fields for which permission is denied to
>> be
>> nullified?
>>
>> In our web-based app, we have a request to implement granular permissions:
>> table/field level permissions. EG: userX can't read
>> customers.socialsecurity in
>> any circumstance. We'd like to implement DB-level permissions; so far,
>> we've
>> been using an ORM to manage CRUD permissions.
>>
>> This is old hat, but our system has a large number of complex queries that
>> immediately break if *any* field permission fails. So, implementing this
>> for
>> customers could be *very* painful....
>>
>> Is that there is a way to let the query succeed, but nullify any fields
>> where
>> read permissions fail? (crossing fingers) We'd be watching the PG logs to
>> identify problem queries in this case.
>>
>>
>> If userX is a real database user you create a customers view in the userX
> schema that selects from the real customers table and either omits the
> field entirely or nullifies it. Permissions could be used to deny access to
> the underlying table, and search_path could be used to avoid most if not
> all application level changes.
>
>
>
I suspect that previously installed views and functions using this table
may need attention as well...especially if other users do need the column
data to appear.

But a replacement view for read usage seems the most efficient way to alter
the database to implement the additional logic.

It doesn't solve the "we don't trust the application writers to do the
correct thing" though.

David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Berend Tober 2015-12-15 04:22:41 Re: Deletion Challenge
Previous Message David G. Johnston 2015-12-15 02:57:09 Re: Permissions, "soft read failure" - wishful thinking?