How to Configure OpenHands CockroachDB Guardrails
You set up openhands cockroachdb guardrails by pairing agent sandboxes with strict database roles. You also turn on statement limits to stop bad queries before they break data. Many teams give autonomous coding agents broad database keys to move fast during tests. That shortcut creates huge risk when an agent runs a bad script in production. An agent with full write rights can drop tables or read private user records. How openhands cockroachdb guardrails work in practice OpenHands runs tasks
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 openhands cockroachdb guardrails by pairing agent sandboxes with strict database roles. You also turn on statement limits to stop bad queries before they break data. Many teams give autonomous coding agents broad database keys to move fast during tests. That shortcut creates huge risk when an agent runs a bad script in production. An agent with full write rights can drop tables or read private user records.
How openhands cockroachdb guardrails work in practice
OpenHands runs tasks inside an isolated container that executes shell commands and writes code. When the agent needs database state, it uses a client driver to log in. CockroachDB checks the user role and grants permissions at the cluster or table level. You should create a dedicated database role just for the coding agent to use. This role should only have read rights on the tables needed for the task.
Beyond role checks, CockroachDB offers cluster settings that act as safety nets for queries. Admins can set timeouts so slow agent queries do not lock up active nodes. You can also turn on safe update rules in the database session settings. Safe update rules stop the database from running deletes or updates without filters. Together, container boundaries and database roles form the base of your native safety setup.
Where native database roles fall short for agents
Native database roles decide who can log in and which tables they can touch. They do not inspect what each SQL statement actually does while it runs. If an agent needs write rights to fix a bug, table roles allow everything. The agent can still update the wrong rows or alter a schema by mistake. Static roles cannot tell a safe one-row fix from a risky bulk table change.
Static roles also struggle when sensitive customer data lives inside shared app tables. If an agent queries a user table, the database returns every column allowed by default. Raw emails, phone numbers, card numbers, and national IDs flow into the agent context. You must build custom views for every table to rewrite matched fields in results. Maintaining hundreds of custom views slows down engineering teams and breaks when schemas change.
AI Guardrails + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Adding query checks and data masking for agent tasks
Safe agent workflows need controls that look at every single query in flight. Teams should separate schema change rights from normal data read and write tasks. When an agent tries to run a risky command, the system should pause it. A human reviewer can then check the query and approve it from chat. This step keeps the agent productive while stopping bad deletes before they hit storage.
Teams also need dynamic data masking that works without changing the underlying database schema. Instead of building custom views, rules can rewrite matched fields in results on the fly. Emails and card numbers get masked before the output reaches the agent container. You also get a clear log of every command the agent tried to run. Security teams can audit these logs to see which user task triggered each query.
Check database and API queries on the wire
Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.
Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.
Frequently asked questions
Why should coding agents use separate CockroachDB roles?
Separate roles let you limit table rights and track agent queries in your logs. If an agent loops or writes bad SQL, you can revoke its role fast.
Can CockroachDB block full table deletes from an agent?
Yes, CockroachDB has safe update settings that reject delete statements missing a filter clause. Still, an agent can still bypass this if it writes a broad filter condition.
How do you protect private data when agents query production tables?
You apply dynamic masking rules that rewrite emails, phone numbers, and card numbers in results. This lets the agent debug real schema layouts while keeping private customer fields hidden.
Related guides
In this post