How to Configure Haystack Supabase Prevent Delete

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up haystack supabase prevent delete rules by making a custom Postgres user. You give that user read and insert rights, but you withhold delete rights. Teams often build AI pipelines using the default database password created at project start. That password belongs to the default postgres role, which holds full admin rights. If a pipeline runs with that admin role, a bad prompt can wipe out tables. Creating a custom role stops destructive queries before they touch your stored vector data

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 haystack supabase prevent delete rules by making a custom Postgres user. You give that user read and insert rights, but you withhold delete rights. Teams often build AI pipelines using the default database password created at project start. That password belongs to the default postgres role, which holds full admin rights. If a pipeline runs with that admin role, a bad prompt can wipe out tables. Creating a custom role stops destructive queries before they touch your stored vector data.

How to set up haystack supabase prevent delete

Every new project starts with a default postgres role that holds admin rights. Supabase withholds true superuser status to block dangerous system tasks, yet the admin role can still delete rows. The vendor tells teams not to share this default password with external services. Instead, you should make a fresh database user for each external service.

To protect your data, you create a dedicated role for your AI app. You grant this new role permission to read tables and insert new vector rows. You leave out permission to remove rows or drop tables. When your pipeline connects, it logs in with this restricted role instead of the default admin role.

Projects also include built-in roles like anon, authenticated, service_role, and authenticator. If your pipeline writes through the API instead of a direct database connection, table policies apply. You can set up row level policies that allow reads and inserts while blocking deletes. Both methods stop the AI app from removing records during normal runs.

Why role setup is only the first step

Database roles decide who can log in and which broad table actions are allowed. That static setup works well when an app always needs the exact same rights. Real teams often need more flexible rules during daily work.

A pipeline might need to update existing embeddings without having broad rights to alter every row. Engineers also need to run manual fixes on vector tables during an outage. If you give a developer or service account update rights, a bad query can still overwrite good data. Static database roles cannot inspect the content of a query while it runs. They also do not mask sensitive fields like emails, phone numbers, card numbers, or national IDs in query results.

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

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Managing query risks across AI pipelines and engineers

When AI agents and developers share a database, static passwords create operational blind spots. Every service that shares a database role looks identical in the standard Postgres logs. Note that queries run in the project dashboard execute as the default postgres role and carry a dashboard source comment.

For external apps, teams have to track down which pipeline run or user sent a bad statement. Rotating passwords across multiple AI workers also takes time and can break active jobs. Teams need a way to check individual statements in flight and tie every query to a specific 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 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

Why should Haystack not use the default postgres password in Supabase?

The default password belongs to the postgres role, which has admin rights across the database. Supabase advises creating a separate user for every external service so an app cannot run destructive commands.

How do custom Postgres roles stop an AI pipeline from deleting rows?

You create a dedicated role for the pipeline and grant only select and insert rights on your vector tables. When the pipeline tries to run a delete statement, Postgres rejects the command right away.

What is the limit of using static database roles for AI safety?

Static roles only enforce broad table permissions at login time. They cannot inspect individual queries in flight, require human approval for risky updates, or rewrite emails and card numbers in query results.

The query runs. The emails stay hidden.