How US privacy laws change your systems
The California Consumer Privacy Act and California Privacy Rights Act (CCPA/CPRA) is California’s privacy law: the California Consumer Privacy Act, as amended by the California Privacy Rights Act. The California Privacy Protection Agency (CPPA) and the California Attorney General enforce it. Many states have since passed similar laws, including Virginia, Colorado, Connecticut and Texas.
For engineers, these laws are more than a privacy notice on a website. They change how you design database tables, caches, logs, third-party software development kits (SDKs) and encryption keys.
You can no longer dump raw JavaScript Object Notation (JSON) into a document store or send every user event to every analytics vendor. Collect only the data you need. Use it only for the reason you gave. Honor opt-out signals, and delete data when people ask. Health Insurance Portability and Accountability Act (HIPAA), Gramm-Leach-Bliley Act (GLBA) and state breach-notification laws add their own rules on top.
Sort your data into four tiers
Before you write a single migration, sort your data into four tiers. Each tier gets its own storage controls:
- Restricted: Sensitive personal information as the CPRA defines it, such as Social Security numbers, account logins, precise location, and biometric and health data. Payment card data belongs here too. Use field-level envelope encryption, separate customer-managed hardware security module (HSM) keys, and sign-off from more than one person.
- Confidential: Other personal information, such as names, contact details, home addresses and payroll records. Use column-level encryption, and mask the data in test and staging systems.
- Internal: Logs, vendor contracts, system designs and internal metrics. Encrypt the storage at rest (AES-256).
- Public: Marketing material, published white papers and press releases.
Keep a log of every consent choice
People can opt out of the sale or sharing of their data. They can limit how you use sensitive personal information. Their browser can also send a Global Privacy Control (GPC) signal, and you must honor it. A single opted_out flag on a users table cannot show what changed or when. Live systems need a log that you only ever add to:
-- Append-only privacy preference ledger
CREATE TABLE user_privacy_preference_ledger (
event_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
user_id UUID NOT NULL REFERENCES users(id) ON DELETE RESTRICT,
purpose_code VARCHAR(64) NOT NULL,
preference VARCHAR(24) NOT NULL CHECK (preference IN ('CONSENT_GRANTED', 'CONSENT_REVOKED', 'OPT_OUT_SALE_SHARE', 'LIMIT_SENSITIVE')),
source VARCHAR(24) NOT NULL DEFAULT 'USER_SETTING', -- or 'GPC_SIGNAL', 'AGENT_REQUEST'
ip_address INET NOT NULL,
user_agent TEXT NOT NULL,
recorded_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
data_retention_deadline TIMESTAMP WITH TIME ZONE NOT NULL
);
CREATE INDEX idx_privacy_user_purpose ON user_privacy_preference_ledger(user_id, purpose_code, recorded_at DESC);
Answer requests to see, fix or delete data
People can ask to see, correct or delete the personal information a business holds about them. Businesses generally have 45 days to respond. Build an automated pipeline that does three things:
- Check who is asking. Then check whether a legal duty to keep the data, such as financial record rules, overrides the deletion.
- Where you cannot delete data from backups that cannot be changed, destroy that person’s encryption key instead. This is called cryptographic erasure.
- Pass each deletion on to caches (Redis), search indexes (Elasticsearch or OpenSearch), message queues (Kafka or RabbitMQ) and the service providers you share data with.
