How to Configure OpenHands MariaDB Audit Log

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up an openhands mariadb audit log by turning on the native server plugin. Then you give the AI agent its own database account to track every query. Teams often start by handing an agent a shared admin key for speed. When roles are too broad, one bad agent prompt can drop tables or leak records. How the openhands mariadb audit log workflow runs OpenHands runs as an autonomous coding agent that writes and executes commands inside a workspace. When the agent needs data, it opens a standa

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 an openhands mariadb audit log by turning on the native server plugin. Then you give the AI agent its own database account to track every query. Teams often start by handing an agent a shared admin key for speed. When roles are too broad, one bad agent prompt can drop tables or leak records.

How the openhands mariadb audit log workflow runs

OpenHands runs as an autonomous coding agent that writes and executes commands inside a workspace. When the agent needs data, it opens a standard database session using stored keys. MariaDB checks the account name and host before letting the agent log in.

Inside the database, the built-in audit plugin watches server events as they happen. Admins turn on the plugin and choose which event types to record. You can log login attempts, schema changes, and read or write queries. The server writes these events to a local file or sends them to syslog.

To make the log useful, you must create a separate database user for OpenHands. If the agent shares a login with human developers, the log mixes their actions together. A dedicated agent role lets you filter the audit trail by username. You can see every statement the AI ran and when it happened.

What native database logging solves and what it misses

The native audit plugin is great for forensics and compliance reports after an incident. It proves who logged in and records the exact text of completed queries. If an agent breaks a staging table, the log helps you find the bad query. It also alerts security teams when someone tries to log in with a bad password.

Still, a database log only records events after they hit the server. The native setup decides who logs in, not what individual statements do in flight. If an agent has write permissions, the audit plugin will not stop a destructive delete. It just writes down that the table is now gone.

Audit Log Integrity + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Native roles and audit files also cannot mask sensitive fields in query results. When OpenHands runs a broad select statement, the database returns raw emails and card numbers. Those values enter the agent workspace and get sent to external model providers. Plus, storing static database passwords inside the agent container creates a key theft risk. Teams need controls that inspect queries before execution and rewrite sensitive fields in results.

Best practices for scoping AI agent database roles

Start by giving the OpenHands database user the smallest set of permissions possible. Grant read access only to the specific tables the agent needs for its task. Never give the agent admin rights or permission to change user grants.

Next, filter your audit rules to focus on the agent user account. High traffic databases create huge log files when you record every single read query. Target the agent role so you catch all AI activity without filling up your disk. Send those logs to an outside collector so a rogue process cannot delete them.

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

Does the MariaDB audit plugin block dangerous AI agent queries?

No, the native audit plugin only records events for review. It does not inspect or block destructive SQL statements before the database runs them.

How do I tell OpenHands queries apart from human queries in the log?

Create a dedicated MariaDB user account just for the OpenHands agent. The audit log will stamp every agent query with that specific username.

Can native MariaDB logs hide sensitive data from the AI model?

No, native logs only record server activity to a file. They do not rewrite emails, phone numbers, or card numbers in the query results.

The query runs. The emails stay hidden.