/articlesConcepts
Tenant isolation and secret encryption on a shared platform
Multi-tenant AI security for IT teams: where to enforce tenant isolation, how to encrypt credentials with AES-256-GCM, rotate keys, and what to ask a vendor.
- Updated
- Published
- min read
- 07
- On this page
- 09
On this page09
- What multi-tenant means, and why AI raises the stakes
- Where should tenant isolation be enforced?
- How Botify keeps companies apart
- How should credentials be encrypted?
- How do you rotate the encryption key without downtime?
- Keep credentials away from the model
- Least privilege for assistant tools
- What should the audit log record?
- Common questions
01
What multi-tenant means, and why AI raises the stakes
A multi-tenant platform serves many customer companies from one system. Each company is a tenant. Their data usually sits in the same database, separated by a company column.
An AI platform stores more than records. It also stores the keys to each company’s other systems: Gmail tokens, ServiceNow credentials, Odoo API keys. A bug that crosses companies leaks the ability to act inside another business.
The assistant adds a second risk. A model that reads untrusted emails and tickets chooses its next step. OWASP calls the result excessive agency: a model with more tools or permissions than its job needs.
- Cross-company reads: one missing filter returns another customer’s conversations or files.
- Credential leaks: a secret written to a log or placed where the model can repeat it.
- Unchecked IDs: an ID taken from a request and used without checking who owns it (OWASP API1:2023).
- Excessive agency: an injected instruction that makes the assistant send or delete without a person.
02
Where should tenant isolation be enforced?
There are three common designs: a database per company, a schema per company, or shared tables with a company column. Shared tables are the usual choice for platforms with many customers, because updates and operations stay simple.
With shared tables, every query must carry the company filter. Relying on each developer to remember it fails eventually. The safer rule is one checkpoint every query passes, so a missing filter becomes an error instead of a leak.
| Approach | Isolation | Running cost | Typical failure |
|---|---|---|---|
| Database per company | Strongest | High | Databases drift apart |
| Schema per company | Strong | Medium to high | A connection goes to the wrong schema |
| Shared tables, filter by habit | Weak | Low | One forgotten filter leaks data |
| Shared tables, guard in the application | Strong for the queries it sees | Low | Raw SQL or nested queries the guard does not see |
| Shared tables, PostgreSQL row-level security | Strong inside the database | Medium | Superusers and BYPASSRLS roles skip the policies |
03
How Botify keeps companies apart
Botify uses shared tables and enforces isolation in the application. It does not give each company a separate database.
The guard sits in Botify’s database client (Prisma). On every top-level query against company data, it checks for the company filter. A read, update or delete without it is refused, and so is a create that does not name the company. The refusal is an error, so a mistake shows up in tests, not in a customer’s data.
The guard accepts the filter at the top of the query, inside an AND, in a compound key, or in every branch of an OR. A filter through a related record does not count.
Know its limits. The guard sees only the top-level operation. Nested writes, nested reads of related records and raw SQL are not checked by it; raw SQL adds its own company condition, and those paths are reviewed in code. A few lookups run before the company is known, such as matching an incoming webhook or API key, and use a separate, narrow database client.
04
How should credentials be encrypted?
Use authenticated encryption, which both hides the secret and detects tampering. AES in Galois/Counter Mode (GCM), specified in NIST SP 800-38D, is the common choice. It needs a fresh random value, called a nonce or IV, for every encryption under the same key.
GCM also accepts additional authenticated data (AAD): context that is not encrypted but is checked on decryption. If the context changes, decryption fails.
Botify encrypts each connected-system credential with AES-256-GCM:
- A random 12-byte (96-bit) IV for every encryption.
- The AAD is the company ID, the credential ID and the credential type. A copy moved to another company, or relabelled as another type, will not decrypt.
- Each encrypted value, called an envelope, records the key version that sealed it.
05
How do you rotate the encryption key without downtime?
There are two kinds of rotation. Credential rotation replaces the secret itself, for example a new API token. Key rotation replaces the master key that encrypts all secrets.
Teams postpone key rotation because, done in one go, it means rewriting every row in one risky change. Versioned keys avoid that: new secrets use the current key, and older versions stay available only to read what they sealed.
In Botify a background job runs every hour. For each company, it re-encrypts envelopes sealed with an older key version to the current key. Once no envelope uses an old version, that key can be removed.
06
Keep credentials away from the model
The language model should never see an API key. Credentials belong in the integration code that calls the other system, not in the prompt or in tool results.
In Botify, every call to a connected system goes through one gateway: permission check, then your rules, then approval if needed, then the integration. The model asks for an action; it does not hold the key.
Ask any vendor whether a screen, an API or a log can show a stored credential, and ask them to show you.
07
Least privilege for assistant tools
Least privilege means each tool gets only the access its job needs. It has two layers.
The first is the credential: ask for the narrowest OAuth scopes and API permissions that work.
The second is the tool. Botify gives every tool a risk class (read, write, destructive or external send) and an approval mode. Searching Gmail or Splunk runs directly. Sending an email or creating a ServiceNow incident always waits for a person. Archiving or labelling mail follows your rules. Tools from an MCP server you connect always need approval until someone reviews them.
08
What should the audit log record?
An audit log answers one question later: who caused this action, with what authority, and what happened.
In Botify the audit log is in the console under Insights, and each approval stores who decided and when. Workspace roles (owner, admin, operator, member, viewer) decide who can change settings and who can approve.
- The person or customer behind the request, and their company.
- The actions taken and their result.
- Every approval or rejection, with who decided.
- No secrets in any log entry.
09
Common questions
01Is a tenant_id column enough for isolation?
It is needed but not enough. Isolation depends on every query using it. Enforce the filter in one place every query passes, such as a guarded database client or row-level security, and treat a missing filter as an error.
02Does Botify give each company its own database?
No. Companies share tables, and the application enforces the company filter on every top-level query. Nested writes and raw SQL are outside that guard and carry their own filter.
03Why AES-256-GCM instead of AES-CBC?
GCM detects tampering: decryption fails if the ciphertext, the IV or the associated data changed. CBC alone only hides the data and needs a separate check. GCM also lets you tie a secret to its company and record.
04How often should encryption keys be rotated?
Your security policy sets the interval. What matters is that rotation is routine: versioned keys, a background re-encryption job, and removing the old key only when nothing uses it.
05Where is my data hosted, and is Botify certified?
This site does not state a hosting region or certifications. Ask us for the details your review needs.
10
Sources
- [1]NIST SP 800-38D: Galois/Counter Mode (GCM) and GMAC
- [2]OWASP Top 10 for LLM Applications 2025: LLM06 Excessive Agency
- [3]OWASP API Security Top 10 2023: API1 Broken Object Level Authorization
- [4]PostgreSQL documentation: Row Security Policies
- [5]Prisma documentation: query component of Prisma Client extensions
11