Openhands Delete SQL Server
You can stop an openhands delete sql server action by limiting database user permissions. You can also block destructive queries at the network layer before they run. AI coding agents help teams build software fast. Sometimes an agent tries to clean up test data or reset a schema. When an agent runs with broad database rights, a simple mistake can wipe out production tables. Teams need clear boundaries to keep their data safe. How an openhands delete sql server action works in practice AI ag
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 can stop an openhands delete sql server action by limiting database user permissions. You can also block destructive queries at the network layer before they run.
AI coding agents help teams build software fast. Sometimes an agent tries to clean up test data or reset a schema. When an agent runs with broad database rights, a simple mistake can wipe out production tables. Teams need clear boundaries to keep their data safe.
How an openhands delete sql server action works in practice
AI agents connect to databases just like human engineers do. They use a connection string that holds a login and a password. Once inside, the database checks the database user tied to that login.
In Microsoft SQL Server, a database user is the identity of a login for that database. For access to many databases on an instance, a user with a master login is common. For one or a few databases, admins can enable and use a contained database user instead. Microsoft supports thirteen types of database users in total.
What the agent can do depends on its fixed database roles. If the agent belongs to the data writer role, it can add, change, or delete data in all user tables. If the agent belongs to the owner role, it can do all maintenance and even drop the database.
An agent does not know if a table holds live customer records or fake test rows. It just reads the prompt, writes a delete statement, and sends it over the wire. If the database role allows writes, the server runs the command right away.
Security and operational tradeoffs of static roles
You can restrict an agent by changing its fixed database role. Members of the data reader role can read all data from all user tables and views. You can also assign the deny data writer role. That role stops the user from adding, changing, or deleting any data.
Kubernetes API Server Access + SQL Query Filtering: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Fixed database roles have strict limits that you cannot change. A role applies to all user tables in the database at once. If an agent needs to delete rows in one scratch table, the data writer role gives it delete rights everywhere. You have to build custom permissions if you want finer control.
Static passwords also create risk during an active session. When you put a database password in an agent workspace, the agent can read that secret. Even a read-only agent can query full tables and pull sensitive fields into its context window. Static database roles cannot rewrite emails, phone numbers, card numbers, or national IDs in query results.
Adding query guardrails and data masking for AI agents
A safer approach places a control layer between the agent and the database. Instead of giving the agent a raw database password, the agent connects through an access layer. This setup lets you check every query before the database sees it.
When the agent sends a delete command, the policy engine inspects the statement first. You can block drop or delete statements in real time, or pause them for human approval. You can also apply data masking on the way back. Masking rewrites matched fields like emails and card numbers in results, while keeping the query working.
Govern SQL Server queries and responses in flight
Table grants decide which SQL Server objects a caller may touch. They do not check query intent or rewrite sensitive values in results across every client and agent. By design, hoop.dev sits inline in the TDS wire protocol next to SQL Server as a sidecar for your SQL Server. On every production batch from an engineer or AI agent, hoop.dev decides to pass, mask, block, or hold it for approval.
With hoop.dev guardrails and hoop.dev data masking, banned statements are refused or held for review, matched sensitive fields in supported result columns are masked in memory, and each decision is logged. Check out the code on GitHub.
Frequently asked questions
Can a fixed database role stop an agent from deleting data?
Yes, you can assign the deny data writer role to the database user. Members of this role cannot add, change, or delete data in any user table.
What happens if an AI agent has the database owner role?
Members of the owner role can run all maintenance and setup tasks. They can also drop the entire database in SQL Server, so agents should not use this role.
Does a read-only role hide sensitive fields from an AI agent?
No, the data reader role lets the user read all data from all user tables and views. To hide fields like phone numbers or national IDs, you need data masking to rewrite results.
Related guides
In this post