Re: eval function - Mailing list pgsql-general

From Chris Travers
Subject Re: eval function
Date
Msg-id CAKt_ZfuZsy7gFmjnuGmmkFqayVA0ErLgRa2CwtxULXpSpWyTFw@mail.gmail.com
Whole thread Raw
In response to Re: eval function  ("David Johnston" <polobo@yahoo.com>)
Responses Re: eval function
List pgsql-general
On Thu, Jul 28, 2011 at 8:08 AM, David Johnston <polobo@yahoo.com> wrote:

> At best, based upon the example using "current_timestamp()", you could only
> mark it as being stable, right?
>
> Also not mentioned; what risk is there of this function being hacked?  It
> places the supplied data within a "SELECT  (....) AS column_alias" structure
> so it seems to be pretty safe but can you devise a string that would, say,
> delete data or something similar.  I would expect the following: '1); DELETE
> FROM table; SELECT (2' to be dangerous.  What functions would you use to
> make the input string safe?  Does "quote_literal()" plug this hole?

I don't think the hole can be plugged.  The point of the function is
to execute arbitrary sql code.  That means doing SQL injection
purposely in the function.  I don't think there is a way around it
because SQL injection is specifically what is desired,

Best Wishes,
Chris Travers

pgsql-general by date:

Previous
From: Merlin Moncure
Date:
Subject: Re: eval function
Next
From: Chris Travers
Date:
Subject: Re: eval function