Re: feature suggestion and return to pgsql-general :-)

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Dennis Gearon <gearond(at)sbcglobal(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: feature suggestion and return to pgsql-general :-)
Date: 2009-04-24 15:56:45
Message-ID: b42b73150904240856o2091f824oe9a8e7912b8a52f8@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Apr 24, 2009 at 12:53 AM, Dennis Gearon <gearond(at)sbcglobal(dot)net> wrote:
>
> Hi guys, I am back after a long time of doing other kinds of work. Don't know if anybody remembers me - not a biggee.
>
> I am again working on a design of a web application for myself. Security seems MUCH more of an issue, EVERY day.
>
> So I had these to suggestions/feature requests.
>
> To prevent SQL injection, have either permissions-per-role, or DB wide, or DB instance configurable with defalaults and over ride configuration, blah blah, the following.
>
> A flag/permission to allow ONLY prepared queries
> A flag/permission to allow ONLY UDF/procedures.

This is a pretty easy feature to implement actually. We went a step
further and run all queries through a white list (obviously this only
makes sense for paramaterized queries).

Everything you need is in tcop.c. Everytime a query come in from the
client, you have an opportunity to intercept and run your own logic
about what's allowed. I don't think functions have to be handled
specially, you force them to be parameterized like any other query.
username is conveniently provided so you can use that in your logic.
It's quite effective.

This is a highly ad-hoc security strategy though, so I don't know if
it's worth a push to get it into core. Might be, though.

merlin

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Sam Mason 2009-04-24 16:15:02 Re: deleting function
Previous Message Tom Lane 2009-04-24 15:55:48 Re: deleting function