Tenancy and data separation
MERGED, NOT DEPLOYED — a buyer is the tenant/MSSP; a client is an organization managed by that buyer. Each tenant has its own Postgres login and schema. A client's rows are scoped inside that schema, not placed in a separate database today. A:apps/api/src/db/client.ts:85-99,317-359,654-749 A:.set/work/P2.23.md:37-46
| Boundary | Status | Mechanism and limit |
|---|---|---|
| Buyer database access | MERGED, NOT DEPLOYED | runInTenant uses the tenant login and pins search_path to its schema. This is a database grant boundary. A:apps/api/src/db/client.ts:317-359 |
| Client database access | MERGED, NOT DEPLOYED | runInClient admits the session user and pins set.client_id. runForClient checks the staff-selected client in the tenant. Client RLS compares that setting. A:apps/api/src/db/client.ts:654-749 A:apps/api/drizzle/tenant/0007_responses.sql:54-56 |
| Control plane | MERGED, NOT DEPLOYED | set_control assumes platform_kb_rw in public; tenant logins cannot assume it. Cleanup uses platform_kb_purge. A:apps/api/src/db/client.ts:569-600 |
| Credentials | LIVE ON STAGING | DB control, cleanup and binarynetworks tenant secrets rotate every 90 days. This is not evidence for every possible tenant login. E:evidence-aws.md:45,65 |
| Answer object keys today | MERGED, NOT DEPLOYED | tenants/{tenant}/answers/{file}; no client component. Shared default-chain S3 client. A:apps/api/src/questionnaires/responses.controller.ts:62-64 A:apps/api/src/standards/store.ts:57-68 |
| Per-client keys and sessions | APPROVED, IN BUILD | tenants/{tenant}/clients/{client}/answers/{file}; tenant/client session tags and session policy, DB-derived scope. A:.set/work/decisions-2026-10-26.md:30-32,52-60 A:.set/work/P2.23.md:37-75 |
| Per-square standards | APPROVED, IN BUILD | platform/standards/{standard}/{file}; standard tag; read-only square session for extraction. A:.set/work/decisions-2026-10-26.md:33-34 A:.set/work/P2.23.md:153-171 |
| VPC-only object access | APPROVED, IN BUILD | Approved endpoint restriction, including operator console access. SourceIdentity attributes sessions to users; NAT source-IP restriction is designed for STS. Need applied policy and refusal tests. A:.set/work/decisions-2026-10-26.md:60,71 A:.set/work/P2.23.md:77-99 |
| P0.12 target: DB per buyer | APPROVED, IN BUILD | LATER: database per buyer, schema and login per client, alongside per-buyer compute. Not today's architecture. A:.set/work/P2.23.md:46,501-508 A:.set/work/decisions-2026-10-26.md:60 |
Isolation limits: client RLS protects against missing filters, not hostile SQL that resets the session setting. Planned scoped S3 sessions protect a session's prefix, but a compromised API can request another client's session. The approved in-process broker does not remove that residual. A separate broker must authenticate scope independently to improve it. A:CLAUDE.md:316-324 A:.set/work/P2.23.md:426-544
NOT VERIFIED — end-to-end separation on staging. Verification requires app evidence tied to the deployed digest, cross-tenant and cross-client refusal tests, session-tag and VPC-endpoint tests, and applied policy inspection. AWS evidence currently records broad API prefixes, not the target broker permissions. E:evidence-aws.md:28,55
LIVE ON STAGING — observed file permissions still use the broad API role; the bucket has no VPC-endpoint denial and scoped roles are absent. Therefore the approved VPC-only and per-client STS boundaries are not live in this snapshot. E:evidence.md:32-35