postgresql/src/backend/access
Joe Conway cfa928ff6f Plug RLS related information leak in pg_stats view.
The pg_stats view is supposed to be restricted to only show rows
about tables the user can read. However, it sometimes can leak
information which could not otherwise be seen when row level security
is enabled. Fix that by not showing pg_stats rows to users that would
be subject to RLS on the table the row is related to. This is done
by creating/using the newly introduced SQL visible function,
row_security_active().

Along the way, clean up three call sites of check_enable_rls(). The second
argument of that function should only be specified as other than
InvalidOid when we are checking as a different user than the current one,
as in when querying through a view. These sites were passing GetUserId()
instead of InvalidOid, which can cause the function to return incorrect
results if the current user has the BYPASSRLS privilege and row_security
has been set to OFF.

Additionally fix a bug causing RI Trigger error messages to unintentionally
leak information when RLS is enabled, and other minor cleanup and
improvements. Also add WITH (security_barrier) to the definition of pg_stats.

Bumped CATVERSION due to new SQL functions and pg_stats view definition.

Back-patch to 9.5 where RLS was introduced. Reported by Yaroslav.
Patch by Joe Conway and Dean Rasheed with review and input by
Michael Paquier and Stephen Frost.
2015-07-28 13:21:37 -07:00
..
brin Improve BRIN documentation somewhat 2015-07-20 12:16:40 +02:00
common Support "expanded" objects, particularly arrays, for better performance. 2015-05-14 12:08:49 -04:00
gin Reuse all-zero pages in GIN. 2015-07-27 12:31:05 +03:00
gist pgindent run for 9.5 2015-05-23 21:35:49 -04:00
hash Remove unnecessary variables in _hash_splitbucket(). 2015-04-03 16:49:44 -04:00
heap Redesign tablesample method API, and do extensive code review. 2015-07-25 14:39:00 -04:00
index Plug RLS related information leak in pg_stats view. 2015-07-28 13:21:37 -07:00
nbtree Avoid calling PageGetSpecialPointer() on an all-zeros page. 2015-07-27 12:31:05 +03:00
rmgrdesc Use appendStringInfoString/Char et al where appropriate. 2015-07-02 12:36:31 +03:00
spgist Don't assume that PageIsEmpty() returns true on an all-zeros page. 2015-07-27 18:54:27 +03:00
tablesample Dodge portability issue (apparent compiler bug) in new tablesample code. 2015-07-25 19:42:44 -04:00
transam Another attempt at fixing memory leak in xlogreader. 2015-07-28 09:09:00 +03:00
Makefile TABLESAMPLE, SQL Standard and extensible 2015-05-15 14:37:10 -04:00