Received: from localhost (unknown [200.46.204.184]) by developer.postgresql.org (Postfix) with ESMTP id 57AD42E0045 for ; Tue, 8 Apr 2008 11:21:06 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 93307-03 for ; Tue, 8 Apr 2008 11:20:51 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from main2.mycybernet.net (main2.mycybernet.net [209.222.63.140]) by developer.postgresql.org (Postfix) with ESMTP id 02DF72E0047 for ; Tue, 8 Apr 2008 11:20:59 -0300 (ADT) Received: from 227-54-222-209.mycybernet.net ([209.222.54.227] helo=crankycanuck.ca) by main2.mycybernet.net with esmtp (Exim 4.62) (envelope-from ) id 1JjEgg-0005FC-CQ for pgsql-admin@postgresql.org; Tue, 08 Apr 2008 10:20:38 -0400 Received: by crankycanuck.ca (Postfix, from userid 1000) id 09A7A5014B; Tue, 8 Apr 2008 10:20:12 -0400 (EDT) Date: Tue, 8 Apr 2008 10:20:12 -0400 From: Andrew Sullivan To: pgsql-admin@postgresql.org Subject: Re: Hiding PG/SQL functions Message-ID: <20080408142011.GB8310@crankycanuck.ca> Mail-Followup-To: Andrew Sullivan , pgsql-admin@postgresql.org References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.13 (2006-08-11) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200804/77 X-Sequence-Number: 28841 On Tue, Apr 08, 2008 at 12:25:03PM +0200, biggero@poczta.onet.pl wrote: > > My questions are: > 1. How can you hide PG/SQL functions from other users, so that they can't > see the functions, but they can still execute them? See the archives on this. There are some tricks suggested, but the short answer is, "You can't." > 2. What do you think about this idea: Can you embed PG/SQL function in a C > code, compile it to a shared library and then let the users use it? How do > you do that? This would protect my functions (I think). I would rather > not give up PG/SQL language as the procedures are almost ready. So > embedding PG/SQL in C is feasible, while writing all procedures from the > scratch rather not. I don't know what it would mean to embed them in C code: you'd have to write enough C that you might as well just port the functions completely. > 3. Where can I find more details about database security in this respect > (ie. protection of my code). Even some links to the manual would be > helpful. Well, to begin with, you can do a quick search for "Security by obscurity," where you will likely discover that this is no kind of security at all (not even, really, protection of your code: it'd be fairly trivial even if you could obscure your functions to find out what they're doing, by looking at the logs of the database back end). Unless you run everything for the users and control where the code is installed and how it is distributed, some people will almost certainly attempt to do something with your code that you don't want them doing (as just about every software vendor has re-learned for themselves). Best, A