Startup Security

Customer Data Security: How SaaS Companies Protect User Data

How SaaS companies secure customer data with encryption at rest and in transit, access controls, audit logging, data retention policies, and breach notification processes.

March 9, 20268 min readShipSafer Team

Customer Data Security: How SaaS Companies Protect User Data

When a customer hands your SaaS company their data, they're making a trust decision. They're betting that you'll store it securely, share it only with authorized parties, and tell them promptly if something goes wrong. Most SaaS founders understand this abstractly. Fewer have systematically implemented the controls that make it true.

This guide covers the technical and operational mechanisms that enterprise-grade SaaS companies use to protect customer data — not as a compliance checkbox, but as a foundation for the trust that drives retention and expansion.

Encryption at Rest

Data at rest encryption protects stored data from unauthorized access — whether that's a disgruntled employee, a misconfigured storage bucket, or a physical disk that leaves your cloud provider's facility.

Database Encryption

Most managed database services (AWS RDS, Cloud SQL, MongoDB Atlas) enable encryption at rest by default using AES-256. Verify this in your configuration rather than assuming. In AWS RDS:

aws rds describe-db-instances --query 'DBInstances[*].[DBInstanceIdentifier,StorageEncrypted]'

Default encryption protects against disk-level access but doesn't protect against application-layer access. If an attacker compromises your application's database credentials, encryption at rest is irrelevant — they're accessing data through the authorized application path.

Field-Level Encryption

For the most sensitive data — Social Security numbers, credit card numbers, health identifiers, private keys — encrypt at the field level before storing in the database. This means the database stores ciphertext, and only the application with access to the encryption key can read the plaintext.

import { createCipheriv, createDecipheriv, randomBytes } from 'crypto';

function encryptField(plaintext: string, keyId: string): string {
  const key = getEncryptionKey(keyId); // Retrieve from key management service
  const iv = randomBytes(16);
  const cipher = createCipheriv('aes-256-gcm', key, iv);
  const encrypted = Buffer.concat([cipher.update(plaintext, 'utf8'), cipher.final()]);
  const authTag = cipher.getAuthTag();
  // Store: iv + authTag + ciphertext, with keyId for rotation support
  return `${keyId}:${iv.toString('hex')}:${authTag.toString('hex')}:${encrypted.toString('hex')}`;
}

Use a managed key management service (AWS KMS, Google Cloud KMS, HashiCorp Vault) rather than managing encryption keys directly. Key management is a specialized discipline — rolling your own key storage creates more risk than it eliminates.

File and Object Storage

S3 buckets and GCS buckets should enforce server-side encryption and block all public access. A misconfigured public S3 bucket remains one of the most common causes of large-scale data exposure.

// AWS S3 bucket policy — block public access
{
  "Version": "2012-10-17",
  "Statement": [{
    "Effect": "Deny",
    "Principal": "*",
    "Action": "s3:GetObject",
    "Resource": "arn:aws:s3:::your-bucket/*",
    "Condition": {
      "StringNotEquals": {
        "aws:PrincipalOrgID": "o-your-org-id"
      }
    }
  }]
}

Enable S3 Block Public Access at the account level, not just the bucket level, to prevent accidental misconfiguration by any team member.

Encryption in Transit

TLS 1.2 is the minimum; TLS 1.3 should be the default for all new deployments. TLS in transit protects data moving between the user's browser and your servers, between your services, and between your services and third-party APIs.

Common gaps in transit encryption:

  • Internal service-to-service communication using HTTP rather than HTTPS — common in microservice architectures where teams assume internal network traffic is safe
  • Database connections without TLS — many ORMs don't enforce TLS by default
  • Third-party webhook endpoints that accept HTTP (your outbound webhook calls should verify the destination supports HTTPS)
  • SMTP email delivery without STARTTLS

Enable HSTS (HTTP Strict Transport Security) to prevent protocol downgrade attacks:

Strict-Transport-Security: max-age=31536000; includeSubDomains; preload

Certificate management is an operational discipline. Expired certificates cause outages and erode trust. Automate certificate renewal with Let's Encrypt, AWS Certificate Manager, or Google-managed certificates — do not manage certificate renewal manually.

Access Controls

Principle of Least Privilege

