Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1amWhi-0001HY-Tc for pgsql-bugs@arkaria.postgresql.org; Sun, 03 Apr 2016 01:19:51 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1amWhi-0006Q7-DI for pgsql-bugs@arkaria.postgresql.org; Sun, 03 Apr 2016 01:19:50 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1amRkH-0003Np-J1 for pgsql-bugs@postgresql.org; Sat, 02 Apr 2016 20:02:09 +0000 Received: from wrigleys.postgresql.org ([204.145.124.246]) by magus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1amRkB-0004i2-9P for pgsql-bugs@postgresql.org; Sat, 02 Apr 2016 20:02:08 +0000 MIME-Version: 1.0 Subject: BUG #14060: row security policy does not work for updatable views To: pgsql-bugs@postgresql.org From: adudnik@gmail.com Date: Sat, 02 Apr 2016 20:01:06 +0000 Message-ID: <20160402200106.2623.11425@wrigleys.postgresql.org> X-Pg-Spam-Score: -0.3 (/) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org The following bug has been logged on the website: Bug reference: 14060 Logged by: Artur Dudnik Email address: adudnik@gmail.com PostgreSQL version: 9.5.1 Operating system: Windows Description: -- row security policy does not work for updatable views. -- usage scenario: -- 1. make a table -- 2. enable row security for a role -- 3. create view for restricted table -- 4. grant to restricted role select and update for view and table -- expected behavior - view and table could select/update same records -- bug behavior - view return/update all rows (policy ignored) and security_barrier too set role postgres; CREATE TABLE t AS SELECT n, 'secret'||n AS secret FROM generate_series(1,20) n; create role test; grant select, update on t to test; ALTER TABLE t ENABLE ROW LEVEL SECURITY; CREATE POLICY t_all ON t TO test USING (n % 2 = 1); CREATE VIEW t_odd WITH (security_barrier) AS SELECT * FROM t ; CREATE VIEW t2_odd AS SELECT * FROM t ; CREATE VIEW t3_odd WITH (security_barrier) AS SELECT * FROM t where n % 2 = 1; grant select, update on t_odd to test; grant select, update on t2_odd to test; grant select, update on t3_odd to test; set role test; update t3_odd set secret = '!!!' where n in (2, 1); select * from t3_odd; update t_odd set secret = '!!!' where n in (4, 3); select * from t_odd; update t2_odd set secret = '!!!' where n in (6, 5); select * from t2_odd; set role postgres; select * from t; drop view t_odd cascade; drop view t2_odd cascade; drop table t cascade; drop role test; -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs