forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commita2944d8
committed
Fix missed corner cases for grantable permissions on GUCs.
We allow users to set the values of not-yet-loaded extension GUCs,remembering those values in "placeholder" GUC entries. When/ifthe extension is loaded later in the session, we need to verify thatthe user had permissions to set the GUC. That was done correctlybefore commita0ffa88, but as of that commit, we'd check thepermissions of the active role when the LOAD happens, not the rolethat had set the value. (This'd be a security bug if it had made itinto a released version.)In principle this is simple enough to fix: we just need to rememberthe exact role OID that set each GUC value, and use that notGetUserID() when verifying permissions. Maintaining that data inthe guc.c data structures is slightly tedious, but fortunately it'sall basically just copy-n-paste of the logic for tracking theGucSource of each setting, as we were already doing.Another oversight is that validate_option_array_item() hadn'tbeen taught to check for granted GUC privileges. This appearsto manifest only in that ALTER ROLE/DATABASE RESET ALL willfail to reset settings that the user should be allowed to reset.Patch by myself and Nathan Bossart, per report from Nathan Bossart.Back-patch to v15 where the faulty code came in.Discussion:https://postgr.es/m/20220706224727.GA2158260@nathanxps131 parent795ccd4 commita2944d8
File tree
8 files changed
+280
-59
lines changed- src
- backend
- commands
- utils/misc
- include/utils
- pl/plperl
- expected
- sql
- test/modules/unsafe_tests
- expected
- sql
8 files changed
+280
-59
lines changedLines changed: 7 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
907 | 907 |
| |
908 | 908 |
| |
909 | 909 |
| |
| 910 | + | |
| 911 | + | |
| 912 | + | |
910 | 913 |
| |
911 | 914 |
| |
912 | 915 |
| |
| |||
915 | 918 |
| |
916 | 919 |
| |
917 | 920 |
| |
918 |
| - | |
919 |
| - | |
920 |
| - | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
921 | 925 |
| |
922 | 926 |
| |
923 | 927 |
| |
|
0 commit comments
Comments
(0)