Home / Companies / Supabase / Blog / Post Details
Content Deep Dive

Protecting reserved roles with PostgreSQL Hooks

Blog post from Supabase

Post Details
Company
Date Published
Author
Steve Chavez
Word Count
2,098
Company Posts That Month
24
Language
English
Hacker News Points
1
Post removed?
No
Summary

PostgreSQL manages permissions through roles, and to create these roles a database user needs the CREATEROLE privilege. However, granting this privilege can lead to potential security risks as it allows role modification or dropping of important roles. To address this issue, Supabase uses dedicated roles for each customer's backend services and employs PostgreSQL Hooks in their SupaUtils extension to protect these reserved roles. The SupaUtils extension sets up a hook that intercepts SQL statements like ALTER ROLE and DROP ROLE, checks if the role being altered or dropped is a reserved one, and aborts the operation if it is. This way, customers can manage roles as they do in on-premises databases while ensuring the protection of important roles.

Trends Found in this Post

No tracked trend matches for this post yet.

Use This Data

Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.