A SaaS company's tenant isolation and secrets rotation program: row-level security, per-tenant keys and automated rotation
A software-as-a-service company of about 80 people running a multi-tenant application on PostgreSQL in AWS.
- Scale
- 1 shared PostgreSQL cluster, 1 key per tenant, ~2 secret stores, 1 CI pipeline
- Engagement
- 10 weeks to design and roll out, with a tenant-isolation retest at the end
The challenge
Every customer's rows lived in the same tables, and isolation depended on each developer remembering a tenant filter in each query. Database passwords and API keys were long-lived, copied between environments and rarely changed, and enterprise prospects had started asking how one tenant is kept from reading another's data.
A software-as-a-service company wanted to prove that one customer can never read another customer's data, and to stop treating passwords and keys as things that never change. The client is not named on this page, and this is an illustrative engagement that describes the kind of work our team does; details are composite. Work started with a written scope covering the application, the database and the build pipeline.
The design review began with a simple question: where does a tenant identifier get checked? In the existing code the answer was "in each query, if the developer remembers." That is how cross-tenant leaks happen, and the OWASP API Security Top 10 lists the pattern as broken object level authorization. The team moved the check into the database with row-level security in PostgreSQL. Each connection sets the current tenant, a policy on every tenant table compares it to the row, and the application's own database role is not allowed to bypass the policy. A query that forgets its filter now returns no rows.
Isolation of data at rest was the second layer. Each tenant got its own data key, wrapped by a master key in AWS KMS, with key policies that name only the services that must use them. Disabling one tenant's key makes that tenant's encrypted data unreadable, which gives the company a clean answer for offboarding and for a suspected exposure. Encryption does not replace the access checks, and the page does not claim it does: the two controls cover different failures.
Secrets were the third layer. Database credentials and third-party API keys moved into AWS Secrets Manager or Google Secret Manager, depending on where each workload ran, and the application fetches them at runtime instead of reading files or environment variables baked into images. Rotation runs on a schedule and can be triggered at once if a key is exposed. A secrets scanner in the build pipeline checks every commit and pull request, and a one-time scan of repository history found old credentials that were revoked the same day. Revocation, not history rewriting, is what protects the account.
The program ended with proof. Automated tests log in as two test tenants and try to read, update and delete each other's objects through every endpoint and background job, and they run on every build. The retest and the design document went into an evidence pack for prospects' security teams. This is the kind of work our team offers under cybersecurity and cloud management; it is a technical program, not a certification, and it does not replace an independent assessment.
What our team delivered
- A tenant-isolation design review that traced every path from a request to a database row, including background jobs, reports and admin tools
- Row-level security policies in PostgreSQL, so the database itself refuses rows that belong to another tenant, with the tenant identifier set per connection by the application and a database role for the application that cannot bypass the policies
- Per-tenant data keys wrapped by master keys in AWS KMS, with key policies limited to the services that need them and a documented procedure to disable one tenant's key
- Secret rotation with AWS Secrets Manager or Google Secret Manager: database credentials and API keys fetched at runtime, rotated on a schedule and on any suspected exposure, with no secrets in images or environment files
- CI secret scanning on every commit and pull request, plus a one-time scan of the repository history, and automated tests that attempt cross-tenant reads on every endpoint
- A short design document and evidence pack the company can hand to a prospect's security team
Result
Isolation no longer rests on every query being written correctly: a missing filter returns nothing instead of another customer's data. Secrets rotate without downtime, and the company answers questionnaires with a design and test evidence. This is an illustrative engagement, a modeled outcome and not a guarantee.
Get this for your company
Related services with fixed prices and a written scope.
Emergency package: security engineer in 1 hour
Is your company in a cybersecurity crisis? Purchase this package and a security engineer will call you within 1 hour.
Callback within 1 hour, 24 hours a day, 365 days a year
$1,950 per incident
Initial assessment of public endpoints
What an attacker can see and reach from the internet: your domains, mail, websites, remote access and cloud exposure.
Report within 5 business days of kickoff
$1,000 per assessment
Cloud security review
A review of one Microsoft 365, Azure, AWS or Google Cloud tenant against recognized benchmarks.
Report within 7 business days of read-only access
$2,800 per tenant
Show 3 more
Cloud management
We run your Microsoft 365, Azure, AWS or Google Cloud environment: access, cost, patching, backup and security settings. Priced per month for one tenant.
Onboarding within 15 business days
$1,900 per tenant, per month
Scanning of software codebase
Static analysis and secret detection across one codebase, reviewed by an engineer so you get findings, not noise.
Report within 3 business days of read-only access
$500 per codebase
Discovery and requirements workshop
Workshops with your team to map every system, process, user group and integration, and to agree what the new platform must do.
Written requirements and a system inventory in 2 to 3 weeks
$6,500 fixed fee
After you purchase, we contact you within 1 hour, any time of day or night, to start onboarding.
No payment is taken online. When we call you within the hour we confirm the scope and send an invoice (ACH, card or crypto).
Super Intelligence data flow
Every request is classified by sensitivity, so confidential data stays on models inside your walls while routine work can use the best frontier AI.
Every sign-in, verified
Staff sign in once, but behind the scenes the device, the identity, a phone approval and your access policy are all checked before any app opens, and strangers are turned away.
The evidence pack and who asks for what
Twelve artefacts a firm can show about its AI use, and the party that most often asks for each: an insurer at renewal, an auditor or client questionnaire, or a regulator. A typical pattern only; the exact list depends on the policy, framework and sector.
Facing something similar?
Tell us about your environment. We will tell you plainly what we would do and what it would take.