Commit 1aebfbe
committed
Fix security checks for selectivity estimation functions with RLS.
In commit e2d4ef8, security checks were added to prevent
user-supplied operators from running over data from pg_statistic
unless the user has table or column privileges on the table, or the
operator is leakproof. For a table with RLS, however, checking for
table or column privileges is insufficient, since that does not
guarantee that the user has permission to view all of the column's
data.
Fix this by also checking for securityQuals on the RTE, and insisting
that the operator be leakproof if there are any. Thus the
leakproofness check will only be skipped if there are no securityQuals
and the user has table or column privileges on the table -- i.e., only
if we know that the user has access to all the data in the column.
Back-patch to 9.5 where RLS was added.
Dean Rasheed, reviewed by Jonathan Katz and Stephen Frost.
Security: CVE-2019-101301 parent bd5e8b6 commit 1aebfbe
File tree
3 files changed
+56
-6
lines changed- src
- backend/utils/adt
- test/regress
- expected
- sql
3 files changed
+56
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4597 | 4597 | | |
4598 | 4598 | | |
4599 | 4599 | | |
4600 | | - | |
| 4600 | + | |
| 4601 | + | |
| 4602 | + | |
| 4603 | + | |
4601 | 4604 | | |
4602 | 4605 | | |
| 4606 | + | |
4603 | 4607 | | |
4604 | 4608 | | |
4605 | 4609 | | |
| |||
4663 | 4667 | | |
4664 | 4668 | | |
4665 | 4669 | | |
4666 | | - | |
| 4670 | + | |
| 4671 | + | |
| 4672 | + | |
| 4673 | + | |
| 4674 | + | |
4667 | 4675 | | |
4668 | | - | |
4669 | | - | |
4670 | | - | |
4671 | | - | |
| 4676 | + | |
| 4677 | + | |
| 4678 | + | |
| 4679 | + | |
| 4680 | + | |
4672 | 4681 | | |
4673 | 4682 | | |
4674 | 4683 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3937 | 3937 | | |
3938 | 3938 | | |
3939 | 3939 | | |
| 3940 | + | |
| 3941 | + | |
| 3942 | + | |
| 3943 | + | |
| 3944 | + | |
| 3945 | + | |
| 3946 | + | |
| 3947 | + | |
| 3948 | + | |
| 3949 | + | |
| 3950 | + | |
| 3951 | + | |
| 3952 | + | |
| 3953 | + | |
| 3954 | + | |
| 3955 | + | |
| 3956 | + | |
| 3957 | + | |
| 3958 | + | |
| 3959 | + | |
| 3960 | + | |
3940 | 3961 | | |
3941 | 3962 | | |
3942 | 3963 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1790 | 1790 | | |
1791 | 1791 | | |
1792 | 1792 | | |
| 1793 | + | |
| 1794 | + | |
| 1795 | + | |
| 1796 | + | |
| 1797 | + | |
| 1798 | + | |
| 1799 | + | |
| 1800 | + | |
| 1801 | + | |
| 1802 | + | |
| 1803 | + | |
| 1804 | + | |
| 1805 | + | |
| 1806 | + | |
| 1807 | + | |
| 1808 | + | |
| 1809 | + | |
| 1810 | + | |
| 1811 | + | |
| 1812 | + | |
1793 | 1813 | | |
1794 | 1814 | | |
1795 | 1815 | | |
| |||
0 commit comments