Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 4C392632EAE for ; Mon, 19 Oct 2009 04:02:07 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 26951-01 for ; Mon, 19 Oct 2009 07:01:53 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from exprod7og101.obsmtp.com (exprod7og101.obsmtp.com [64.18.2.155]) by mail.postgresql.org (Postfix) with SMTP id EF843632CB8 for ; Mon, 19 Oct 2009 04:01:55 -0300 (ADT) Received: from source ([74.125.78.150]) by exprod7ob101.postini.com ([64.18.6.12]) with SMTP ID DSNKStwO4sX9H6dqGkCXPRUrfnqd1ZmZ0ZZs@postini.com; Mon, 19 Oct 2009 00:01:56 PDT Received: by ey-out-1920.google.com with SMTP id 3so721862eyh.20 for ; Mon, 19 Oct 2009 00:01:53 -0700 (PDT) Received: by 10.211.147.5 with SMTP id z5mr5070034ebn.87.1255935713751; Mon, 19 Oct 2009 00:01:53 -0700 (PDT) Received: from ?192.168.1.117? ([88.195.103.165]) by mx.google.com with ESMTPS id 5sm1686682eyh.41.2009.10.19.00.01.51 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 19 Oct 2009 00:01:52 -0700 (PDT) Message-ID: <4ADC0EDE.9080406@enterprisedb.com> Date: Mon, 19 Oct 2009 10:01:50 +0300 From: Heikki Linnakangas Organization: EnterpriseDB User-Agent: Mozilla-Thunderbird 2.0.0.22 (X11/20090706) MIME-Version: 1.0 To: KaiGai Kohei CC: KaiGai Kohei , Tom Lane , Stephen Frost , robertmhaas@gmail.com, pgsql-hackers@postgresql.org Subject: Re: Reworks for Access Control facilities (r2363) References: <4AC5A14F.6050306@ak.jp.nec.com> <20091012024604.GW17756@tamriel.snowman.net> <4AD54082.9050001@ak.jp.nec.com> <10495.1255627322@sss.pgh.pa.us> <4AD7CCDD.1070402@ak.jp.nec.com> <4AD83EC6.2080800@enterprisedb.com> <4AD94806.9020802@kaigai.gr.jp> <4AD9CC56.9090609@enterprisedb.com> <4ADBE437.1090002@ak.jp.nec.com> In-Reply-To: <4ADBE437.1090002@ak.jp.nec.com> Content-Type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.476 tagged_above=-10 required=5 tests=AWL=0.123, BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200910/1019 X-Sequence-Number: 147831 KaiGai Kohei wrote: > When we create a new object, we can provide an explicit security context > to be assigned on the new object, instead of the default one. To get started, do we really need that feature? It would make for a significantly smaller patch if there was no explicit security labels on objects. >>> On the other hand, the default PG model allows to bypass checks on >>> certain objects. For example, column-level privileges are only checked >>> when a user does not have enough permissions on the target table. >>> If "SELECT a,b FROM t" is given, pg_attribute_aclcheck() may not invoked >>> when user has needed privileges on the table t. >> Hmm, I see. Yes, it does seem like we'd need to change such permission >> checks to accommodate both models. > > I'm not clear why we need to rework the permission checks here. > DAC and MAC perform orthogonally and independently. > DAC allows to override column-level privileges by table-level privileges > according to the default PG's model. It seems to me fine. > On the other hand, MAC checks both of permissions. It is also fine. I meant we need to refactor the code doing the permission checks. The existing checks are doing the right thing for DAC, but as you point out, if the MAC checks are within pg_*_aclcheck() functions, pg_attribute_aclcheck() needs to be called even if you have privilege on the table. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com