-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request fails if impersonated role doesn't have permission to set GUC from authenticator role #2896
Comments
@colophonemes Thanks for the report. Can you share the output (redacted) of the following query? select r.rolname, r.rolconfig
from pg_roles r ;
So I'm not able to reproduce the error when adding a ALTER ROLE postgrest_test_anonymous SET log_min_duration_statement to 1; I do get the error: curl localhost:3000/projects
{"code":"42501","details":null,"hint":null,"message":"permission denied to set parameter \"log_min_duration_statement\""} So you likely have the setting on members of We should still correct this. i.e. not add settings that require high privileges for authenticator members. |
Fortunately pg_settings has a postgres=> select context from pg_settings where name = 'log_min_duration_statement';
-[ RECORD 1 ]------
context | superuser We should apply only the ones that have a postgres=> select distinct(context) from pg_settings;
-[ RECORD 1 ]--------------
context | postmaster
-[ RECORD 2 ]--------------
context | superuser-backend
-[ RECORD 3 ]--------------
context | user
-[ RECORD 4 ]--------------
context | internal
-[ RECORD 5 ]--------------
context | backend
-[ RECORD 6 ]--------------
context | sighup
-[ RECORD 7 ]--------------
context | superuser |
Ah, unfortunately we've already removed that setting from the DB so I can't provide query output, however, you were absolutely right that it wasn't just the |
Environment
postgrest/postgrest:v11.1.0
Description of issue
If the authenticator role has a custom config applied to it (in our case
log_min_duration_statement = -1
), requests fail with the following permissions error:This seems to be a regression on v11 (specifically I think related to #2561), because we've had no issues running against the same database using v10.2.0.
It feels like what's happening is that PostgREST is switching to a less-privileged role (e.g. from
api_authenticator
->api_user
), and then trying to apply the superset of GUCs from both the authenticator and user roles. Then, if the user role doesn't have permission to apply the config change, it errors.The text was updated successfully, but these errors were encountered: