CSE Roadmap

Common tier · about 3 hours · 12 parts

Part 9 of 12 · 2 min read

Mistakes that let one tenant see or slow another

Common mistakes, and what the example does not do.

Mistakes that let one tenant see or slow another

  • Tenant id as a tool or API argument from the model or client.
  • Per-endpoint tenant filters instead of an enforced scoped layer.
  • Post-filtering vector results, or a shared index with no tenant tests.
  • Shared caches keyed only by prompt.
  • One shared service account that can read every tenant.
  • No quotas, so one tenant's loop or flood affects all.
  • Traces readable by every engineer, with raw tenant data inside.
  • Offboarding that misses caches, traces and backups.
  • No cross-tenant tests, so isolation is untested folklore.

What the example does not do

About this example What the example does not do
  • No real database, RLS, vector store, secrets manager or authentication.
  • Assumed rates: forgetting probability, model obedience, tenant sizes, traffic and budgets.
  • Toy retrieval: random vectors, one query distribution, top-5 only; real stores support pre-filtering and larger candidate pools, which change the numbers.
  • Cache and quota models are simple (no TTLs, no real scheduling).
  • Injection is a coin flip, not a real model being attacked (Level 10 modules 1 and 8 cover that).
  • No per-tenant encryption keys, residency or regional deployment.
  • The isolation rules are design guidance; only the toy experiments carry measured numbers.
  • Optional real experiment: create two tenants in a staging copy of your platform, seed distinct secrets, and run an automated suite that tries every read path, with injected instructions, to access tenant B from tenant A; record every success as a bug.

Check yourself

A tool takes tenant_id as an argument from the model. What can go wrong?

Show answer

A prompt injection can make the model ask for another tenant, and the tool trusts it. Take the tenant from the authenticated session instead.

For the curious Filtering after the search loses results as well as leaking them

Filtering after a global top-5 search left a tenant with 3,901 documents only 1.03 of its own results in 5. A cache keyed by prompt alone served 2,675 of 4,000 answers to the wrong tenant; keying by (tenant, prompt) gave 0. When one tenant flooded a shared budget, another received 24 percent of its demand; a per-tenant quota gave it 100 percent. Toy in-memory models, assumed rates, random vectors.

What you will use daily at work

Practice What it looks like
Get identity from the session Never from a model-supplied argument.
Enforce the tenant scope in the data layer Not by convention in each endpoint.
Use namespaces or pre-filters in retrieval Test recall for small tenants.
Key caches by tenant And register every store for offboarding.