# Who can see what when your AI can see everything

> Three ways to scope what an AI assistant can read per person: database policies, app guards, per-user connections. Where each fails, and how to test it.

Canonical page: https://www.greatarrow.ai/guides/who-can-see-what-when-your-ai-can-see-everything · updated 2026-11-16

## Your assistant reads as one identity, and you assumed it read as many

You gave the team an assistant that can search mail, documents, tickets and notes. Everyone asks it questions. Somewhere in the setup, you assumed it answers each person using only what that person is allowed to see.

That assumption is where small teams get hurt. The assistant is not a person. It is a process holding some credential, and whatever that credential can read, the assistant can read. If the credential is broad, the answer to 'who can see what' is 'whoever can phrase the question well'.

There are three honest ways to narrow it. You can have the database refuse the read. You can have your own code refuse it before the query runs. Or you can skip the problem by connecting as each person, so the source system does the refusing. Each works. Each has a case where it is the wrong tool, and each can look correct on paper while enforcing nothing.

This piece compares the three, says where each breaks, and ends with a way to check that yours holds.

## The failure mode: a true sentence that restrains nothing

Here is a story of something that broke, because it is more useful than a hypothetical.

Great Arrow's own platform audit on 2026-09-02 found that five documents credited Postgres row-level security with enforcing workspace isolation, although the application's own role bypassed it. Those included answers submitted to a security assessor and the public privacy policy. Production disproved the claim. Every one of the 252 public tables had RLS switched on, and there were 443 policies. But `anon` and `authenticated` could read zero of those tables, so the policies written for them never evaluated. The application's pool connected as `postgres`, which bypasses RLS, and no table forced RLS on its owner. The conclusion in the team's own decision document is blunt: 100% of real tenant isolation in that system is application-level. [mem:debdcdb0-ea65-4ca4-b7ff-7e04bbfe1a7d, ref:docs/database/TENANCY_AND_ISOLATION.md]

Note the shape of the error. 'RLS enabled on 252 of 252 tables' was a true sentence. It described zero enforcement. Anyone reasoning about tenant safety from that number was reading a metric that restrained nothing.

**A control you have switched on and a control that is enforcing are different facts, and only a test on the real connection tells you which one you have.**

## Option one: database-level policies

The idea: the database itself filters rows by the current user. Even if your code has a bug, a query cannot return rows the policy hides. It is the only approach where a forgotten check in application code does not leak data.

