Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id D602E632BCB for ; Mon, 19 Oct 2009 04:28:31 -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 30979-01 for ; Mon, 19 Oct 2009 07:28:17 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from tyo202.gate.nec.co.jp (TYO202.gate.nec.co.jp [202.32.8.206]) by mail.postgresql.org (Postfix) with ESMTP id 69722632888 for ; Mon, 19 Oct 2009 04:28:20 -0300 (ADT) Received: from mailgate4.nec.co.jp ([10.7.69.184]) by tyo202.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id n9J7SDhQ005785; Mon, 19 Oct 2009 16:28:13 +0900 (JST) Received: (from root@localhost) by mailgate4.nec.co.jp (8.11.7/3.7W-MAILGATE-NEC) id n9J7SDq00851; Mon, 19 Oct 2009 16:28:13 +0900 (JST) Received: from mail03.kamome.nec.co.jp (mail03.kamome.nec.co.jp [10.25.43.7]) by mailsv3.nec.co.jp (8.13.8/8.13.4) with ESMTP id n9J7SCd5018385; Mon, 19 Oct 2009 16:28:12 +0900 (JST) Received: from genzui.jp.nec.com ([10.26.220.13] [10.26.220.13]) by mail02.kamome.nec.co.jp with ESMTP id BT-MMP-2658181; Mon, 19 Oct 2009 16:27:48 +0900 Received: from [10.19.71.82] ([10.19.71.82] [10.19.71.82]) by mail.jp.nec.com with ESMTP; Mon, 19 Oct 2009 16:27:25 +0900 Message-ID: <4ADC14DD.1070504@ak.jp.nec.com> Date: Mon, 19 Oct 2009 16:27:25 +0900 From: KaiGai Kohei User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: Heikki Linnakangas 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> <4ADC0EDE.9080406@enterprisedb.com> In-Reply-To: <4ADC0EDE.9080406@enterprisedb.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.532 tagged_above=-10 required=5 tests=AWL=0.067, BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200910/1021 X-Sequence-Number: 147833 Heikki Linnakangas wrote: > 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. The importance of the feature is relatively minor than MAC itself. So, I can agree to omit code corresponding to statement support from the first patch. (IIRC, about 300-400 lines can be reduced.) But it will be necessary feature at the next step, because DBA cannot create a special purpose table without statement support. For example, if security policy allows DBA to create read-writable table (in default) and read-only table. He cannot set up read-only table without explicit security label support. >>>> 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. I think we already learned refactoring DAC checks need widespread code changes and pushes a burden to reviewers. In this case, I think the point just after invocation of ExecCheckRTEPerms() in ExecCheckRTPerms() is the best point to put SE-PgSQL's checks. Needless to say, its specification should be clearly documented. Thanks, -- OSS Platform Development Division, NEC KaiGai Kohei