Skip to main content
Blog6 min read

The “Right to be Forgotten” Nightmare: Engineering Hard-Deletes in Event-Sourced Systems

Datronix · September 2026 · 6 min read

GDPR Event Sourcing

Here is the technical roadmap for bridging the gap between immutable logs and compliance, focusing on the industry standard for GDPR event sourcing: Cryptographic Erasure.

It’s 4:00 PM on a Friday. Your legal team forwards you a standard GDPR “Right to Erasure” request from a user in Berlin.

In a traditional CRUD (Create, Read, Update, Delete) application, you would run a simple DELETE FROM users WHERE id = 123 script, wipe your hands, and go home.

But your team didn’t build a traditional CRUD app. You built an enterprise-grade, immutable Event-Sourced System backed by Apache Kafka or an Event Store.

In an event-sourced architecture, state is not updated; it is appended. History is sacred. Events like UserCreated, AddressUpdated, and OrderPlaced are written into an immutable log that, by definition, cannot be altered or deleted.

Suddenly, you are trapped in a regulatory paradox: Your architecture demands that you never forget anything, but European law demands that you forget specific users completely.

For Data Engineers and CTOs in highly regulated sectors like Fintech, Health-tech, or Global SaaS, failing to resolve this tension can lead to catastrophic fines (up to €20 million or 4% of global revenue, whichever is higher).

Why the “Soft Delete” is Legally Insufficient

When engineers first encounter this problem, the knee-jerk reaction is the “Soft Delete.”

They append a new event: UserAnonymized { userId: 123 }. They then update their read models (projections) to ignore any data associated with userId: 123. The user effectively disappears from the UI and active databases.

The Problem: The underlying Personal Identifiable Information (PII) the email, the IP address, the physical address still exists in the historical event log. If a developer replays the event stream from scratch to rebuild a projection, that PII is loaded back into memory.

According to the strict definitions of GDPR Article 17, simply hiding data is not enough. The data must be demonstrably eradicated.

(Note: We frequently encounter similar regulatory compliance issues when auditing complex integration workflows, such as when teams attempt to automate lead capture from Brevo to Google Sheets without proper data masking).

The Nuclear Option: Rewriting the Log

If you absolutely must physically delete the data, some event stores allow you to “scrub” or rewrite the historical log. In Kafka, you might use tombstone messages (e.g., key=userId, value=null) in compacted topics to mark logical deletion.

However, rewriting or relying solely on log compaction in an immutable log is generally considered an architectural anti-pattern for strict compliance:

  1. Complexity: Finding every instance of a user’s PII scattered across millions of domain events (e.g., inside an InvoiceGenerated event) is incredibly difficult.
  2. Integrity Loss: Modifying historical events breaks cryptographic signatures and audit trails, destroying the primary benefit of event sourcing.
  3. No Timing Guarantees: Log compaction eventually removes older records, but there are no strict guarantees on timing. Furthermore, replicas, backups, and downstream consumers may still retain persistent copies of the data.

There is a much better way.

The Solution: Crypto-Shredding (Cryptographic Erasure)

The most elegant and technically sound approach to GDPR event sourcing compliance is Crypto-Shredding (also known as Cryptographic Erasure).

The concept flips the problem upside down: Instead of deleting the data, you delete the ability to read the data.

Here is how the architecture works:

Step 1: Envelope Encryption

When a new user registers, your system generates a unique Data Encryption Key (DEK) specific only to that user.

This DEK is securely stored in a centralized Key Management Service (KMS) like HashiCorp Vault, AWS KMS, or Azure Key Vault, and is itself protected by a Master Key (KEK).

Step 2: Encrypting the Payload

Before publishing a domain event to the event store, your application intercepts any field containing PII (e.g., email, ssn, billingAddress).

The application requests the user’s specific DEK from the KMS, encrypts those specific fields, and then publishes the event.

// The Event Stored in the Log
{
  "eventId": "987-xyz",
  "eventType": "UserRegistered",
  "userId": "123",
  "data": {
    "email": "ENC[abc123encryptedPayload...]",
    "signupDate": "2026-09-19"
  }
}

The non-PII data (like the user ID or the date) remains in plaintext so that aggregate reporting and system logic can still function.

(For systems without native integration, this logic can be built using custom middleware, similar to how we architect custom no-code automation bridges for secure data transfer).

Step 3: The Erasure Request

When the GDPR deletion request arrives, you do not touch the event store. You do not run complex search-and-replace scripts on your Kafka topics.

You simply make a single API call to your KMS to permanently destroy the user’s specific Data Encryption Key (DEK). (Or, if using a proxy like Conduktor Gateway, you tombstone the Encrypted Data Encryption Key (EDEK) in your keys store topic).

Step 4: The Result

Instantly, every single piece of PII associated with that user spread across millions of events, read models, Kafka consumer states, and cold-storage backups becomes cryptographically meaningless ciphertext.

Because the key is destroyed, it is mathematically impossible to recover the plaintext. This satisfies GDPR Article 17 requirements while preserving the architectural integrity of the immutable log.

The Architectural Costs of Crypto-Shredding

While crypto-shredding is the gold standard for compliance, it introduces its own engineering constraints:

  • KMS Latency: Every read and write of PII requires a round-trip to the KMS (or a highly optimized proxy cache) to fetch the decryption key. You must implement aggressive, secure caching strategies to prevent your KMS from becoming a bottleneck.
  • Key Management Scale: If you have 10 million users, you have 10 million keys. You must ensure your KMS is priced and scaled to handle fine-grained envelope encryption.
  • Searchability: You cannot easily run a SQL LIKE query on an encrypted email address. You will need to implement techniques like “Blind Indexing” (storing a keyed hash of the email) if you need to search for users by PII.

Conclusion: Stop Fighting the Architecture

If you are building an event-driven system in 2026, you must design for data deletion from Day 1. Retrofitting GDPR compliance onto an existing event log is a nightmare that usually ends in messy, physical log scrubbing.

By implementing Cryptographic Erasure, you preserve the immutability and auditability of your event-sourced architecture while confidently satisfying the strictest regulatory requirements in the world.

Is your immutable architecture putting you at risk of compliance failure?
👉 Contact Datronix Tech for an Enterprise Architecture Consultation. We specialize in auditing complex data pipelines and implementing secure, KMS-backed crypto-shredding patterns for mid-market and enterprise B2B clients.

Schedule your strategic technical review today and let our senior engineering team future-proof your event streams. (Note: All Datronix Tech B2B service proposals natively include the requisite 18% GST charge, ensuring complete financial transparency).

Share this post:

Related Posts