Tier9AI logoTier9AI

Chapter 04

Security and Compliance for Customer-Facing AI

Build a practical baseline for SOC 2 readiness, GDPR and HIPAA scoping, PII handling, encryption, and useful audit logs.

Peter Olson

9 min read

Security controls and compliance claims are related, but they are not interchangeable. Encryption does not make a product GDPR-compliant. A policy folder does not produce a SOC 2 report. Using a cloud service that supports HIPAA workloads does not, by itself, make a particular workflow compliant with HIPAA.

The practical starting point is to understand which data enters the system, why it is needed, where it travels, who can access it, and how evidence of those controls will be produced. Legal counsel, qualified auditors, and customer requirements determine the final obligations; an engineering baseline makes those conversations concrete.

Scope the frameworks accurately

SOC 2 is an AICPA examination and reporting framework over controls relevant to selected Trust Services Criteria. Organizations commonly say “SOC 2 compliant,” but more precise language identifies whether an independent Type 1 or Type 2 report exists, its scope, and its period. Do not claim certification or coverage that has not been independently established.

The GDPR applies to processing personal data within its territorial scope and distinguishes roles such as controller and processor. Map lawful purpose, data-subject rights, retention, subprocessors, international transfers, and incident duties with appropriate counsel. Pseudonymized data can remain personal data when it can be attributed using additional information.

HIPAA applies to covered entities and business associates handling protected health information in covered activities. Determine whether the product is in scope, sign required agreements, and perform the required risk analysis. The current Security Rule describes some implementation specifications, including encryption, as addressable and risk-based; “addressable” does not mean optional without analysis and documentation.

Inventory and minimize sensitive data

Create a living data-flow map covering browser or client, API, queues, model providers, databases, vector stores, logs, analytics, backups, and support tools. Label personal data, protected health information, credentials, financial data, customer confidential information, and derived artifacts such as embeddings or summaries.

When customer documents feed retrieval, extend this map through the permission-aware RAG pipeline.

Minimize before securing. If a workflow does not need a Social Security number, do not ingest it. If an identifier is needed only during a transaction, do not keep it indefinitely. Define retention and deletion behavior for the source, chunks, embeddings, caches, logs, exports, and backups.

PII redaction should happen before data reaches broadly accessible logs, analytics, or prompts that do not require it. Use deterministic rules for known fields and tested detection for free text. Keep a review path for false positives and negatives. Redaction is a risk-reduction control, not proof that a dataset is anonymous.

Encrypt data and control the keys

Use current TLS configurations for data in transit, validate certificates, and encrypt service-to-service traffic where the threat model requires it. Encrypt sensitive data at rest in databases, object stores, disks, and backups. Managed encryption defaults help, but teams still need to understand key ownership, access policy, rotation, recovery, and what application-layer copies exist.

Keep secrets out of source code, container images, client bundles, and ordinary logs. Use a managed secret store and short-lived workload credentials where possible. Separate production and non-production keys and data. A copied production dataset can defeat otherwise careful environment isolation.

Make audit logs answer real questions

An audit trail should identify the actor or workload, tenant, action, target, result, timestamp, and request or trace ID. Record administrative changes, permission changes, data exports, sensitive reads, integration connections, model or prompt configuration changes, and break-glass access.

Protect logs from casual modification, restrict access, synchronize time, and define retention. Avoid logging raw prompts or responses by default; they can contain the data the audit system is meant to protect. Test whether an investigator can reconstruct a representative event from the evidence.

Common failure modes

  • Claiming SOC 2 certification when the organization has no applicable report.
  • Treating all AI data as harmless because direct names were removed.
  • Sending full customer records to a model when a few fields would suffice.
  • Encrypting storage while exposing data through overbroad application roles.
  • Logging prompts, tokens, health data, or credentials in plaintext.
  • Buying a “compliant” vendor plan without configuring and operating the workflow appropriately.
  • Writing policies that do not match deployed systems or daily practice.

Implementation checklist

  • Identify applicable legal, contractual, and audit requirements with qualified advisors.
  • Maintain a data inventory, system boundary, and subprocessor list.
  • Classify data and document purpose, retention, deletion, and access rules.
  • Redact sensitive values before unnecessary logging, analytics, or model use.
  • Enforce least privilege and review administrative access.
  • Configure encryption in transit and at rest with managed key procedures.
  • Produce protected, searchable audit events for sensitive actions.
  • Test incident response, deletion, restoration, and access-review procedures.
  • Review every public compliance statement against current evidence.

Measurable signals

Useful measures include data stores inventoried, sensitive fields with defined retention, encryption coverage, secrets rotated on schedule, access reviews completed, high-risk actions represented in audit logs, deletion requests completed within the applicable target, critical vulnerabilities past due, and incident exercises completed. These are operational signals; none alone proves compliance.

Further reading