Lessons from our products

Keeping One Client's Books Isolated From Another's

When one firm's software holds many clients' books, a single scoping mistake exposes someone's finances. Isolation has to be enforced in layers: scoped queries, encrypted fields, role checks and an audit trail.

By Cloud Technopix · Published 5 July 2026 · 12 min read

Why accounting software raises the stakes

An accounting firm's software holds the financial records of many separate clients: bank statements, receipts, ledgers and tax figures. If one client can see another's books, or a staff member sees clients they should not, the harm is serious and the trust loss is immediate. When we built CPAFriend, keeping one client's books isolated from another's was a starting requirement, not a feature added later.

This article describes the layered approach we use for that kind of isolation. No single layer is enough, because each can fail, and the point is that a failure in one is caught by another.

Layer 1: scope every query to a client

The first layer is in the data access code. Every record belongs to a client, and every query is automatically restricted to the client the user is working on. The restriction is applied centrally, by the data layer, rather than being written by hand in each query. That matters because the most common isolation bug is a forgotten filter in a rarely used report.

The client context is derived from the authenticated session and checked against what that user is allowed to access. It is never trusted just because a request names a client identifier.

Layer 2: encrypt sensitive fields

Database encryption at rest protects against a stolen disk, but not against a query that returns too much. Field-level encryption adds another barrier: the most sensitive values, such as account numbers and tax identifiers, are encrypted individually, so even someone with read access to a table cannot read them without the key. It also limits the damage of a backup or log that is exposed by mistake.

The trade-offs are real. Encrypted fields are harder to search and sort, so you must decide which fields are worth protecting this way and design lookups accordingly, for example with separate keyed hashes for exact-match searches.

Layer 3: role-based access inside the firm

Isolation between clients is one boundary. Another is between staff. A bookkeeper may work on some clients and not others, a reviewer may approve but not edit, and an administrator may manage users without seeing ledgers. Role-based access encodes those rules, so that permissions follow the job and can be changed in one place.

Authentication is part of this layer. Two-step verification reduces the chance that a stolen password alone opens a client's books, which is especially important for a system holding financial data.

Layer 4: approval before anything posts

Isolation is also about integrity: stopping wrong data from entering a client's books. In CPAFriend, documents are read and transactions are matched automatically, but exceptions go to a person, and nothing is posted to the ledger until it has been approved. That puts a human decision between an automated suggestion and a permanent record. The same principle is discussed in human-in-the-loop AI agents.

Layer 5: an audit trail

When something looks wrong, you need to answer who did what and when. An audit trail records changes to client data, including the user, the time, the old and new values and the source of the change. It is append-only, and it is available to the firm so they can review their own staff's activity. For an accounting practice it is often also a professional requirement, and it makes incidents far easier to investigate.

Each layer has a gap that another layer covers.
LayerWhat it stopsWhat it does not stop alone
Scoped queriesCross-client reads from code pathsMisuse by a user with legitimate access
Field encryptionReading sensitive values from raw data or backupsMisuse through the application
Role-based accessStaff seeing or changing what they should notA compromised account with broad rights
Approval gateUnreviewed data reaching the ledgerMistaken approval
Audit trailUndetected changesThe change itself, so it must be reviewed

Test isolation on purpose

Controls that are never tested tend to fail quietly. We write automated tests that deliberately try to read another client's records with a valid session, and expect them to fail. These run on every change, so a refactor that removes a filter is caught before release rather than by a customer.

Operational habits that support the design

  • Keep secrets and encryption keys outside the code and the database, with access limited and logged
  • Restrict who on our own team can reach production data, and record it
  • Back up regularly and test restores, because a backup you cannot restore is not a backup
  • Keep dependencies updated, since many incidents begin with a known vulnerability
  • Avoid putting client data in logs and error messages

What we took from it

  1. Assume every single control will eventually fail, and layer them.
  2. Apply isolation centrally so it cannot be forgotten.
  3. Put a human decision before irreversible changes.
  4. Make activity visible through an audit trail and test the boundaries automatically.

These ideas apply to any product holding several customers' sensitive data, which is why they feature in our SaaS development work and in the accounting and fintech page. If you are designing something similar, talk to us through the contact page.

Is field-level encryption necessary for every field?

No. Encrypt the values whose exposure would cause real harm, and accept the extra work in searching and sorting only for those.

Does this make the software slower?

Scoping and role checks are cheap. Field encryption adds a small cost on the fields it protects, which is usually acceptable for the protection gained.