A newly hired contractor leaves the company, but the CI pipeline she helped build an AI coding agent that drafts SQL statements for performance‑tuned reporting. The agent pulls credentials from a shared configuration file and talks directly to the production Postgres cluster. When the contractor’s account is disabled, the agent continues to execute queries because it never authenticates as a person.
It also shows why access reviews must account for non‑human actors that inherit privileged credentials.
That pattern is becoming common. Teams embed large‑language‑model assistants in their development workflow: an IDE plugin suggests a query, a CI job asks the model to generate migration scripts, or an automated bot writes data‑access code. The model itself does not have a human identity, yet it inherits whatever permissions the underlying service account possesses. For anyone responsible for access reviews, the question is no longer "who can run psql?" but "what does an autonomous agent do with the rights it inherits?"
Why traditional access reviews miss AI‑driven activity
Conventional access reviews focus on static identities, users, service accounts, and groups. Reviewers look at role assignments, expiration dates, and the resources those roles cover. An AI coding agent sidesteps that model in two ways. First, the agent is not a distinct identity; it runs under an existing service account that may have broad database privileges. Second, the agent’s behavior changes at runtime: a single request can produce a complex series of DDL and DML commands that were never anticipated when the original role was granted.
The result is a blind spot. Even if you prune user accounts regularly, the underlying service account remains untouched, and the agent continues to act with the same level of access. Auditors who rely on static permission matrices will see a clean sheet, while the actual data‑plane activity tells a different story.
What to watch for in access reviews when AI agents touch Postgres
- Identify the execution context. Trace every CI job, bot, or IDE extension that can invoke the language model. Record the service account or credential it uses.
- Map generated queries to risk categories. Not all SELECTs are equal. Look for DML, DDL, or queries that reference sensitive columns such as SSN, credit‑card numbers, or PII.
- Enforce just‑in‑time (JIT) temporary write permission. Instead of granting permanent write access, require an explicit approval step each time the agent attempts a high‑risk operation.
- Capture a complete audit trail. Session‑level logs that include the exact query text, timestamps, and the originating request ID are essential for downstream review.
- Apply inline data masking. When the agent reads rows that contain regulated data, mask those fields before they reach downstream tools or logs.
These controls shift the focus from static role inventories to dynamic, request‑level enforcement. They also create evidence that satisfies auditors looking for “who did what, when, and why.”
