When a nightly build runs an AI‑generated migration script against a production MySQL instance, the process uses a non-human identity that relies on a static username and password stored in the CI pipeline. The credential is shared across dozens of jobs, and no one can tell which migration actually touched which table.
This pattern is common in organizations that treat AI coding agents like any other service account. The agents get a static database user, the secret lives in a vault or CI secret store, and the connection goes straight to MySQL. The result is credential sprawl, invisible activity, and no way to enforce data‑privacy rules on the responses that the AI receives.
Why non-human identity alone is not enough
Introducing a dedicated service account for each AI agent – the essence of non-human identity – solves the secret‑sharing problem. Each agent now has its own OIDC or SAML token, and the identity provider can enforce least‑privilege scopes. However, the connection still terminates directly at the database. The gateway that would inspect queries, mask sensitive columns, or require an approval before a destructive command runs is missing. Without a data‑path enforcement point, you cannot record the session, replay it for audit, or apply inline masking to protect PII that the AI might inadvertently read.
hoop.dev as the data‑path gateway for MySQL
hoop.dev provides the missing layer. It is a Layer 7 gateway that proxies the MySQL wire protocol. The architecture places hoop.dev between the AI agent and the database, so every packet traverses the gateway before reaching MySQL. The gateway holds the actual database credentials; the agent never sees them. Authentication to hoop.dev is performed with the agent’s non-human identity token, which hoop.dev validates against the configured OIDC or SAML provider.
Because hoop.dev sits in the data path, it can enforce all runtime guardrails:
- Just‑in‑time access. hoop.dev checks the token, evaluates the policy for the requested database, and grants a short‑lived connection only for the duration of the AI job.
- Approval workflows. If a query matches a risky pattern – for example, a DROP DATABASE command – hoop.dev can pause the request and route it to a human approver before forwarding it to MySQL.
- Inline data masking. Responses that contain regulated fields are rewritten on the fly, ensuring the AI never receives raw PII.
- Session recording and replay. hoop.dev captures the full query‑response stream, creating a record that can be reviewed later.
Each of those enforcement outcomes is possible only because hoop.dev is the gateway that all traffic must pass through. The setup that creates the non-human identity – the service account, the OIDC client, the role bindings – decides who is making the request, but it does not enforce policy. The gateway is the sole place where policy can be applied, and hoop.dev is the component that does it.
Architectural steps to protect AI agents on MySQL
1. Deploy the hoop.dev gateway. Use the official Docker Compose quick‑start or the Kubernetes manifest to run the gateway inside the same network as the MySQL server. The deployment includes an agent that resides near the database and a control plane that manages policies.
