How to Configure OpenHands CockroachDB Credentials
You set up openhands cockroachdb credentials by making a dedicated database role. Then you pass those login details into the agent runtime container. Most teams start by giving the agent a shared dev account. This fast path causes problems when the agent runs broad queries. Overly wide permissions let an automated tool change tables or read private rows. How openhands cockroachdb credentials work in practice OpenHands runs tasks inside an isolated workspace container. When the agent needs dat
Ephemeral Credentials + End-to-End Encryption: the complete guide
Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.
You set up openhands cockroachdb credentials by making a dedicated database role. Then you pass those login details into the agent runtime container. Most teams start by giving the agent a shared dev account. This fast path causes problems when the agent runs broad queries. Overly wide permissions let an automated tool change tables or read private rows.
How openhands cockroachdb credentials work in practice
OpenHands runs tasks inside an isolated workspace container. When the agent needs database state, it reads local variables to log in. CockroachDB checks the user name, password, or client certificate before starting a session. Once inside, the database checks the assigned role for that specific account.
A good setup starts inside the database cluster itself. You create a new SQL role built just for the coding agent. You grant read permissions on the specific tables the agent must check. If the agent tests schema changes, you scope write rules to one test database. You never assign admin rights to an automated workspace.
Next, you pass the login details into the OpenHands runtime workspace. Teams store these secrets in their host secret manager before the container starts. The workspace reads the host variables and opens a standard Postgres wire session. CockroachDB uses the same protocol, so standard client drivers work right away.
Choosing between passwords and client certificates
CockroachDB supports both password logins and mutual TLS client certificates. Many teams use passwords for local agent runs because they are easy to set up. Still, static passwords sit in memory and can leak in agent debug logs. If an agent prints its workspace variables, that password ends up in plain text.
Client certificates offer a stronger way to check identity during login. You generate a key pair for the agent role and mount the files. The database checks the cryptographic signature against its root authority on every session. Even so, the agent still holds the private key inside its container filesystem. Any command running in that sandbox can read the key file and use it.
Where native database roles fall short for AI agents
Native roles and grants solve the first step of database security. They control who can log in and which tables that account can touch. This model works well for standard apps that run fixed, predictable code paths. An app backend only sends the exact queries that engineers wrote and reviewed.
Ephemeral Credentials + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
AI coding agents work in a very different way during a session. OpenHands writes and runs new SQL statements on the fly to fix bugs. A role with table read rights can still pull every row at once by default. Native grants cannot tell a safe lookup from a full table dump.
Database roles also operate on an all or nothing basis for columns. If the agent needs a user table, it gets the whole table. Native grants do not rewrite sensitive fields like emails or phone numbers in results. If a table holds card numbers or national IDs, the agent gets raw values.
Finally, shared roles make it hard to track who triggered a bad query. The database audit log only shows the generic agent role name. It does not link the SQL statement back to the engineer who prompted the task. When an agent drops a test table, teams waste hours hunting down the source.
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
Can OpenHands use standard Postgres drivers for CockroachDB?
Yes, CockroachDB speaks the standard Postgres wire protocol out of the box. The agent can use standard Postgres client tools and libraries to run queries.
Should I give my coding agent schema change permissions?
Only grant schema change rights in an isolated dev or scratch database. Never let an automated agent alter tables inside a shared staging or production cluster.
How do I stop the agent from reading private user data?
Start by revoking select rights on tables that store private customer records. For shared tables, use data masking to rewrite emails and phone numbers in query results.
Related guides
In this post