How to Configure OpenHands MariaDB Data Masking

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up openhands mariadb data masking by creating restricted views or database filter rules. Next, you give the coding agent a read role limited to those objects. Many engineering teams start by handing an agent a shared database key. That broad role lets the agent read every table and copy raw customer records. Scoping the database account and rewriting sensitive columns fixes that exposure. How openhands mariadb data masking works OpenHands runs in a sandbox container and executes shell

Data Masking (Static) + End-to-End Encryption: the complete guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free white paper. No spam. Unsubscribe anytime.

You set up openhands mariadb data masking by creating restricted views or database filter rules. Next, you give the coding agent a read role limited to those objects. Many engineering teams start by handing an agent a shared database key. That broad role lets the agent read every table and copy raw customer records. Scoping the database account and rewriting sensitive columns fixes that exposure.

How openhands mariadb data masking works

OpenHands runs in a sandbox container and executes shell tasks or database scripts. It uses local settings or secret files to log in to MariaDB. When the agent runs a query, MariaDB checks the assigned database role. If the role only has rights to specific views, the agent reads those views. Inside those views, built-in string functions replace part of each sensitive column.

Teams also use native MariaDB masking plugins or filter rules at the database tier. These rules spot columns holding emails, phone numbers, card numbers, or national IDs. Before the database sends rows back, the rule rewrites matched fields in results. A phone number or card number comes back with stars or random digits. The agent still sees the table shape and column types to test its code.

To put this in place, an admin creates a dedicated database user for OpenHands. The admin removes read permissions on the base tables holding private customer records. Next, the admin grants read permissions only on the masked views. Finally, the team puts the new user key into the agent sandbox settings. Every query from that workspace now passes through the database view rules.

What native database rules solve and what they miss

Native MariaDB views and roles control which accounts can log in and read tables. They help teams keep static test scripts from pulling raw card numbers or emails. Still, database views take constant work to maintain across dozens of changing tables. Every time a developer adds a column, an admin must update the view. If someone forgets a column, the agent gets raw values in its prompt context.

Data Masking (Static) + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Native roles also only check who logs in at the start of a session. They do not inspect what individual statements or commands do in flight. An agent with write access to a test schema can run a bad delete query. Also, putting long-lived database keys inside an agent workspace creates a credential risk. If an agent logs its own shell history, that database password can leak out.

Managing agent database sessions safely

Teams need a simple way to inspect queries and mask results on the fly. When rules apply to query results in flight, admins skip building custom database views. Pattern rules can scan every returned row for emails, phone numbers, or national IDs. They rewrite matched fields in results before the coding agent processes the output. This approach keeps sensitive values out of model prompts while keeping schemas intact.

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 is an open-source proxy that runs as a sidecar for your MySQL. It reads plain queries, prepared statements, and cursors on the wire.

First, hoop.dev guardrails block banned actions before MySQL runs them. An AI Analyzer you configure can score intent, and hoop.dev data masking rewrites sensitive string columns in results. Every query and verdict goes to the resource audit trail. Find the open-source binary on GitHub.

Frequently asked questions

What fields should we mask when OpenHands queries MariaDB?

Focus on fields holding emails, phone numbers, card numbers, and national IDs. Masking rewrites matched fields in results so the agent works with safe sample shapes.

Do we need to rewrite our app schema for MariaDB views?

Yes, if you rely only on database views, you must maintain parallel view objects. Your team must update those views whenever someone alters a base table.

Why avoid giving OpenHands a shared developer database account?

Shared accounts usually hold broad read and write rights across many database schemas. A dedicated role limits what the agent can change and simplifies audit logs.

Save the open-source gateway.

hoop is MIT-licensed infrastructure for controlling how AI agents reach production data. Star hoophq/hoop so you can inspect it, deploy it, or share it when your team starts governing agent access.