How to Integrate Budibase and Postgres Safely

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams pair budibase and postgres to build internal apps on top of live data. Budibase connects to your database role to read rows and run updates from web forms. This setup lets staff manage customer records, support tickets, and orders from one screen. Still, direct database links need strict role limits so one app cannot alter every table. How budibase and postgres share data and roles Budibase acts as a client that sends queries to your database over the network. You set up a database rol

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

Teams pair budibase and postgres to build internal apps on top of live data. Budibase connects to your database role to read rows and run updates from web forms.

This setup lets staff manage customer records, support tickets, and orders from one screen. Still, direct database links need strict role limits so one app cannot alter every table.

How budibase and postgres share data and roles

Budibase acts as a client that sends queries to your database over the network. You set up a database role and store those login details inside the app builder. Whenever a user opens a dashboard, Budibase runs a query using that stored role.

Postgres checks the permissions of that role before it returns any rows. By default, the special PUBLIC role gives every role connect and temporary rights on databases. It also gives execute rights on functions and procedures unless the owner revokes them.

For tighter control, admins create a dedicated role just for the app. In PostgreSQL 15 and later, normal users cannot create objects in the public schema by default. On older databases, admins must revoke create rights on the public schema from PUBLIC.

You can also limit what data the app reads down to the column level. In Postgres, the select privilege works on whole tables, views, or specific columns. Granting select on safe columns keeps secret fields out of the app builder.

Common failure modes and how to scope permissions

A common mistake is putting the main database owner login into the app builder. If a builder writes a bad query, that role can drop tables or wipe records. Shared admin logins also make it hard to see who ran a bad update.

Another risk comes from broad read access across customer tables. Internal apps often pull full tables that hold emails, phone numbers, or card numbers. Data masking rewrites matched fields in results so support screens show safe values.

End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

To fix role sprawl, teams set up group roles in the database. Admins grant specific table and column privileges to the group role first. Then they add the app login role as a member of that group.

Split your apps into read-only and read-write roles based on what each screen does. A reporting app only needs select rights on specific views or columns. An order tool needs update rights on the orders table, but nothing else.

Securing the network path and query logs

Database security also depends on how network traffic reaches your server. Never open your database port to the public internet just to reach a cloud app. Use private networks or strict firewall rules so only known app servers can connect.

Turn on TLS encryption so queries and results do not travel in plain text. You should also set statement timeouts on the database role used by the app. This stops a slow dashboard query from locking up production tables for everyone else.

Finally, review your database logs to track what queries the app sends. Since many staff members share one app, database logs only show the shared app role. Pairing app logs with database logs helps you trace actions back to a single person.

Run guardrails and masking on the Postgres connection

Role grants and firewall rules are needed setup. Setup alone cannot check single SQL statements or mask sensitive rows in a response. By design, hoop.dev is an open-source proxy that sits beside Postgres, RDS, or Aurora as a sidecar for your Postgres. Clients and agent tools keep their credentials and point their connection string at the listener.

On each query, hoop.dev guardrails refuse disallowed drops, deletes, or table reads before they run. Next, hoop.dev data masking rewrites sensitive fields in returned rows that match your rules. Furthermore, hoop.dev holds SOC 2 Type II and logs every statement and verdict per resource. Check out the project on GitHub.

Frequently asked questions

Should I use the default postgres superuser for my Budibase app?

No, never use a superuser role for an internal app. Create a dedicated role with rights only on the specific tables and columns the app needs.

How do I stop Budibase from reading sensitive columns in a table?

Postgres lets you grant the select privilege on specific columns instead of the whole table. You can also create a view with safe columns or use data masking on results.

Why can my new read-only role still run functions in Postgres?

By default, Postgres grants the special PUBLIC role execute rights on functions and procedures. The object owner must revoke those default rights from PUBLIC to block execution.

The query runs. The emails stay hidden.