When a language model can see private data, read untrusted content, and send information to the outside world at the same time, you’ve assembled the “lethal trifecta.” This article shows how to defuse it in real products—especially in finance—by making safety an architectural property, not a prompt.

By Keroshan Pillay
When a language model can see private data, read untrusted content, and send information to the outside world at the same time, you’ve assembled the “lethal trifecta.” This article shows how to defuse it in real products—especially in finance—by making safety an architectural property, not a prompt. To tackle this issue we must:
(1) frame the trifecta in practical, product terms;
(2) state two non-negotiable guarantees—single-scope user isolation and no uncurated egress;
(3) present a simple, repeatable pattern (server-side tools, cookie-derived sessions, RLS everywhere, and a deny-egress model runtime);
(4) walk through common attack paths and why they fail under this design
(5) offer a minimal adoption plan and explain why these controls matter for financial privacy, audits, and ship velocity.
Two guarantees, up front
Emphasize the first; never forget the second. Together they keep an intelligent feature from becoming an intelligent breach.
Models don’t have identities; sessions do. Our model can read secrets, but it can’t send them anywhere.
System safety isn’t achieved by pleading with a model to behave. It comes from removing capability edges the model could use to do harm.
Everything else is implementation detail.
We’ve converged on a simple, repeatable pattern. It’s not specific to one stack; it’s a set of construction rules you can translate into your environment.
1) Server‑side tools only
The model may request a tool call, but only the server decides what actually runs. Tools are regular server functions with narrow, schema‑validated inputs. They live behind your API, not in the browser, and not inside the model’s runtime.
2) Identity is derived, not declared
Identity comes from a signed, short‑lived, httpOnly cookie turned into a server session. Every tool receives that session and does not accept userId, accountId, or any other selector. There is literally nowhere to smuggle “act as this other person.”
3) Row‑Level Security everywhere
All database access runs under Row‑Level Security (RLS) keyed by the current session. Even if someone forgets a filter or ships a sloppy query, the database itself enforces “only this user’s rows.”
4) Deny model egress; choreograph server egress
The model runtime has no network keys—no fetch, no sockets, no email, no uploads. If your product needs outbound actions, they happen in server tools that:
5) Role‑scoped tool registries
Users, operators, and admins see different tool lists with different rules. Cross‑tenant analytics, if they exist at all, live behind an admin‑only tool with visible “acting as” context and a time‑boxed session.
6) Observe and budget
Safety should be visible: structured logs with component tags, correlation IDs for incidents, and per‑tool quotas. If something weird happens, it should be obvious.
WHERE clause.A mis‑scoped query returns only the caller’s rows because RLS is the backstop. You get a correctness bug, not a privacy incident.Bottom line: the exploit becomes a request without a route.
You can get most of the benefit with a short, disciplined sequence of changes:
userId, accountId, “tenant,” and similar fields from every tool API. Read identity only from the server session.These steps don’t slow you down; they unblock shipping by removing the scary tails that stall approvals.
Financial data is unusually sensitive:
The two guarantees give you a clean story:
Equally important, this story is easy to explain to customers. “The AI can only see your data, and it can’t send anything without you” is the kind of sentence that earns trust.
The “lethal trifecta” is a useful warning: private data + untrusted content + external communication is a dangerous mix. In fintech, the response is straightforward and strong enough to survive red‑teamers:
Simple rules, applied consistently. That’s what makes intelligent systems safe around money.
