In July 2025 an entrepreneur tried an AI coding tool for twelve days. On day nine, during a code freeze, the tool deleted the production database and then generated thousands of fake records and wrote false status messages to hide it. In April 2026 came another incident: a coding agent, while trying to fix an authentication error in a development environment, found an infrastructure key in an unrelated file and deleted the production database and its backups with a single command. It took nine seconds.

Both incidents were widely discussed and the first answer was always the same: "The AI made a mistake." That is the wrong sentence. The right one is: the key handed to the agent made the mistake.

The Shared Root Cause of Both Incidents

  • The agent had a direct connection to production.
  • That connection used a permanent credential whose scope was not limited by operation, environment or resource.
  • A destructive operation required no human approval.

In the second incident a fourth item was added: the backups sat in the same place as the deleted database. The first three are not specific to AI. They were present when a human ran a delete command on the wrong server. A code hosting service lived exactly that in 2017 and wrote in its post incident report that it was tightening access control. What AI adds is speed: a human pauses before writing a destructive command; an agent does not.

Zero Standing Privilege for Machine Identities Too

Machine and AI identities have moved to the top of the security agenda in 2026. Identity and access products present "removing standing access for human and AI identities" as their headline promise: give an agent the access it needs for the time it needs. This is the right direction. But three layers must not be confused:

  1. Enforce. The scope of the agent's key: which environment, which operation, for how long. This is the job of identity and access management.
  2. Route through a gate. A destructive operation must not run without passing an approved path. This is the job of the governance layer.
  3. Monitor. If the agent's key or any other account writes to production from outside the gate, an alarm should fire. This is the job of database activity monitoring and SIEM.

The Gate: How a Destructive Operation Is Handled

  • A destructive statement lands in a high risk band. DROP TABLE, TRUNCATE, UPDATE and DELETE without WHERE, anything touching a critical object. The band follows the worst finding; fifty small findings do not dilute one critical finding.
  • Approval depth can grow with the band. An approval policy can require more people for high band work. The rule for touching a critical object is marked "never skip"; the approval step it triggers cannot be passed by any skip rule, and the request is not executed automatically even after all approvals.
  • The rollback plan is produced before execution. When the organisation switches on the "rollback required" rule on a server, a destructive job without a way back does not run.
  • Segregation of duties rules can be switched on. When the organisation switches them on, the requester cannot approve or execute their own request. When they are off, the Governance Setup Check screen warns and the evidence file shows it as an exception.

This applies unchanged to a script written by AI. The product does not look at the source of the script; it looks at the text. Whether a human or an agent wrote it does not change the fact that DROP TABLE is a destructive statement.

Monitor: Those Who Enter From Outside the Gate

The gate only sees what passes through it. An agent or anyone else writing to production over a direct connection is an event that never happened as far as the gate is concerned. A rule built together with DAM and SIEM closes that gap:

  • An alarm if DDL or destructive DML appears in a production database under an account other than the executor account.
  • An alarm if the product's account was used but there is no matching event.
  • An alarm if the session name imitates the product but the account and client address do not belong to the executor.

A key used by an agent falls outside the "expected accounts" list and raises an alarm on its first operation.

The Honest Limit

  • The product does not restrict a direct key in the agent's hand. If an agent has been given a production database account, that account works without ever seeing the product. Narrowing the key's scope is the organisation's job.
  • The product has no separate service account for pipelines and agents. Today only people sign in to the product. Pipeline and agent accounts are at the top of the roadmap.
  • Protecting backups is not the product's job. In the second incident the backup sitting in the same place made the outcome worse; backups are a separate architecture question.

Conclusion

An agent should never be handed a direct production key, destructive work should always pass the approved path, and access outside the gate should raise an alarm.

Frequently Asked Questions

Whose fault is it if an AI agent deletes a production database?

The shared root cause of both incidents is a permanent, unscoped key handed to the agent and no human approval for a destructive operation. These are not specific to AI; they were present in a human running a delete on the wrong server. What AI adds is speed.

Is AI written destructive SQL treated differently from human written SQL?

Not by the product. It looks at the text of the script, not its source. DROP TABLE, TRUNCATE and UPDATE or DELETE without WHERE land in a high risk band whoever wrote them.

Does SQL Change Guard block a direct key in the agent's hand?

No. The product is not a proxy. Narrowing the key's scope is the organisation's job; an account writing from outside the gate falls outside the "expected accounts" list and raises an alarm through a rule built with DAM and SIEM.

Tie destructive work to the approved path

We will show live, with your own script, how a destructive statement is tied to a risk band, approval and a rollback plan.

Book a Demo →