News for hackers. Stuff that matters.
Re:How We Turn Authorization Logic into SQL by scottwick on Wednesday November 24, 2021 @11:42AM (#29331899)
How does this work in terms of Postgres connections/pools? My understanding of this is that you'd do something like `SET SESSION user_id TO 123;` which sets the variable `user_id` for that connection. Subsequent queries could use that variable to do row-based authorization but they need to use the same connection. Is this how Postgrest does it? (guaranteeing the same connection for the lifecycle of a request that is)
Re:How We Turn Authorization Logic into SQL by SahAssar on Wednesday November 24, 2021 @11:52AM (#29332041)
IIRC postgrest starts a transaction for each request, and inside of that sets the variables. I've done some testing to make sure that variables do not leak between requests.

See the local option here for more options: https://www.postgresql.org/docs/current/functions-admin.html...

If using the role-mapping feature of postgrest it works similarly, only setting the ROLE instead of the variables.