News for hackers. Stuff that matters.
Re:Hands-On with PostgreSQL Authorization – Part 2 – Row-Lev... by sekun on Wednesday March 16, 2022 @10:03PM (#30706738)
You can create a role whose sole job is to switch to the roles needed. Doesn’t require you to escalate to superuser-level privileges that way. But still, if SQL injections aren’t properly considered then it’s possible for a user to gain more privileges than planned. Although SQL injections are usually mitigated by the DB libraries these days.

Also, it’s more convenient to use SET LOCAL ROLE <ROLE_NAME>, since that only keeps the role for the transaction. Manually resetting it is error prone (IME), and forgetting will have the supposedly “temporary” role bleed to the next transaction.

There are no comments on this comment yet.