Re: user-based query white list - Mailing list pgsql-hackers

From Asko Oja
Subject Re: user-based query white list
Date
Msg-id ecd779860812070009m20c6c44fq3236b6bec7eda4e7@mail.gmail.com
Whole thread Raw
In response to user-based query white list  (Andrew Chernow <ac@esilo.com>)
List pgsql-hackers
Hi<br /><br />We use plproxy for this kind of security enhancement. We create plpgsql functions that do whats needed
andthen we create so called proxy database that contains only plproxy interfaces for these functions. Users get access
onlyto proxy database. This way it is easier to rest assured that users don't get access by accident to something they
shouldnot.<br /><br />regards,<br />Asko <br /><br /><div class="gmail_quote">On Sat, Dec 6, 2008 at 8:21 PM, Andrew
Chernow<span dir="ltr"><<a href="mailto:ac@esilo.com">ac@esilo.com</a>></span> wrote:<br /><blockquote
class="gmail_quote"style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Lookingfor a way to limited a user to a specific set of queries.  I don't think this can be done right now ... or can
it? Has this feature request surfaced in the past?<br /><br /> I currently need this as an extra security measure for a
libpqclient app (want to block arbitrary queries from malicious attackers).  The easiest way I found was to add some
query_stringchecks into backend/tcop/postgres.c for the 'Q' and 'P' commands in PostgresMain().  Seems to work just
fine. If it doesn't match, I issue an ereport FATAL since that is seen as a "malicious query execution attempt".<br
/><br/> I think it is something rather simple to design/implement (probably use a table of user allowed queries,
supportregex matches, etc.. loaded at session startup and SIGHUP).<br /><br /> -- <br /> Andrew Chernow<br /> eSilo,
LLC<br/> every bit counts<br /><a href="http://www.esilo.com/" target="_blank">http://www.esilo.com/</a><br /><font
color="#888888"><br/> -- <br /> Sent via pgsql-hackers mailing list (<a href="mailto:pgsql-hackers@postgresql.org"
target="_blank">pgsql-hackers@postgresql.org</a>)<br/> To make changes to your subscription:<br /><a
href="http://www.postgresql.org/mailpref/pgsql-hackers"
target="_blank">http://www.postgresql.org/mailpref/pgsql-hackers</a><br/></font></blockquote></div><br /> 

pgsql-hackers by date:

Previous
From: Josh Williams
Date:
Subject: Quick patch: Display sequence owner
Next
From: "Hitoshi Harada"
Date:
Subject: Re: Windowing Function Patch Review -> Standard Conformance