Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id A8DE6632380 for ; Mon, 20 Apr 2009 15:37:32 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 08608-03 for ; Mon, 20 Apr 2009 15:37:30 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from yw-out-2324.google.com (yw-out-2324.google.com [74.125.46.29]) by mail.postgresql.org (Postfix) with ESMTP id 49C7163405E for ; Mon, 20 Apr 2009 15:37:30 -0300 (ADT) Received: by yw-out-2324.google.com with SMTP id 3so1584125ywj.73 for ; Mon, 20 Apr 2009 11:37:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=j8BpERDDF2zwnhWHPADpzsB4l0FNsTWV74xqtsXFsoo=; b=dNQdleqN+WFm25vR5N/Qm9iT3MO8nVq045tNzn/+7G2Df9uTuLnAt047COzmCTN58I W+9TIRVUTlGXXpunA+6K04pDc69hdXdc5NPMTtsOSQvedOZn1+LlqoBx2826xdgAHi4M gJz8GKugeXTgj4dAWx4Ckhk4z9+DN0gxD4AB0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=wWKDtGiB5R7pWjkwie/grkVsu0iXbh1OATI6o28f8tSca+SctAmyhIyATK4Uj+YuR3 hP9aGqv4kNG4s5stYaA5ajiqD+3R+mcOMLjPwqRaby38wvIwgnDoplyjoNPm/kIGFyeU EzuwiSw49pFQ78G2ESqKCodTLlwlE+IwkcK+E= MIME-Version: 1.0 Received: by 10.100.248.16 with SMTP id v16mr8284820anh.60.1240252649300; Mon, 20 Apr 2009 11:37:29 -0700 (PDT) In-Reply-To: <20090420164800.GC29747@calyx.svana.org> References: <49E9D5B6.9050406@enterprisedb.com> <49EAD5A6.4010601@enterprisedb.com> <49EADF16.3050400@kaigai.gr.jp> <12899.1240152674@sss.pgh.pa.us> <49EBC588.4090807@ak.jp.nec.com> <49EC0B94.6070107@enterprisedb.com> <49EC198F.6090604@ak.jp.nec.com> <5233.1240236841@sss.pgh.pa.us> <4136ffa0904200748k67a6058bue08c233a745317bc@mail.gmail.com> <20090420164800.GC29747@calyx.svana.org> Date: Mon, 20 Apr 2009 14:37:29 -0400 Message-ID: <603c8f070904201137p72d805ai6b75c70ee8c31bfd@mail.gmail.com> Subject: Re: [PATCH] unalias of ACL_SELECT_FOR_UPDATE From: Robert Haas To: Martijn van Oosterhout Cc: Greg Stark , Tom Lane , KaiGai Kohei , Heikki Linnakangas , KaiGai Kohei , pgsql-hackers@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200904/1052 X-Sequence-Number: 137155 On Mon, Apr 20, 2009 at 12:48 PM, Martijn van Oosterhout wrote: > On Mon, Apr 20, 2009 at 03:48:11PM +0100, Greg Stark wrote: >> So in this situation -- I suspect, if any SELinux people want to pipe >> up to tell me whether I'm on the right track -- the idea is that you >> should be able to examine a user superficially and know for certain >> whether he has the ability to lock a record or whether that privilege >> has been denied him. It shouldn't be possible for him to gain the >> privilege by going through a view or trigger which runs as another >> user. > > My (admittedly superficial) research into the topic suggests to me that > it's because SELinux is entirely into protecting the data. It doesn't > really care whether you're accessing it via a view or function or what. > If you don't have permissions you can't get it and no-one within > postgresql can grant you access either (that's why it's MAC). > > The way I understood the specific problem here is that SELECT FOR > UPDATE doesn't semantically change any data so you don't really need > UPDATE permissions to do it. That's just an artifact of the Postgres > implementation. > >> If on the other hand I'm wrong and this isn't a fundamental feature >> but just an implementation question then I think the right solution is >> to fix the problems that make it hard to implement the Postgres >> security model in SELinux. The consensus earlier was that the first >> version of the patch to land would just be a minimal patch which >> implements the existing security model using SELinux without making >> any changes to the model. Playing around with new privileges and how >> we distinguish referential integrity checks wouldn't be part of that. > > ISTM that limiting the patch to doing what can already be done with > standard postgresql is silly. SE-Postgres is not trying to supplant the > Pg model, it's trying to do things that the Pg model can't do. Namely, > label stuff secret and be sure no-one without clearence can read it, > even if someone makes a setuid function for it. Not really, because SE-PostgreSQL introduces its own analogue of setuid/security definer, which happens to be called "trusted procedure", and you can do the same darn thing. The issue at hand is foreign key constraints. Standard PostgreSQL checks those constraints as the table owner using the table owner's credentials. The question is whether there's some reason why SE-PostgreSQL shouldn't do the same. ...Robert