forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit638300f
committed
Disallow execution of SPI functions during plperl function compilation.
Perl can be convinced to execute user-defined code during compilationof a plperl function (or at least a plperlu function). That's notsuch a big problem as long as the activity is confined within thePerl interpreter, and it's not clear we could do anything about thatanyway. However, if such code tries to use plperl's SPI functions,we have a bigger problem. In the first place, those functions arelikely to crash because current_call_data->prodesc isn't set up yet.In the second place, because it isn't set up, we lack critical infosuch as whether the function is supposed to be read-only. And inthe third place, this path allows code execution during functionvalidation, which is strongly discouraged because of the potentialfor security exploits. Hence, reject execution of the SPI functionsuntil compilation is finished.While here, add check_spi_usage_allowed() calls to various functionsthat hadn't gotten the memo about checking that. I think that perhapsplperl_sv_to_literal may have been intentionally omitted on the groundsthat it was safe at the time; but if so, the addition of transformsfunctionality changed that. The others are more recently added andseem to be flat-out oversights.Per report from Mark Murawski. Back-patch to all supported branches.Discussion:https://postgr.es/m/9acdf918-7fff-4f40-f750-2ffa84f083d2@intellasoft.net1 parentcd83cb9 commit638300f
1 file changed
+31
-2
lines changedLines changed: 31 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
264 | 264 |
| |
265 | 265 |
| |
266 | 266 |
| |
| 267 | + | |
267 | 268 |
| |
268 | 269 |
| |
269 | 270 |
| |
| |||
1429 | 1430 |
| |
1430 | 1431 |
| |
1431 | 1432 |
| |
1432 |
| - | |
1433 |
| - | |
| 1433 | + | |
1434 | 1434 |
| |
1435 | 1435 |
| |
1436 | 1436 |
| |
1437 | 1437 |
| |
1438 | 1438 |
| |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
1439 | 1442 |
| |
1440 | 1443 |
| |
1441 | 1444 |
| |
| |||
3097 | 3100 |
| |
3098 | 3101 |
| |
3099 | 3102 |
| |
| 3103 | + | |
| 3104 | + | |
| 3105 | + | |
| 3106 | + | |
| 3107 | + | |
| 3108 | + | |
| 3109 | + | |
| 3110 | + | |
| 3111 | + | |
| 3112 | + | |
| 3113 | + | |
| 3114 | + | |
| 3115 | + | |
| 3116 | + | |
| 3117 | + | |
3100 | 3118 |
| |
3101 | 3119 |
| |
3102 | 3120 |
| |
| |||
3217 | 3235 |
| |
3218 | 3236 |
| |
3219 | 3237 |
| |
| 3238 | + | |
| 3239 | + | |
3220 | 3240 |
| |
3221 | 3241 |
| |
3222 | 3242 |
| |
| |||
3961 | 3981 |
| |
3962 | 3982 |
| |
3963 | 3983 |
| |
| 3984 | + | |
| 3985 | + | |
3964 | 3986 |
| |
3965 | 3987 |
| |
3966 | 3988 |
| |
| |||
3986 | 4008 |
| |
3987 | 4009 |
| |
3988 | 4010 |
| |
| 4011 | + | |
| 4012 | + | |
3989 | 4013 |
| |
3990 | 4014 |
| |
3991 | 4015 |
| |
| |||
4023 | 4047 |
| |
4024 | 4048 |
| |
4025 | 4049 |
| |
| 4050 | + | |
| 4051 | + | |
| 4052 | + | |
| 4053 | + | |
| 4054 | + | |
4026 | 4055 |
| |
4027 | 4056 |
| |
4028 | 4057 |
| |
|
0 commit comments
Comments
(0)