Database
Where the private data actually sits. If an attacker gets the app's credentials, the database should still refuse them almost everything.
- Least-privilege rolesThe app connects as a role that can read and write only what it needs. It never owns tables and never runs as a superuser.
- Row-level security, forcedEach customer or tenant sees only their own rows, enforced by the database with
FORCE ROW LEVEL SECURITY, so one bug in the app can't expose everyone. - Field-level encryptionSocial Security numbers, card numbers and diagnoses are encrypted in the application before they are stored. A stolen backup or disk snapshot shows ciphertext.
- Envelope encryption with a key serviceData keys are wrapped by a master key that never leaves the hardware security module. Rotating the master key doesn't mean re-encrypting everything.
- TokenizationCard and ID numbers are replaced with tokens in most systems, which shrinks what an attacker can find and what an auditor has to inspect.
- Encrypted connections only
hostsslrules reject anything without TLS, passwords usescram-sha-256, and service accounts authenticate with client certificates. - Private networkThe database sits in a private subnet with no public address. Nothing on the internet can even reach the login prompt.
- Audit logging
pgauditrecords reads, writes and role changes on sensitive tables, so you can answer who touched a record and when. - Backups you have restoredEncrypted backups with point-in-time recovery, and a restore drill on a schedule. A backup nobody has restored is a guess.
- Hold lessSensitive data kept in its own store with retention rules. Data you deleted on schedule can't leak.