Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nWK9o-0003bb-Cb for pgsql-hackers@arkaria.postgresql.org; Mon, 21 Mar 2022 15:41:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nWK9n-0002s0-AB for pgsql-hackers@arkaria.postgresql.org; Mon, 21 Mar 2022 15:41:19 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nWK9n-0002pI-0V for pgsql-hackers@lists.postgresql.org; Mon, 21 Mar 2022 15:41:19 +0000 Received: from relay10.mail.gandi.net ([2001:4b98:dc4:8::230]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nWK9f-0008HX-T9 for pgsql-hackers@postgresql.org; Mon, 21 Mar 2022 15:41:18 +0000 Received: (Authenticated sender: adsend@dunslane.net) by mail.gandi.net (Postfix) with ESMTPSA id 37C0E240010; Mon, 21 Mar 2022 15:41:05 +0000 (UTC) Message-ID: <032148cd-fcdb-6d81-58b2-137a1b77e0e6@dunslane.net> Date: Mon, 21 Mar 2022 11:41:04 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: New Object Access Type hooks Content-Language: en-US To: Mark Dilger , PostgreSQL-development , Joshua Brindle Cc: Robert Haas , Tom Lane , Jeff Davis , Joe Conway References: <47F87A0E-C0E5-43A6-89F6-D403F2B45175@enterprisedb.com> From: Andrew Dunstan In-Reply-To: <47F87A0E-C0E5-43A6-89F6-D403F2B45175@enterprisedb.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 3/17/22 23:21, Mark Dilger wrote: > Hackers, > > Over in [1], Joshua proposed a new set of Object Access Type hooks based on strings rather than Oids. > > His patch was written to be applied atop my patch for granting privileges on gucs. > > On review of his patch, I became uncomfortable with the complete lack of regression test coverage. To be fair, he did paste a bit of testing logic to the thread, but it appears to be based on pgaudit, and it is unclear how to include such a test in the core project, where pgaudit is not assumed to be installed. > > First, I refactored his patch to work against HEAD and not depend on my GUCs patch. Find that as v1-0001. The refactoring exposed a bit of a problem. To call the new hook for SET and ALTER SYSTEM commands, I need to pass in the Oid of a catalog table. But since my GUC patch isn't applied yet, there isn't any such table (pg_setting_acl or whatnot) to pass. So I'm passing InvalidOid, but I don't know if that is right. In any event, if we want a new API like this, we should think a bit harder about whether it can be used to check operations where no table Oid is applicable. My first inclination is to say it's probably ok. The immediately obvious alternative would be to create yet another set of functions that don't have classId parameters. That doesn't seem attractive. Modulo that issue I think patch 1 is basically ok, but we should fix the comments in objectaccess.c.  Rather than "It is [the] entrypoint ..." we should have something like "Oid variant entrypoint ..." and "Name variant entrypoint ...", and also fix the function names in the comments. cheers andrew -- Andrew Dunstan EDB: https://www.enterprisedb.com