Openhands MySQL Safe

Published
Length
3 min read

Luis Felipe Dias

All posts

You make an openhands mysql safe setup by removing direct database passwords and adding query controls. The agent runs inside a container and sends database queries through a policy proxy. Software teams use coding agents to write code, fix bugs, and check data tables. Giving an automated agent direct database keys creates a major risk for your production systems. A small mistake in a prompt can cause the agent to drop a critical table. It might also read thousands of private user records into

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 make an openhands mysql safe setup by removing direct database passwords and adding query controls. The agent runs inside a container and sends database queries through a policy proxy.

Software teams use coding agents to write code, fix bugs, and check data tables. Giving an automated agent direct database keys creates a major risk for your production systems. A small mistake in a prompt can cause the agent to drop a critical table. It might also read thousands of private user records into its context window. Teams need strong controls between the agent container and the database server.

How an openhands mysql safe setup works in practice

The agent runs tasks inside an isolated workspace where it can run shell scripts. When the agent needs to check data, it opens a standard database client session. In a safe setup, the agent does not hold the real database user password. Instead, the agent talks to a local proxy service that checks every single request.

The proxy checks the identity of the user or agent before it opens a session. It injects the real database credentials on the fly so the agent cannot read them. Next, the proxy reads the SQL statement before sending it to the database server. If the agent tries to run a bad write query, the proxy blocks it.

When the database sends rows back, the proxy scans the payload for private data. Data masking rewrites matched fields like emails, phone numbers, card numbers, and national IDs in results. The agent gets the table layout and safe test rows it needs to finish work. Your private customer records stay out of the third-party model logs.

Security tradeoffs of static roles and active sessions

Many engineering teams try to protect databases by creating a read-only database user role. Static roles stop the agent from deleting rows or changing table schemas during a run. Still, static roles leave major security gaps open during an active database session.

First, you still have to put a static password inside the agent workspace. An agent can read its own local files and print that password in chat logs. Anyone who reads the shared task log can copy that key and use it later.

MySQL Access Governance + Quantum-Safe Cryptography: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Second, a read-only database role still lets the agent read every row in allowed tables by default. A single broad query can pull all customer card numbers and national IDs at once. Database roles control which tables a user can query, but they do not mask fields. They also cannot pause a single risky query to ask a human for approval.

Controlling agent queries without sharing database keys

To close these gaps, teams move database controls out of the agent container. You set up your agent workspace to route traffic through an external control layer. This layer links every agent query to a specific human engineer and ticket.

You can set rules that let the agent run safe read queries right away. If the agent needs to update a row or alter a table, the request pauses. A human reviewer gets a chat alert in Slack or Teams to check the query. Once the reviewer approves the request, the query runs and the agent finishes its task. Every query and result is saved in a central audit log for security checks.

Inspect every MySQL query and response in flight

Static grants and network rules block bad logins. They cannot pause a risky query for review or mask emails in a result set. By design, hoop.dev sits inline in the MySQL protocol as a sidecar for your MySQL. For every plain query, prepared statement, or cursor an agent or human runs in production, hoop.dev decides to pass, mask, block, or hold it for review.

First, hoop.dev guardrails block banned actions before MySQL runs them, and an AI Analyzer you configure can score intent or escalate for approval. Next, hoop.dev data masking rewrites sensitive string columns in results in memory, and every verdict goes to the audit trail. Find the open-source binary on GitHub.

Frequently asked questions

Can the coding agent still inspect table schemas without direct passwords?

Yes, the proxy lets the agent run schema read queries without holding the database password. The agent sees column names and data types so it can write accurate app code.

How does data masking affect the coding agent during bug fixes?

Data masking rewrites emails, phone numbers, and card numbers in query results before the agent reads them. The result formatting stays intact, so the agent can test code logic without real user data.

What happens if the agent tries to drop a production table?

Guardrail rules block destructive commands or pause them until a human approves the action. The agent receives a clear error message and adjusts its plan without harming your database.

The query runs. The emails stay hidden.