How to Configure Neon Column Level Security

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up neon column level security by revoking table grants and giving role permissions on specific columns. You can also build views that leave out sensitive fields for standard users. Most teams start by sharing one broad database role across apps and engineers. When permissions are too wide, any query can read private fields like emails or card numbers. Tightening column rules limits which fields each database role can read or write. How native neon column level security works Neon runs

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.

You set up neon column level security by revoking table grants and giving role permissions on specific columns. You can also build views that leave out sensitive fields for standard users. Most teams start by sharing one broad database role across apps and engineers. When permissions are too wide, any query can read private fields like emails or card numbers. Tightening column rules limits which fields each database role can read or write.

How native neon column level security works

Neon runs on Postgres, so it uses standard Postgres role permissions to guard columns. First, an admin revokes default read and write grants on the target table. Next, the admin grants read permissions on safe columns to a restricted role. Sensitive columns like phone numbers or national IDs stay left out of that grant. When a user runs a query on a blocked column, Postgres rejects the whole query.

Teams also use database views as a second way to guard column data. An admin creates a view that selects only the safe columns from a base table. Then the admin grants the team role permission to read the view instead. This pattern lets analysts run broad select queries on the view without errors. Still, the team must now keep those extra views updated when schemas change.

How Neon branches affect column rules

Neon lets teams create instant database branches for testing and dev work. When you branch a database, Neon copies both the schema and the raw data. It also copies your Postgres roles and column grants into the new branch. That seems safe at first, but dev branches often give developers broad owner roles. A developer using a branch owner role bypasses the restricted column rules right away.

Teams try to fix this by running scripts to scrub test data after branching. Those scripts can break when someone adds a new table or column to production. If a script fails, raw emails and card numbers sit exposed in dev branches. Managing roles across dozens of temporary branches takes constant manual work from your team.

Column-Level Encryption + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

What native column grants solve and what they miss

Native column permissions work well for fixed app roles that run predictable queries. An app role only asks for the exact columns it needs to work. If a bug or bad query asks for a blocked column, Postgres stops it. This static barrier keeps basic service accounts from reading private fields they do not need.

The gap appears when real people or AI tools query the database directly. Native grants are all or nothing, and they decide permissions only at login time. They cannot inspect a query in flight or mask fields inside the result set. If a support engineer needs a table, a blocked column breaks standard select queries. To fix work blockers, admins often give out privileged roles during live incidents. Once a user logs in with that high role, native column rules stop helping. You also do not get a clear log tie back to an individual user identity.

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 sits inline in the Postgres protocol beside Postgres, RDS, or Aurora as a sidecar for your Postgres. On every production query from an engineer or AI agent, hoop.dev decides whether to pass, mask, block, or hold it for approval.

First, hoop.dev guardrails refuse disallowed drops or deletes before they run, and risky statements can pause for human review. Next, hoop.dev data masking rewrites sensitive fields in returned rows in memory. 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

Does Neon have a custom feature for column security?

No, Neon uses standard Postgres column grants and views to control field access. You set these rules inside the database using normal Postgres role permissions.

What happens when a user runs select star on a restricted table?

Postgres rejects the entire query and returns a permission error to the user. The user must write out only the allowed column names in the query.

Do column grants hide sensitive fields without breaking queries?

No, native grants block the query instead of rewriting the output in flight. To avoid query errors without changing grants, you need dynamic data masking in front.

The query runs. The emails stay hidden.