Re: [HACKERS] Fixing insecure security definer functions

2007-08-10 Thread Sergiy Vyshnevetskiy



3. Add optional clauses to CREATE FUNCTION and ALTER FUNCTION to specify
the propath value.  I suggest, but am not wedded to,
PATH 'foo, bar'
PATH NONE
Since PATH NONE is the default, it's not really needed in CREATE
FUNCTION, but it seems useful to allow it for ALTER FUNCTION.


I think NONE may be a bit misleading, as if path will be empty.
CURRENT sounds better for this.

Add
PATH SAVED
as shorthand to
PATH current_setting('search_path')
as well.

Default should be SAVED for SECURITY DEFINER functions.
A parameter to set the default for SECURITY INVOKER functions would be 
nice too.


---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
  subscribe-nomail command to [EMAIL PROTECTED] so that your
  message can get through to the mailing list cleanly


Re: [HACKERS] crypting prosrc in pg_proc

2007-08-10 Thread Sergiy Vyshnevetskiy

On Fri, 10 Aug 2007, Gregory Stark wrote:


Jonah H. Harris [EMAIL PROTECTED] writes:


Obfuscation doesn't really work, it just makes big wigs in companies
*think* it's not easily reversible.

There is no real security.  With enough time and experience, anything
can be broken.


But that said, I wonder if having something may be useful legally for some
users.

If someone just went and did select * from pg_proc they could claim they
weren't violating their EULA or any protection you had put in place. If they
went through the trouble having to de-obfuscate it then you would have a
strong DMCA claim in the US.


We can split pg_proc into pg_procinfo and pg_procsrc.

pg_procinfo contains all information about function except source code and 
is readable to all.


pg_procsrc has the source and readable only to system and superusers.

pg_proc is a view that joins the two. If database developer wants to limit 
user access, they add conditions to the view as necessary, e.g.


proowner in ('postgres',current_user)

or whatever they want.

---(end of broadcast)---
TIP 7: You can help support the PostgreSQL project by donating at

   http://www.postgresql.org/about/donate