How to Configure Codex MariaDB Prevent Delete
To set up a codex mariadb prevent delete rule, assign a restricted database user. You grant this role read and write rights while leaving out the delete permission. Teams often start by giving AI coding agents full database logins for local tests. That broad role becomes a major risk when an agent connects to shared tables. One bad prompt can wipe out thousands of rows in a single second. How to set up codex mariadb prevent delete AI coding agents run database queries through local shell tool
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.
To set up a codex mariadb prevent delete rule, assign a restricted database user. You grant this role read and write rights while leaving out the delete permission. Teams often start by giving AI coding agents full database logins for local tests. That broad role becomes a major risk when an agent connects to shared tables. One bad prompt can wipe out thousands of rows in a single second.
How to set up codex mariadb prevent delete
AI coding agents run database queries through local shell tools or external tool servers. The agent takes your natural language prompt and writes a database query to run. It then uses the login credentials stored on the developer machine or cloud workspace. If those credentials belong to an admin account, the database accepts every command.
You block row removal at the database level by making a dedicated agent role. A database admin creates a fresh user account just for the AI assistant. Next, the admin grants privileges to select, insert, and update data on target tables. The admin leaves the delete privilege off the account permissions list.
You also must block schema changes that wipe data in other ways. Dropping a table or truncating it removes rows without using a delete query. The restricted role must exclude drop and alter rights across the entire database. Once the role is ready, the developer puts these new credentials into the workspace. When the agent tries to remove rows, the database rejects the statement right away.
What native roles solve and what they miss
Native database roles are great for setting a basic floor of safety. They check who logs in and block whole classes of commands at the door. If an agent tries to run a delete statement, the database stops it cold. This setup works well when the agent only needs to read or add rows.
Still, static database privileges leave a big gap during daily work. A role checks who starts the session, not what individual statements do in flight. For example, an agent with update rights can still overwrite every row with blank values. That bad update destroys data just as fast as a delete statement.
Native roles also force you to hand out static passwords to developer machines. Every person or cloud workspace needs a copy of the database login string. Sharing keys makes it hard to track which person ran a specific agent query. Everyone shows up in the database logs under the exact same role name.
End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Static roles also lack a way to ask a human for help mid-session. Sometimes a developer wants the agent to clean up three test rows. With a locked role, the developer must switch accounts and run the query by hand. There is no native way to pause one risky statement for a quick approval. Plus, database privileges do not mask sensitive fields in query results. If a table holds emails, phone numbers, card numbers, or national IDs, the query returns them all.
Why query-level checks matter for AI agents
Coding agents act fast and run many queries in a short loop. When a command fails or returns bad data, the agent tries a new path. Without statement checks, an agent might test wild workarounds to finish its task. Checking each query before it runs stops bad updates and broad scans early.
Teams also need clear audit logs tied to real people, not shared service roles. Knowing which developer prompted the agent helps teams fix broken data fast. Adding data masking also rewrites matched fields like card numbers in the query results. This keeps private user info out of the model context window during debugging.
Check MySQL queries and results on the wire
MySQL grants control who logs in. They do not check single queries or mask sensitive columns once a session starts. With hoop.dev, you run an open-source proxy, a sidecar for your MySQL, inline in the MySQL wire protocol. On every query an AI agent or human runs against production MySQL, RDS, or Aurora, hoop.dev decides to pass, mask, block, or hold it for review.
Multi-statement batches and prepared queries are split and checked one by one by hoop.dev guardrails, which refuse banned queries with a native MySQL error or hold risky ones for approval. On the response path, hoop.dev data masking rewrites string values in returned rows in memory, and every decision is logged. See the MIT-licensed project on GitHub.
Frequently asked questions
Can an AI agent still wipe data if delete is off?
Yes, an agent can use update statements to overwrite live columns with null values. It can also run truncate or drop commands if those permissions remain active. You must remove drop, truncate, and broad update rights to keep tables safe.
How does the coding agent reach the MariaDB database?
The agent runs database queries through local shell commands or external tool servers. It reads the database login details stored in your local workspace settings. Then it sends SQL statements straight to the database host over the network.
Does revoking delete hide private data from the AI model?
No, removing delete permissions only stops the agent from removing rows. Any select query will still return full rows to the agent context window. You need data masking to rewrite emails, phone numbers, card numbers, and national IDs in results.
Related guides
In this post