Zero Labs
Industry News / AI

Why Role-Based Access Control Fails for AI Agents — and How to Fix It with Memory Lineage Engines

Source · Towards AI By Venkata M Sangaraju

From the publisher’s feed, collected in the ZeroLabs newsroom.

A clean integer with no name, no tag, and no PII in it can still leak a restricted column. Here’s the engineering reason why, and the architecture that closes the gap.Take a concrete scenario. A Finance agent runs a query that joins transactions against customer_pii — a table that includes income — to compute a churn_rate for customers who've gone quiet in the last 90 days. It gets back a single float: 0.114. Nothing sensitive-looking about it. No names, no account numbers, no raw income figures. The agent caches the result in shared memory so the next agent that asks for churn_rate doesn't have to recompute it.A week later, a Marketing agent asks the same shared memory for churn_rate and gets 0.114 back, instantly, no query executed. Marketing was never granted access to income. Its role-based access-control (RBAC) entry explicitly blocks that column. But nothing in this transaction touched income directly — Marketing didn't query the column, didn't see a row that contained it, didn't request anything with "income" in the name. It asked for a KPI by name and got a float back.By any access-control system running in production today, that transaction is clean. And it’s a policy violation. The number 0.114 was derived from a computation Marketing was never authorized to run.This is the finding at the center of a paper I co-authored with Sudhir Vissa — “Lineage-Aware Memory Governance: A Derivation-Gated Framework for Privacy-Preserving Column-Level Access Control in Enterprise AI Agents,” accepted at IEEE Access (DOI: 10.1109/ACCESS.2026.3730363). This post walks through the engineering mechanics of the failure and the fix, using the actual worked example and architecture diagram from the paper.The check every access-control system runs — and the one it doesn’tStrip away the vendor language and every access-control mechanism guarding a piece of data — RBAC, attribute-based access control (ABAC), content tagging, ownership metadata — runs some version of the same predicate at retrieval time:allow(requester, object) := tag(object) ⊆ permissions(requester)The object carries a label — a sensitivity classification, an owner, a role requirement — and the check asks whether the requester holds a credential matching that label. Apache Ranger and Databricks Unity Catalog do this at the column level for raw queries: they intercept a SELECT statement and check whether the requesting principal is allowed to read the specific columns named in it. That works, and it works well, for exactly the case it was built for: stopping an unauthorized read at the point of query execution.Shared agent-memory systems — MemGPT, Zep, A-MEM, and the newer governed-memory architectures being built for enterprise deployments — extend the same pattern to cached results. A memory entry gets an owner, maybe a sensitivity tag, maybe a role requirement, and retrieval is gated on whether the requester’s credentials match. This is a reasonable design, and it’s also where every one of these systems stops.The problem is that churn_rate = 0.114 has no tag to check. It's a scalar. Nobody attached a sensitivity classification to it, because nothing about the value is sensitive — you can't reverse-engineer income from a churn rate. The column-level ACL at the database layer did its job perfectly: it verified that Finance was allowed to touch income when it ran the join. But that check fired once, at write time, for the agent that computed the number. It has nothing left to say about the agent that retrieves the cached result afterward. By the time 0.114 sits in shared memory, the access-control moment has already passed, and the object in front of the second access-control check carries no trace of the columns that produced it.So the predicate every current system checks — does the requester’s tag match the object’s tag — is answering the wrong question for this failure mode. The question that actually determines safety is:safe(requester, result) := columns_touched(result.derivation) ⊆ permissions(requester)That’s not a check on the object. It’s a check on the object’s derivation — the tables it joined, the columns it read from each of them, the filter predicates that shaped it. And no system in the current agent-memory landscape records that, which means none of them can evaluate it.The worked example, mechanicallyHere’s the actual derivation graph from the paper — Figure 1 — showing exactly what has to be tracked to make that second check possible:Read it left to right. Three source tables feed a join: transactions, customers (customer_id, signup_date), and customer_pii (last_txn_date, income). The join step applies a filter — last_txn_date 20000 — and produces churn_rate = 0.114, tagged with the department and a TTL epoch.The part that matters is the dashed box on the right. Two values get computed once, at the moment the result is cached, and stored alongside it:The sensitivity tag, S(a) — the union of every column touched across every step of the derivation, intersected with the organization’s registry of sensitive columns:S(a) = (∪ᵢ Cᵢ) ∩ 𝒮For this AMU, S(a) = {income}. It doesn't matter that income never appears in the output — the tag is computed from what was read, not what was returned.The definition hash, H(a) — a fingerprint of exactly how the metric was computed: the sorted table names, the sorted column set, and the filter predicate, hashed and truncated to 12 characters:H(a) = SHA256(sort(tables) ‖ sort(∪ᵢ Cᵢ) ‖ φ)[0:12]This second value isn't for access control — it's for catching something else entirely: two departments computing a metric with the same name through different logic (a 90-day churn window versus a 60-day one, say). If two AMUs share a metric name but their hashes differ, that's a silent definition conflict, and it gets surfaced automatically instead of showing up as a mismatch in a board deck. It rides along for free once you're recording derivation for the access-control reason.Both values are sub-microsecond to compute. The retrieval-time check itself is then a single set-difference: is S(a) a subset of what this requester is permitted to see? For Marketing, whose permission set explicitly excludes income, the answer is no — regardless of the fact that the value 0.114 looks completely inert.The fix: gate on derivation, not on tagsThe mechanism is called the Analytical Memory Unit (AMU) — a memory schema that carries the derivation graph as a first-class field, plus a retrieval algorithm that gates on it. Here's the full architecture, Figure 2 from the paper:Two paths run through this diagram, and it’s worth separating them cleanly because they solve two different problems.The read path (left and center) is the leak-prevention mechanism. A requesting agent asks for a metric by name. The Lineage Gate pulls every AMU ever stored under that name, resolves the requester’s permission set once, and scans candidates most-recent-first — not because ordering doesn’t matter, but because it’s a deliberate policy choice: when a safe candidate exists, the department gets the freshest one, not an arbitrary historical value. For each candidate, it checks a single predicate: is the cached S(a) a subset of P(dept)? First candidate to pass gets served, and the memory-reuse counter increments. If a candidate fails — Marketing hitting the Finance-computed churn_rate — it's skipped and the loop moves to the next-oldest candidate. If nothing in the store passes, the agent falls back to a fresh, in-scope computation of its own, which then gets written back into the store through the same path, available for the next requester who's actually permitted to see it.The write path (right) is unrelated to access control — it’s the definition-conflict detector. Every new AMU gets compared against existing entries under the same metric name; if a cross-department pair has matching metric names but different definition hashes, that’s flagged for downstream review. It never blocks the write. It just surfaces a signal that two teams’ business logic has silently diverged.The formal guarantee behind the read path — Theorem 1 in the paper — is a straightforward case analysis: there are exactly two exit points in the retrieval algorithm, a memory-served return and a fallback return, and the proof shows neither path can hand a requester a result whose derivation touches a column outside their permission set, provided the lineage record is complete. That “provided” is doing real work, and it’s worth sitting with before assuming this is a drop-in fix.What it costs, measuredNone of this is useful if it’s a paper mechanism that falls apart under load or eats the very redundant computation you were trying to preserve by sharing memory in the first place. Six experiments in the paper try to break it.Across a synthetic five-table schema and the denser eight-table TPC-H benchmark, naive content-gated memory — the pattern every current system uses — leaked cross-department results at 18.8% and 25.5% of retrievals respectively (30 seeds each, effect size around d≈7–8, well past the conventional threshold for a large effect). Lineage-gated retrieval brought that to zero in both configurations — which, to be precise about what that number means, is the formal guarantee from Theorem 1 holding in the tested setting, not an empirical discovery. The empirical finding is the naive baseline’s leak rate; the zero is what the proof predicts.That protection isn’t free. Gating out unsafe candidates means more fallbacks to fresh computation: reuse rate dropped from 95.8% under naive caching to 81.5–82.6% under lineage gating — roughly 13 additional query executions per 100 requests. That cost shows up as extra compute, not as gating latency: the actual permission check runs at 0.09 microseconds for the gate predicate itself, and even the worst-case retrieval scan — every candidate blocked, scanning all 50 — tops out at 13.82 microseconds. In a realistic production store, where a metric accumulates at most a handful of department-variant AMUs, that’s sub-2-microsecond in practice. Not a meaningful line item next to a query that takes milliseconds to seconds.Two more results matter for anyone deciding whether to trust this in production. First, the completeness-degradation experiment: the safety proof assumes lineage recording is complete, but real instrumentation isn’t always. Testing with deliberately truncated lineage — simulating buggy instrumentation or agents that under-report what they touched — showed the protection degrades gracefully rather than falling off a cliff, converging back to zero leakage by 75–90% completeness, and degrading faster specifically on schemas where sensitive columns sit behind more joins. That’s a useful operational signal: instrument the deeply-nested joins first.Second, and more important for anyone worried this only works when the agent cooperates: a real-agent test wired lineage extraction directly into the database driver layer using SQLGlot to parse the actual SQL a LangChain agent executed, with no self-reporting from the agent required. Across 9 round-trips against a real database, zero cross-department leaks, with two genuine definition conflicts caught automatically. The cleanest integration point turns out to be exactly where you’d want it: wrap the cursor, parse every executed statement, and the agent never has to know it’s being watched.What this doesn’t fixThe credibility of a mechanism like this depends on being precise about its edges, so three limitations are worth stating plainly rather than burying in a discussion section.It does not stop inference attacks — a derived feature that encodes sensitive information without ever naming the source column in a way the lineage extractor can see. A hand-crafted risk score computed from income where the dependency isn't captured in the executed query will slip past the gate, because the gate can only check what the lineage record actually contains. This is the single gap the paper's authors flag as the most important one left open.It assumes lineage recording is honest and complete. Self-reported lineage from a cooperative agent is a weaker foundation than lineage extracted automatically from the executed SQL, which is exactly why the driver-layer interception approach matters more than it might first appear — it removes the agent’s ability to lie about what it touched, deliberately or through a bug.It does not defend against a compromised memory store or an insider with direct infrastructure access, and it does not — on its own — stop a requester from triangulating a blocked column by combining several individually-permitted results that are jointly informative about it. Those need their own controls: encryption, audit logging, differential privacy, infrastructure trust boundaries. This is one layer in a defense-in-depth stack, not a replacement for the source-layer controls it sits alongside.The question worth asking about your own agent-memory stackIf you’re building or evaluating a shared memory layer for agents, there’s one question worth running through concretely: when your retrieval path decides whether to hand a cached result to a requesting agent, what predicate is it actually evaluating? A tag someone attached when the entry was written? A role the requester happens to hold? Or a set-membership check against the actual columns that produced the value?Most systems on the market today, including every one benchmarked in this paper, are checking the first two. RBAC and content tagging aren’t wrong — they’re answering a real question, just not the one that determines whether a specific cached number is safe for a specific requester. That’s a derivation question, and it needs a derivation record to answer. The mechanism costs microseconds and a few hundred bytes per cache entry. What it buys is a governance layer that can actually prove — mechanically, at retrieval time — that a result never crossed a column-permission boundary, rather than discovering the leak in a post-incident audit.This piece is a plain-language, engineering-focused walkthrough of “Lineage-Aware Memory Governance: A Derivation-Gated Framework for Privacy-Preserving Column-Level Access Control in Enterprise AI Agents,” co-authored with Sudhir Vissa (SAGE7 AI), accepted at IEEE Access (DOI: 10.1109/ACCESS.2026.3730363). Figures reproduced from the published paper. Full derivations, the complete threat model, and the experimental protocol are in the paper and its supplementary material.Why Role-Based Access Control Fails for AI Agents — and How to Fix It with Memory Lineage Engines was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.