Database security audits rarely turn up a sophisticated attack vector. They turn up a shared root credential three former employees still technically have, a backup snapshot sitting in an S3 bucket without encryption enabled, or an audit log that's technically being collected but nobody has ever actually queried.
Compliance frameworks — SOC 2, HIPAA, GDPR — don't specify exact technical controls in most cases; they specify outcomes (data protected at rest, access restricted and traceable, incidents detectable) and leave the implementation to you. This is not legal or compliance advice — talk to your auditor or counsel for what your specific framework requires — but the technical controls below are the ones that satisfy the intent behind nearly every framework's database-related requirements, and the gaps we find most often when reviewing an existing setup.
Prefer to skip the debugging and have an expert handle this? Book a 30-min diagnostic →
Encryption at Rest: Beyond the Checkbox
Enabling encryption at rest on a managed database (RDS, Cloud SQL, Aurora) is usually a single checkbox, which is exactly why it's easy to assume the job is done. It isn't, until backups, snapshots, and read replicas inherit the same encryption — a database encrypted at rest with an unencrypted manual snapshot sitting in storage is still a real exposure, and cloud providers don't always encrypt derived resources by default just because the source was encrypted. Key management matters too: a customer-managed key (CMK) that your team controls and can revoke gives you the ability to cryptographically deny access to all data instantly if a key is compromised — a provider-managed key doesn't offer that lever.
Audit every backup, snapshot, and replica associated with a database, not just the primary instance, and confirm each one is encrypted with a key your organization actually manages.
Encryption in Transit: TLS Everywhere, No Exceptions
Encryption in transit is frequently enabled for application-to-database connections and quietly skipped for everything else touching the database: replication traffic between a primary and a replica, connections from an internal admin tool, or a backup job running from a cron server. Any of those unencrypted paths is a place credentials or data can be intercepted on the network, and 'it's an internal network' is not a control an auditor will accept, since internal networks are exactly where lateral movement happens after any other initial compromise. Enforce TLS at the database level, not just as an application convention — rejectUnauthorized settings, sslmode=require or stricter in PostgreSQL connection strings, and a database configuration that actually refuses plaintext connections rather than merely accepting encrypted ones as an option nobody is required to use.
-- PostgreSQL: reject non-SSL connections entirely
-- In pg_hba.conf, replace "host" with "hostssl" for relevant entries
hostssl all all 0.0.0.0/0 scram-sha-256
-- Verify a connection is actually using SSL
SELECT ssl, client_addr FROM pg_stat_ssl
JOIN pg_stat_activity USING (pid);Least-Privilege Access: The Control Everyone Fails First
The single most common finding in a database security review is a shared superuser or root credential used by multiple people and multiple applications, because it was simpler to set up once than to provision individual, scoped accounts. This fails every relevant compliance requirement at once: there's no way to attribute an action to an individual, no way to revoke one person's access without breaking everyone else's, and no limit on the blast radius if that one credential leaks. The fix is role-based access with per-person or per-service accounts, scoped to exactly the schemas and operations each one requires — a reporting service gets SELECT on specific views, not superuser on the whole database.
This is more setup work upfront and genuinely worth it: when someone leaves the team, revoking their individual account doesn't require rotating a credential every other service also depends on.
-- Scoped role instead of superuser for a reporting service
CREATE ROLE reporting_service WITH LOGIN PASSWORD '...';
GRANT CONNECT ON DATABASE analytics TO reporting_service;
GRANT USAGE ON SCHEMA reports TO reporting_service;
GRANT SELECT ON ALL TABLES IN SCHEMA reports TO reporting_service;
-- No INSERT, UPDATE, DELETE, or access to other schemasStill Piecing This Together Yourself?
A senior engineer looks at your actual setup, not a generic checklist, and tells you exactly what's wrong and how to fix it.
Book a Diagnostic CallAudit Logging That Actually Answers 'Who Did What'
Audit logging that's technically enabled but never reviewed provides almost none of the security value it appears to on paper — it satisfies a checkbox but not the actual incident-response need. A useful audit log captures, at minimum, authentication events (successful and failed), schema changes (DDL), and access to sensitive tables, with enough detail to answer who performed an action, from where, and when, without requiring a database engineer to reconstruct it from raw query logs after the fact. The practical gap we see most: logs are being written, but nobody has a process to review them regularly or alert on suspicious patterns — a spike in failed authentication attempts, an account querying a sensitive table it's never touched before.
Ship these logs to a system separate from the database itself, so a compromised database credential can't also be used to delete the evidence of what it was used for.
Get a Straight Answer, Not a Sales Pitch
Tell us what you're running into. We'll tell you directly what's causing it and what it takes to fix, before you sign anything.
Contact UsData Minimization and Retention
A field a compliance framework requires you to protect is far simpler to protect if you don't have more of it than necessary sitting around indefinitely. Data minimization — collecting and retaining only what's actually needed, for only as long as it's needed — reduces the blast radius of any future breach and directly satisfies GDPR's storage limitation principle and similar provisions elsewhere. In practice: define retention periods for sensitive columns explicitly, automate deletion or anonymization once that period passes rather than relying on someone remembering to run a manual cleanup, and be honest about whether a field genuinely needs to exist in production at all versus being movable to a more restricted, separately-audited store.
Database security compliance is rarely won or lost on an exotic technical control — it comes down to whether encryption actually covers every backup and replica, whether access is scoped per-person instead of shared, and whether the audit log is something anyone actually looks at. These are checkable, fixable gaps, not research problems. The teams that pass an audit smoothly are the ones that treated these as ongoing operational discipline rather than a scramble the week before the auditor arrives — and the ones that fail almost always fail on the same handful of findings: a shared credential, an unencrypted backup, or a log nobody reviews.
Frequently Asked Questions
Does enabling encryption at rest on RDS make my database compliant?
It's a necessary control, not a complete one. Encryption at rest needs to extend to backups, snapshots, and read replicas — not just the primary instance — and should use a key your organization controls. Compliance also requires access control, audit logging, and other controls beyond encryption alone.
What's the most common database security finding in an audit?
A shared superuser or root database credential used across multiple people or services. It fails least-privilege requirements outright, since there's no way to attribute actions to an individual or revoke one person's access without breaking every other service that shares the same credential.
Is TLS required for internal database connections, not just external ones?
Yes, for compliance purposes and for real security. Internal networks are where lateral movement happens after almost any other compromise, so an unencrypted internal connection is a genuine gap, not a theoretical one — replication traffic and internal admin/backup connections should be encrypted the same as application traffic.
How long should database audit logs be retained?
This depends on your specific compliance framework — SOC 2, HIPAA, and PCI DSS specify different minimums, commonly one year or more. Beyond the minimum retention period, the log also needs to be shipped somewhere separate from the database itself so a compromised database credential can't be used to delete the evidence of its own misuse.
Get a Straight Answer on Your Setup
Tell us what you're running into. We read every message personally and reply within 24 hours with times for a free call.