Every service, employee, and system component should have access to exactly what it needs to function — no more. This is easy to say and hard to maintain as systems grow. Implement it operationally:

  • Use separate database users with distinct permissions for each service (read-only replicas for analytics services, write access only for the services that need it)
  • Use IAM roles rather than long-lived access keys for AWS service access
  • Audit service account permissions quarterly — permissions accumulate over time as systems evolve

Employee Access to Customer Data

Define and enforce a policy for which employees can access customer data, under what circumstances, and with what approval process. The default should be no access — support engineers should access specific customer records only when working a customer-initiated support request, and that access should be logged.

Consider implementing just-in-time access for production data: employees request temporary, scoped access through a system that logs the request, auto-approves based on role, and automatically revokes after a defined window. Teleport, Boundary, and StrongDM are common tools for this pattern.

Customer-Facing Access Controls

Give customers the controls they need to manage their own security posture:

  • Role-based access within accounts: Not every user in an organization should have admin access
  • SSO/SAML integration: Enterprise customers need to enforce their own access policies through their identity provider
  • API key management: Keys should be rotatable, scopeable by permission level, and revocable individually
  • Session management: Allow customers to view and revoke active sessions

These aren't premium features — they're table stakes for enterprise SaaS.

Audit Logs

Audit logs answer the question: "Who did what to which data, and when?" They're essential for incident investigation, compliance (SOC2 CC7, HIPAA), and customer trust.

What to log:

  • Authentication events (login, logout, MFA challenges, failed attempts)
  • Authorization events (access granted, access denied)
  • Data access for sensitive resources (who viewed which customer record)
  • Data modification (create, update, delete operations on customer data)
  • Administrative actions (user provisioning, permission changes, configuration changes)
  • API access (which API key accessed which endpoints)

Log format requirements:

Every log entry should include: timestamp (UTC, millisecond precision), actor identity (user ID and IP), action, target resource, outcome (success/failure), and session or request ID for correlation.

Retention and tamper-evidence:

Audit logs should be retained for at least 12 months (SOC2 requires evidence of controls over time) and stored in a location that application code cannot modify or delete. Write audit logs to a separate, write-only log store — not the same database your application reads and writes.

Customer-facing audit logs:

Enterprise customers increasingly expect access to their own audit trail. Providing a customer-accessible audit log of actions within their account reduces support requests ("who deleted this record?") and demonstrates security maturity.

Data Retention and Deletion

Data you don't have can't be breached. A thoughtful data retention policy reduces your liability and your storage costs simultaneously.

Define retention periods for each data category:

Data CategoryRetention PeriodDeletion Trigger
Active customer dataDuration of contract + 30 daysAccount cancellation
Deleted customer records30 days (soft delete)Permanent purge after 30 days
Audit logs12 monthsAutomatic expiry
Backup data90 daysAutomatic expiry
Support tickets3 yearsManual review

Implement deletion as a technical process, not a manual one. When a customer cancels, their deletion should be triggered automatically, executed across all storage systems (primary database, backups, search indexes, analytics warehouses, third-party integrations), and logged with confirmation.

GDPR and CCPA both create individual deletion rights. If a customer submits a deletion request, you need to be able to find and delete all their personal data across your full data footprint — including data you've shared with third-party processors.

Breach Notification Readiness

GDPR requires notification to supervisory authorities within 72 hours of discovering a personal data breach. Many US state laws have similar requirements. Being "ready to notify" means having a process defined before an incident occurs.

Your breach response plan should include:

  • Detection: How will you know a breach occurred? (Log monitoring, anomaly detection, external reports)
  • Assessment: What data was exposed? How many customers are affected? What's the likely impact?
  • Notification: Who do you notify first — legal, security, leadership? What's the chain of communication? Who drafts customer notification language?
  • Regulatory notification: Which jurisdictions apply? What are the notification timelines and templates?

Waiting until a breach to figure out your notification process is exactly the wrong time to do it. Run a tabletop exercise annually where your team simulates discovering a breach and traces the response from detection through customer notification.

Customer data security is not a product feature or a compliance artifact — it's the operational commitment that makes the trust relationship between you and your customers real.

Check Your Security Score — Free

See exactly how your domain scores on DMARC, TLS, HTTP headers, and 25+ other automated security checks in under 60 seconds.