pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: RLS: Fix ALL vs. SELECT+UPDATE policy usage 3+ messages / 1 participants [nested] [flat]
* pgsql: RLS: Fix ALL vs. SELECT+UPDATE policy usage @ 2017-05-07 01:48 Stephen Frost <sfrost@snowman.net> 0 siblings, 0 replies; 3+ messages in thread From: Stephen Frost @ 2017-05-07 01:48 UTC (permalink / raw) To: pgsql-committers RLS: Fix ALL vs. SELECT+UPDATE policy usage When we add the SELECT-privilege based policies to the RLS with check options (such as for an UPDATE statement, or when we have INSERT ... RETURNING), we need to be sure and use the 'USING' case if the policy is actually an 'ALL' policy (which could have both a USING clause and an independent WITH CHECK clause). This could result in policies acting differently when built using ALL (when the ALL had both USING and WITH CHECK clauses) and when building the policies independently as SELECT and UPDATE policies. Fix this by adding an explicit boolean to add_with_check_options() to indicate when the USING policy should be used, even if the policy has both USING and WITH CHECK policies on it. Reported by: Rod Taylor Back-patch to 9.5 where RLS was introduced. Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/aa5d3c0b3fb906dfa910b0ca6f75ab701b2f1c09 Modified Files -------------- src/backend/rewrite/rowsecurity.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: RLS: Fix ALL vs. SELECT+UPDATE policy usage @ 2017-05-07 01:48 Stephen Frost <sfrost@snowman.net> 0 siblings, 0 replies; 3+ messages in thread From: Stephen Frost @ 2017-05-07 01:48 UTC (permalink / raw) To: pgsql-committers RLS: Fix ALL vs. SELECT+UPDATE policy usage When we add the SELECT-privilege based policies to the RLS with check options (such as for an UPDATE statement, or when we have INSERT ... RETURNING), we need to be sure and use the 'USING' case if the policy is actually an 'ALL' policy (which could have both a USING clause and an independent WITH CHECK clause). This could result in policies acting differently when built using ALL (when the ALL had both USING and WITH CHECK clauses) and when building the policies independently as SELECT and UPDATE policies. Fix this by adding an explicit boolean to add_with_check_options() to indicate when the USING policy should be used, even if the policy has both USING and WITH CHECK policies on it. Reported by: Rod Taylor Back-patch to 9.5 where RLS was introduced. Branch ------ REL9_6_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/92b15224b4eac8eeae0616491ccf0c852fa2dff9 Modified Files -------------- src/backend/rewrite/rowsecurity.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: RLS: Fix ALL vs. SELECT+UPDATE policy usage @ 2017-05-07 01:48 Stephen Frost <sfrost@snowman.net> 0 siblings, 0 replies; 3+ messages in thread From: Stephen Frost @ 2017-05-07 01:48 UTC (permalink / raw) To: pgsql-committers RLS: Fix ALL vs. SELECT+UPDATE policy usage When we add the SELECT-privilege based policies to the RLS with check options (such as for an UPDATE statement, or when we have INSERT ... RETURNING), we need to be sure and use the 'USING' case if the policy is actually an 'ALL' policy (which could have both a USING clause and an independent WITH CHECK clause). This could result in policies acting differently when built using ALL (when the ALL had both USING and WITH CHECK clauses) and when building the policies independently as SELECT and UPDATE policies. Fix this by adding an explicit boolean to add_with_check_options() to indicate when the USING policy should be used, even if the policy has both USING and WITH CHECK policies on it. Reported by: Rod Taylor Back-patch to 9.5 where RLS was introduced. Branch ------ REL9_5_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/d617c7629c0806a245555c0fe74331935c726569 Modified Files -------------- src/backend/rewrite/rowsecurity.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2017-05-07 01:48 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2017-05-07 01:48 pgsql: RLS: Fix ALL vs. SELECT+UPDATE policy usage Stephen Frost <sfrost@snowman.net> 2017-05-07 01:48 pgsql: RLS: Fix ALL vs. SELECT+UPDATE policy usage Stephen Frost <sfrost@snowman.net> 2017-05-07 01:48 pgsql: RLS: Fix ALL vs. SELECT+UPDATE policy usage Stephen Frost <sfrost@snowman.net>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox