AI-ready data

Query-Time Permission Enforcement for AI Agents

Correspondent · · 12 min read
AI Data Governance · August 7, 2026 · 12 min read · 2,715 words

Two legacy models exist, and they fail for different reasons. Install-time permissions assume you can know what a system needs before it runs. Agents don't work that way. They figure out what they need at runtime, from live inputs, and that requirement set shifts with every query. You can't pre-define the permission model because the behavior itself is unpredictable.

Runtime permissions, the model smartphone platforms converged on, ask users to approve individual resource access as it arises. That works when a handful of decisions surface in a session. Agents require dozens of data accesses to answer a single question. Apply the old runtime model to that volume and what you get is permission fatigue: a cascade of approval prompts that trains users to click through without reading. The approval persists as ceremony, not control. Nobody's actually deciding anything.

Speed makes everything worse. An agent issues queries at a rate that makes any over-permissioning exploitable far faster than a human analyst ever could, and far faster than any audit process can detect. By the time a weekly log review surfaces anomalous access, the agent has already run thousands of queries. At machine speed, the exposure window doesn't stretch across hours; it collapses into something closer to instantaneous.

The deepest issue is emergence. Behavior arises at runtime from inputs the system designer never anticipated. A permission architecture designed for predictable, human-paced workflows is essentially decorative once agents are in the loop — like a lock painted onto a door. It looks coherent on a diagram. It provides no real constraint in practice.

The scale of stalled AI initiatives that governance gaps are causing

The organizational damage is measurable, and it is getting worse. According to a 2024 survey by S&P Global Market Intelligence, a large majority of enterprises have delayed, scaled back, or abandoned at least one AI initiative in the past year, and the average organization has done this multiple times. The share of companies abandoning most of their AI initiatives roughly doubled in a single year. The trend is moving in the wrong direction as deployments scale, and it is not self-correcting.

Gartner research found that nearly all organizations encounter permission and governance issues during the AI lifecycle, with most hitting them before production. Governance is already the gatekeeping bottleneck. This is a frontline concern, not something you address after launch.

Look at where engineering hours actually go inside these initiatives. Industry analyses, including reporting by McKinsey & Company, consistently find that a dominant share goes to data repair and governance workarounds rather than feature development. That ratio explains why AI teams feel perpetually behind. The capability work gets crowded out by remediation, and no amount of headcount resolves it, because the drain is structural. You can't hire your way out of an architecture problem.

A large majority of data leaders acknowledge that governance has not kept pace with AI, according to surveys conducted by TDWI and Dataversity. These are the people responsible for closing the gap, and they are self-reporting the lag. Most organizations still rely on public AI tools without governed enterprise deployments. The infrastructure gap is present and real, not theoretical.

The root cause is architectural. Legacy consent and preference platforms captured policy at collection time and never enforced it downstream where data is actually consumed. That was a manageable gap when humans were the consumers. Agents make it unworkable.

What "authorization gap" means and where it actually opens up

OAuth was designed for a clean bilateral contract: one user, one application, one permission set. An agent operating inside a shared output context breaks that contract by definition.

The authorization gap is the space between what OAuth actually confirms — which is that the agent is allowed to connect — and what actually needs to be verified: whether every person who will see the output is entitled to see that specific data. OAuth's job ends before that second check. Nothing in the original protocol design contemplates it. The protocol was never asked to think about the eleven people reading the downstream output. Think of it this way: OAuth checks whether you're allowed in the building, not whether every person in the conference room you just walked into was cleared for the same meeting.

Real incidents have followed this exact pattern. Authorized retrieval, unauthorized recipients. In each case, the fix required computing the intersection of all recipients' permissions before data left the retrieval layer. OAuth cannot do that. Something else has to, and in most current deployments, nothing does.

When row-level security is bypassed by a privileged agent, every downstream query in the workflow becomes a potential exfiltration path. Agents compound this by chaining tools and pivoting between services in ways that fall entirely outside the access patterns security teams model for human users. The authorization gap doesn't stay fixed at one point. It widens with each hop in the chain.

Diagram: Why the Authorization Gap Opens — and Widens. Visualizes: Visualize the authorization gap as a chain of hops where exposure grows at each step.

Prompt injection as a permission bypass that lives inside the data itself

Prompt injection tops the OWASP Top 10 for LLM Applications. It is not exotic. It is the leading vulnerability class for deployed AI agents, and it requires no software exploit, no credential breach, nothing sophisticated.

The attack hides instructions inside content the agent is asked to read: a document, a support ticket, a customer record. Research published by Greshake et al. (2023) and reproduced in multiple subsequent benchmarks found that a large share of deployed agents proved vulnerable to being hijacked this way. This is happening in production systems right now, not in hypothetical red-team exercises.

Here is the specific mechanism that matters for permission enforcement: an injected instruction directs the agent to query data it would never have touched under its original task. If permissions were evaluated once at session setup, that injected query inherits the original session's broad access. The agent is now operating outside its sanctioned scope, and no permission check catches it, because the session credential is still valid. The system did exactly what it was built to do. It just did it for the wrong principal.

Query-time enforcement catches this deviation because policy evaluates the actual query, not the original intent. The injected instruction generates a new query. That query hits the enforcement point. That query is evaluated against the real user's entitlements. If it falls outside those entitlements, it fails. The hijack has nowhere to go.

Security leaders report significant pressure to deploy agents quickly even when security isn't fully in place. The vulnerability pool is growing faster than the governance infrastructure around it. Prompt injection isn't solvable at the model layer alone. The data layer has to be hardened independently so that even a fully hijacked agent cannot reach data the real user is not entitled to see.

How query-time enforcement actually works at the policy and data level

The core pattern is straightforward. Every agent action passes through a Policy Enforcement Point, which marshals the request and its context to a Policy Decision Point. Access is granted only when an explicit matching rule exists for that specific identity, that specific query, and that specific moment in time. When the task completes or the session times out, permissions are torn down. No lingering session credentials, no latent access waiting to be reused.

Just-in-time policy generation takes this further. Rather than pre-defining every possible permission combination, recent frameworks generate minimal-privilege policies on the fly for each new task, with explicit risk scoring that routes uncertain cases to human review. The permission set matches the task, not a role someone defined months ago and never revisited.

Fine-grained row- and column-level security, tied to the acting user's identity rather than the agent's service account, is what makes this viable in regulated industries. In financial services, healthcare, and insurance, full-table access isn't just a security risk; it is a compliance violation. Row filtering and column masking are the controls that make agent deployment against regulated data legally permissible at all. Declarative SQL policies, as implemented in systems like Oracle's AI Database 26ai, enforce these controls even when the application or agent layer is subverted.

Gateway-mediated access completes the picture. All agent database queries route through a centralized gateway that enforces permissions and logs access. Agents never touch raw sources directly. Purpose-specific service accounts carry minimal required permissions per workload and are revocable at the level of a single agent without disrupting everything downstream. The practical target: an agent acting on behalf of a user can surface only what that user could already open, regardless of what the agent's own credentials would otherwise permit.

Why enforcement has to live at the data layer, not the model or prompt layer

Table: Why Enforcement Must Live at the Data Layer. Compares What it sees, Identity assertion, Row/column filtering, Combination sensitivity, and 2 more by Model / Prompt Layer and Data Layer.

The model layer is trained, not governed. It can be guided by system prompts, but it cannot reliably refuse to return data it can physically reach. That is not a failure of any particular model. It is just how models work.

Prompt-layer guardrails are advisory. They can be overridden by injection, by model updates, or by misconfigured system messages. Research published by Perez and Ribeiro (2022) and subsequent studies demonstrated that sensitive data surfaces in LLM responses once an agent has access to it, often with minimal delay between retrieval and exposure. That window is too small for any post-hoc filter to catch reliably. By the time the filter would have acted, the data is already in the output.

The data layer is the only point where the actual query is visible in structured, evaluable form. It is where real user identity can be asserted and checked against policy. It is where row- and column-level filters are applied before anything is returned, and where the intersection of all recipients' permissions can be computed before anything leaves the layer.

There is also a sensitivity problem that only the data layer can see. A query that joins two individually innocuous fields can produce a sensitive result. The model cannot evaluate that risk because it only sees the output, not the query plan. The data layer sees the full query and can catch combination-level sensitivity before the result is ever constructed.

Governance patched onto the model or prompt layer fails the same way legacy consent platforms failed: policy captured at one layer, never enforced in the layer where data is actually consumed. Moving the guardrails closer to the model doesn't close the gap. It just repositions the same vulnerability somewhere that feels safer but isn't.

The semantic layer's role in making query-time enforcement trustworthy

Query-time permission enforcement answers whether a given identity can access a given dataset. That is a necessary condition for trustworthy agent behavior, but it is not sufficient on its own. Agents also need to know what the data means to return answers that are correct, not merely permissible.

Without a semantic layer, agents operate against raw schemas: column names without definitions, metrics without agreed formulas, tables without stated relationships. One large retailer discovered this acutely when its agent returned different answers to the same business question depending on which dashboard's definitions it had started from. The problem wasn't permissions. The agent had accessed exactly what it was allowed to access. It just didn't know what it was looking at. The results were governed but wrong, which, depending on the decision downstream, can be worse than no result at all.

The semantic layer maps technical assets to business concepts and carries the metadata the agent needs to reason correctly: table descriptions, metric definitions, ownership, certification status, sensitivity classification. Without this context, an agent can be fully permission-compliant and still produce a misleading answer. Treating compliance and correctness as equivalent is how you end up with a governed system that nobody actually trusts.

By the end of 2025, dbt, Snowflake, Databricks, Salesforce, and others had all formalized semantic layers. These largely solve query consistency. They do not solve the broader trust problem, which requires lineage, governance signals, and access policy to function together.

For query-time enforcement to be trustworthy end-to-end, the semantic layer has to sit inside the same governed access layer. The agent should receive meaning and permissions in the same response, from a single coherent system, not from two separate systems that may be out of sync with each other on any given day.

What a governed access layer looks like as a single interface for agents

The architecture isn't hard to describe, though it takes deliberate construction to get right. A governed protocol layer sits between the agent and every raw data source. It makes an access decision on every request. No static credential passes through.

An agent needing data from multiple systems makes one request to one interface and receives governed results back. Federation and enforcement happen inside the layer, invisible to the agent. What the interface returns on every query is not just data: it returns only the rows and columns the real end user is entitled to see, plus metadata covering ownership, certification status, sensitivity classification, and lineage, plus business meaning in the form of definitions, metric formulas, and table relationships. Every query gets all three, together, from one place.

Model Context Protocol, MCP, has emerged as a widely adopted interface standard for connecting AI clients to enterprise systems. Anthropic, OpenAI, Google, and Microsoft all support it. An MCP server following a governed pattern exposes the enterprise data graph to an agent and enforces identity-scoped access at each request. Standardization accelerates integration, but it also expands the attack surface. A governed MCP layer needs purpose-built security; it cannot inherit assumed security from the protocol itself.

No migration is required to stand this up. The governed layer sits on top of existing warehouses, SaaS tools, and operational systems. The infrastructure underneath does not need to change.

Audit logging at this layer deserves separate attention. At agent-level query volumes, logs that capture only resource access without identity or intent become useless for investigation. The governed access layer captures identity, intent, and lineage together on every query. That combination is what makes post-incident review workable and what makes proactive governance possible at all.

What read-versus-write asymmetry means for governing agent actions

Diagram: Read vs. Write: An Asymmetry Most Architectures Ignore. Visualizes: Show a before/after or two-column contrast between read actions and write actions under current agent permission models.

Early agentic deployments were retrieval-only. Production agents increasingly take actions: updating records, triggering workflows, sending communications, executing transactions. The permission architecture has not caught up to that shift, and the consequences of that lag are genuinely different in kind from anything a read-only agent can cause.

A read that returns the wrong data is a disclosure problem. A write that acts on the wrong data, or on behalf of the wrong identity, is an irreversible business or compliance event. You can remediate a disclosure. You cannot un-send a communication or un-execute a transaction. The asymmetry matters, and most current architectures don't reflect it. It's the difference between a witness and a surgeon: one sees something they shouldn't; the other does something that can't be undone.

The permission model has to treat writes differently: a higher confirmation threshold before execution, explicit authorization scoped to the specific write action rather than inherited from read access, and human-in-the-loop checkpoints for writes above a defined risk threshold. These are not bureaucratic friction. They are the minimum structural controls that make write-capable agents governable at all.

Single revocable permissions per workload matter more when write capability is involved. If a write-capable agent's credentials need to be pulled, the revocation has to be targeted. A shared service account that breaks dependent systems when revoked is not a workable control; it is a reason to avoid revocation, which means it is functionally no control at all. You've just built in a disincentive to respond to the thing you're supposed to be governing.

Audit logs for write actions need to capture more than what changed. They need to capture on whose authority, under what task context, and with what data as input. Without that lineage, post-incident review cannot determine whether the agent acted within its sanctioned scope. The log becomes a record of events with no account of causation, which is to say, a log that answers none of the questions that actually matter after something goes wrong.

Most enterprise permission architectures still handle agent reads and writes under the same service account model, as though they carry equivalent risk. They don't. The organizations that close that gap first will be the ones whose write-capable agents can actually be trusted in production.

Sources

  1. okta.com
  2. opennash.com
  3. alation.com
  4. precisely.com

More in AI Data Governance