Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1csxsr-00051p-EA for pgsql-hackers@arkaria.postgresql.org; Tue, 28 Mar 2017 20:38:29 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1csxsq-0003hz-GG for pgsql-hackers@arkaria.postgresql.org; Tue, 28 Mar 2017 20:38:28 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1csxrL-00013L-BG for pgsql-hackers@postgresql.org; Tue, 28 Mar 2017 20:36:55 +0000 Received: from mail-pg0-x244.google.com ([2607:f8b0:400e:c05::244]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1csxrI-00084W-2T for pgsql-hackers@postgresql.org; Tue, 28 Mar 2017 20:36:54 +0000 Received: by mail-pg0-x244.google.com with SMTP id g2so23807504pge.2 for ; Tue, 28 Mar 2017 13:36:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=AfHnIL2qoFWVeS2HD++Rn5xKq0TJRzZRuMbtyhS+Wok=; b=KIk09VjPX6VlEqpJyv1x4QkzINdZtxkZ74mqWU9R4ytCwooToAb8bo2UsmOSQiEkF/ fMCglegACCF1cH+fkyDaWPpEqxSEgNfUu/hzL22tXZzgcNa3wGvJ3ZMadMLv0VRv1sIw 4aXc9oz6Z+KM1QmH7vSpdYjeU7lareicy2GtjWPo1E00dLA2lLAjV5AKkloF1jOd+Q22 igCBYS/MNR7bkChmJbmZt6M11Cy70CaTHn1YFtJeDqklblP/KsVRQ64kql3IO+kam5Fb mKrRDPLeFz8jqAPHfAJKN4fZl5vMmw0X5twxpq8abg62y/8i7p71v8QQN3O5ousD48vW w1Og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=AfHnIL2qoFWVeS2HD++Rn5xKq0TJRzZRuMbtyhS+Wok=; b=Sdrb2N6mzwIKRK9E88ozCtcfP+kTg4YtGLneHTi+TsfN9FVSXuwtY2O7UNJb6Ly81g uRp3ySYEoNLe/dxpIzpQqtxaqe5jlhb9e1T2NbGA9NSvvfJLfyU/oVSxPQG07KcqxjcZ M7bjqg7oiaCE73WZlI8cVGVtrFFffDqeb2W/vkYyAMtIpOfJE0+cDU4h2qkjPwR+fpWv DelU4Y6RAnHjeGG+mhujWu8DAuYi2w1P2MM2zAse1SZoKjK2zR+71PHZZyl5vEj3TOod qRCoPpstR1xmaOuV8khwrh03YqsgvFxFqq4xbwntD8+lAFvn++DH7B5RKaaccW5TFKZx X8Gg== X-Gm-Message-State: AFeK/H03doR+CTRfGq8LDtIEUPvIfP55NE7DGtwQulF7zImZVdMhCsdXD9DZrAKZKKaBlA== X-Received: by 10.99.49.13 with SMTP id x13mr31628072pgx.128.1490733410533; Tue, 28 Mar 2017 13:36:50 -0700 (PDT) Received: from [192.168.2.121] (24-113-198-113.wavecable.com. [24.113.198.113]) by smtp.gmail.com with ESMTPSA id w28sm9050071pfl.115.2017.03.28.13.36.49 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 28 Mar 2017 13:36:49 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: Monitoring roles patch From: Mark Dilger In-Reply-To: <24603.1490732232@sss.pgh.pa.us> Date: Tue, 28 Mar 2017 13:36:44 -0700 Cc: Dave Page , Peter Eisentraut , Stephen Frost , Robert Haas , PostgreSQL Hackers Content-Transfer-Encoding: quoted-printable Message-Id: References: <20170322131510.GC9812@tamriel.snowman.net> <20170323122335.GK9812@tamriel.snowman.net> <957FCA21-99DA-4477-9A6E-C86ACAC23E36@gmail.com> <7161672F-1EC5-478F-B307-FF28B01D0D62@gmail.com> <19369.1490727172@sss.pgh.pa.us> <248F178D-0A7F-4C6E-963C-BDEFB295! CB67@gmail.com> <24603.1490732232@sss.pgh.pa.us> To: Tom Lane X-Mailer: Apple Mail (2.3124) X-Pg-Spam-Score: -2.0 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org > On Mar 28, 2017, at 1:17 PM, Tom Lane wrote: >=20 > Mark Dilger writes: >> I don't see anything wrong with adding roles in pg_authid.h with a #defi= ne'd >> Oid. That's actually pretty helpful for anyone writing code against the= database, >> as they don't have to look up the Oid of the role. >=20 >> But why not then grant privileges to that role in information_schema.sql= ?=20 >=20 > To the extent that the desired privileges can be represented at the SQL > level, I agree that that's a better solution than hard-wiring checks in C > code. The problem comes in with cases where that's not fine-grained > enough. Consider a policy like "anybody can select from pg_stat_activity, > but unless you have privilege X, the query column should read as nulls > except for sessions belonging to you". That behavior can't realistically > be represented as a separate SQL privilege. Right now we have "privilege > X" for this purpose hard-coded as "is superuser", but it would be much > better if it were associated with a grantable role. Many thanks for all the explanation. I now understand better what the patch is trying to do, and have (with some experimentation) seen flaws in what I was saying upthread. I find the notion of a role not being a group of privileges but instead actually being a privilege confusing, and it made it hard to think about the security implications of the proposal. I'm accustomed to the idea of being able to revoke a privilege from a role, and that doesn't work if the "role" is in some sense a privilege, not a role. I might find it all easier to think about if we named these things privileges and not roles, like pg_read_stats_privilege instead of pg_read_stats_role, and then we could grant pg_read_stats_privilege to roles. But I recall you were saying upthread that you did not want to have privilege bits for each of these types of things. I hope this feature is worth the confusion it causes. mark --=20 Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers