![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
doh! So much for that idea. There's no real way to have some useconfig variables run by the super user and some run by the session user. My workaround is to have the program call a SECURITY DEFINER function, but I'd be nice to be able to remove that hack. |
#3
| |||
| |||
|
|
doh! So much for that idea. There's no real way to have some useconfig variables run by the super user and some run by the session user. My workaround is to have the program call a SECURITY DEFINER function, but I'd be nice to be able to remove that hack. Yeah, the whole concept of USERLIMIT GUC variables is fairly dubious, because of the fact that we have to be able to set these values at times when we don't necessarily know whether the user is a superuser or not. [snip] It strikes me that a more useful definition would be to say that you must be superuser, period, to install an ALTER USER/DATABASE value for any USERLIMIT variable; and then we could treat these values as privileged for USERLIMIT purposes. This would lose the ability for non-superusers to set allowable values for themselves this way, but I think the case we'd gain is more useful. Comments? |
#4
| |||
| |||
|
|
It strikes me that a more useful definition would be to say that you must be superuser, period, to install an ALTER USER/DATABASE value for any USERLIMIT variable; and then we could treat these values as privileged for USERLIMIT purposes. This would lose the ability for non-superusers to set allowable values for themselves this way, but I think the case we'd gain is more useful. Oh! Please! I thought about suggesting that but didn't think it'd pass your litmus test and figured a pg_shadow.useconfig and an pg_shadow.admconfig would be received better, but, absolutely! The reason I hesitated to suggest such a change was SET search_path = foo;, which a user should be able to set on their own. |
#5
| |||
| |||
|
|
Without USERLIMIT, we could easily change the rules to make ALTER USER work the way you want: we'd say you have to be superuser to issue ALTER USER or ALTER DATABASE with a SUSET variable (already true), and then the value can be adopted at session start in all cases since we can then treat pg_shadow and pg_database as secure sources. |
#6
| |||
| |||
|
|
=20 Bruce and I were chatting about this on the phone today, and we were seriously considering a more radical proposal: get rid of the whole concept of USERLIMIT variables, and make the logging variables be plain SUSET (ie, only superusers can change 'em). This would eliminate the current ability of a non-superuser to increase the logging verbosity of his session, but it's not real clear that that's such a good idea anyway. (Cranking the log verbosity up far past what the DBA wants could be seen as a primitive form of DOS attack; and anyway, if you are not a superuser then you can't see what's in the log, so why should you care what the verbosity is, much less be able to affect it?) Given the code complexity of the USERLIMIT stuff and the number of bugs already found in it, getting rid of it seems awfully attractive. |
#7
| |||
| |||
|
|
The current functionality could be useful inside particular code paths of an application, where you want to increase the log verbosity in a particular part of the code, when it (unpredictably) happens, without nuking the logs entirely. Of course you are superuser when you review such logs, but I wouldn't usually want the db connection from the application to have to run as superuser if I could help it... especially not a web application. |
#8
| |||
| |||
|
|
Andrew McMillan <andrew (AT) catalyst (DOT) net.nz> writes: The current functionality could be useful inside particular code paths of an application, where you want to increase the log verbosity in a particular part of the code, when it (unpredictably) happens, without nuking the logs entirely. Of course you are superuser when you review such logs, but I wouldn't usually want the db connection from the application to have to run as superuser if I could help it... especially not a web application. Sure. There is a workaround for that though, which is to provide a SECURITY DEFINER function for the app to call that will adjust the logging level for it, rather than trying to do the SET directly in unprivileged code. |
#9
| |||
| |||
|
|
Tom Lane wrote: Sure. There is a workaround for that though, which is to provide a SECURITY DEFINER function for the app to call that will adjust the logging level for it, rather than trying to do the SET directly in unprivileged code. But if they go that way can it done securely, turned on and off? |
#10
| |||
| |||
|
|
Tom Lane wrote: Why not? You can put whatever restrictions you like in such a function. I assume to do this in a function you would have to create a temp table to store the original setting? |
![]() |
| Thread Tools | |
| Display Modes | |
| |