The [PostgreSQL documentation on row security](https://www.postgresql.org/docs/current/ddl-rowsecurity.html) states the catch plainly: superusers and roles with the bypass attribute skip policies, and table owners skip them unless the table is set to force RLS. So the policy is only as strong as the role your application connects as.

Two more practical costs. Policies need to know who the current user is, which means passing identity into each session or transaction. Behind a transaction pooler, that has to be set per transaction, not per connection, or one person's identity can leak into the next request. And a policy engine is hard to reason about once you have hundreds of them.

**Where it is the wrong choice:**

- Your application connects through one shared, privileged role and you are not willing to change that. Policies will exist and never run.
- Your isolation rules are not row filters. 'Can see the summary but not the source email' is awkward to express in a policy.
- Nobody on the team can read the policies. A control you cannot review is a control you cannot vouch for.

## Option two: application-level guards

The idea: your code decides. Every read goes through a function that adds the workspace or user filter, and queries that skip it fail review or fail a test.

This is what the audit above found was actually doing the work. Great Arrow's own marketing describes role-scoped team access where you decide who sees what, and the audit says plainly that the enforcement behind it lives in application code. [claim:pillar-2, ref:docs/database/TENANCY_AND_ISOLATION.md]

The advantage is legibility. You can open the file, read the guard and write a test. You can express rules a database policy handles badly, such as per-field visibility or a visibility flag on a meeting invite.

The cost is coverage. Every new query, background job, export, search index and agent tool is a new place to forget the guard. An assistant makes this worse, because it adds routes: a chat tool, an MCP tool, a retrieval step, a summary job. Each is a separate path to the same data.

**Where it is the wrong choice:**

- You have many services or contributors writing queries and no central data-access layer. The guard will be missing somewhere.
- You cannot test negative cases. A guard you have never seen fail is a guess.
- Your compliance story requires that a bug in your code cannot expose data. Then you need a second layer, not a better first one.

The honest version of this option is to say so: isolation is application-level, here is the file, here is the test that fails if the guard is removed. That is a claim a reviewer can check.

## Option three: per-user connections

The idea: do not reimplement permissions. Connect the assistant to each source as the person asking, using their own OAuth grant or their own database login. The source system already knows what that person may see, so the assistant inherits exactly that and nothing more.

For mail, calendars and shared drives this is usually the best answer. The permission model belongs to the system that holds the data, and it is kept current by people who administer it. If someone loses access to a folder, the assistant loses it too, without anyone updating a rule. The setup for something like [connecting Gmail to Claude](/guides/connect-gmail-to-claude) follows this shape.

The costs are real:

- **Cross-person questions get harder.** 'What is late across the team?' needs the union of several people's access, which is an aggregation problem the source systems will not do for you.
- **Credentials multiply.** Every person times every source is a token to store, refresh and revoke.
- **Revocation is only as good as your cleanup.** A stale token for a departed employee is a standing read grant.
- **Shared memory sits outside it.** Once the assistant stores what it learned, that stored copy needs its own isolation. The source system's permissions do not follow the copy.

**Where it is the wrong choice:** data you store yourself and need to query across people, and any case where the source system has no real per-user permissions. A single shared admin login to a spreadsheet is not a per-user connection with extra steps.

## Side by side

|                                 | Database policies                       | Application guards                | Per-user connections            |
| ------------------------------- | --------------------------------------- | --------------------------------- | ------------------------------- |
| Who enforces                    | The database                            | Your code                         | The source system               |
| Survives a missed check in code | Yes, if the connection is subject to it | No                                | Yes, for that source            |
| Fails silently when             | The app role bypasses RLS               | A new path skips the guard        | A token is stale or over-scoped |
| Cross-person queries            | Easy                                    | Easy                              | Hard                            |
| Best for                        | Data you store, shared tables           | Rules with nuance, one data layer | Mail, calendar, documents       |

Most real systems use more than one. The mistake is not choosing the wrong one. It is believing you have a layer you do not.

## How a small team should choose

Start from where the data lives, not from what sounds strongest.

For data that stays in the source system, use per-user connections and let that system refuse. For data you store, such as notes, memory and task history, decide whether the database or your code is the enforcer, and be honest about which it is today.

If it is your code, say so, name the file and write the test. If you want the database as a second layer, check the connecting role first. Run a query as the application and read what the role is and whether it bypasses RLS. If it does, the policies are decoration until you change the connection or force RLS on the tables.

Whatever you pick, route every assistant read through one place. Chat, tool calls and retrieval should share a data-access path. If you want to see how answers can carry their sources, [asking AI about company data with citations](/guides/ai-access-company-data-with-citations) covers the retrieval side, and [what MCP for teams means](/guides/what-is-mcp-for-teams) covers how tools reach your data.

## How you know it holds

A claim about isolation needs a check you can rerun, not a sentence in a policy.

1. **List every route.** Chat, MCP tools, background jobs, exports, search. Next to each, write the identity it runs as.
2. **Write a negative control.** Sign in as user A, request user B's record through each route, and fail the test if anything returns.
3. **Break it on purpose.** Remove the guard or change the role, and confirm the test goes red. A test that cannot fail proves nothing.
4. **Check documents, not just code.** The audit above failed because prose claimed a control the production catalog disproved. After the fix, the team's honesty gate also judged those documents sentence by sentence, because a block-level check let an overstated claim hide among true ones. [mem:debdcdb0-ea65-4ca4-b7ff-7e04bbfe1a7d]
5. **Look at what outlives deletion.** The same audit filed a finding that a deleted user's document and memory activity survived in an events table. Isolation includes what stays behind after someone leaves. [mem:debdcdb0-ea65-4ca4-b7ff-7e04bbfe1a7d]

If you cannot do step two for a route, write down that you cannot. A gap you can see beats a green light you cannot explain.

## Questions

### Is row-level security enough to keep tenants apart in a shared database?

Only if the role your application connects as is actually subject to the policies. Table owners and roles with the bypass attribute skip them unless the table forces RLS. Check the connecting role and the table settings, not just whether policies exist.

### Are application-level guards a weaker choice than database policies?

They are a different trade. A guard in code is easy to read, test and change, but every new query path has to remember it. A database policy applies to every path, but only when the connection is subject to it. Neither is safe unless you can prove it holds.

### When are per-user connections the right choice?

When the source system already knows who each person is and enforces its own permissions, such as mail or a document store. The assistant then inherits each person's access instead of reimplementing it. It is the wrong choice for data you store yourself and need to query across people.

### How do I test that an assistant cannot read another person's data?

Write a negative control: a test that signs in as user A, requests user B's record through every route the assistant can use, and fails if anything comes back. Then break the guard on purpose and confirm the test goes red.

### What should a small team do first?

List every route the assistant reads data through, name the identity each route runs as, and write down who is excluded and how you know. Most teams find one route that runs as an all-powerful identity.
