Delivered remotely for a business based in Paris, France. Names withheld by agreement.
Project Overview
Sensitive data rarely exits an organization through one single dramatic breach. More often, tax identifiers appear inside shared spreadsheet exports, cloud access tokens land in public repository commits, and customer IBAN lists get pasted into external collaboration threads. Traditional perimeter proxies inspect only network egress packets, remaining blind to cloud-to-cloud shares and SaaS file permissions.
Working alongside security engineering stakeholders in Paris, we built an enterprise data leak detection platform using Python, Apache Kafka, and Elasticsearch. The software ingests change streams from object storage, version control systems, and messaging platforms, evaluates payloads with low-noise validators, and surfaces redacted forensic timelines through a web console and REST API.
Enterprise Visibility Gaps
Data governance teams operating across hybrid cloud estates ran into four persistent obstacles:
- Noisy naive pattern matching: Bare regular expressions flagged harmless build hashes, mock fixtures, and invoice numbers as critical leaks, burying genuine incidents.
- Burst ingestion drops: Bulk repository migrations or directory permission updates overwhelmed synchronous webhook endpoints, silently losing audit coverage.
- Secondary data exposure risk: Storing full matched payloads inside security logs turned the monitoring tool itself into an unencrypted vault of PII and API credentials.
- Fragmented connector coverage: Separate point tools for Git commits, cloud buckets, and chat channels prevented analysts from tracing whether the same secret leaked across multiple surfaces.
Architectural Strategy
We designed the system around zero-retention inspection and partitioned event streaming. Data connectors never push raw secrets into long-term logs; instead, Kafka acts as a durable shock absorber feeding stateless Python scanners that emit only masked evidence and structural digests.
Connectors normalize incoming events—object creations, git diffs, chat attachments—into a canonical envelope before publishing to partitioned Kafka topics keyed by tenant and source asset. Python consumer groups pull events, verify content hashes against Redis to skip unmodified files, run multi-stage validators, and index sanitized alert documents into Elasticsearch while persisting rule configurations and remediation workflows in PostgreSQL.
Core Capabilities
- Context-Aware Secret & PII Scanners: Combines format regexes, mathematical checksums (Luhn, IBAN, French NIR/SSN structures), entropy scoring, and proximity keyword windows.
- Multi-Source Connector Ingestion: Accepts streaming webhooks and scheduled delta crawls from cloud buckets, code repositories, ticketing tools, and enterprise chat workspaces.
- Redacted Evidence Indexing: Masks sensitive tokens prior to storage while retaining surrounding line context, actor attribution, and file paths for rapid verification.
- Policy-as-Code Rule Engine: Lets compliance officers scope sensitivity thresholds by business unit, repository visibility, or external share status without redeploying workers.
- Automated Quarantine & Webhooks: Dispatches instant notifications to secret-revocation pipelines, repo owners, or SIEM collectors when critical credentials surface publicly.
Technical Architecture
Ingestion separates lightweight HTTP webhook termination from heavy extraction and classification. FastAPI validates connector signatures and writes compact event pointers onto Kafka topics, allowing Python consumer pools to scale independently across text extraction, OCR fallback, and rule evaluation stages.
Flow: SaaS & Cloud Connectors (FastAPI) → Partitioned Kafka Topics → Redis Hash Deduplicator → Python Extraction & Streaming Chunk Scanner → Checksum / Entropy / Context Evaluators → Masked Payload Formatter → Elasticsearch Forensic Index & PostgreSQL Case State → React Governance Console
Splitting Elasticsearch and PostgreSQL responsibilities keeps forensic search sharp without sacrificing transactional integrity. Elasticsearch serves sub-second faceted queries across millions of historical scan events, while PostgreSQL coordinates incident assignments, false-positive allowlist hashes, and role-based access controls.
Technology Stack
| Category | Technology detail |
|---|---|
| Event Backbone | Apache Kafka buffering high-volume file, commit, and message change events |
| Inspection Workers | Python consumer services running checksum, entropy, and NLP entity classifiers |
| Forensic Search | Elasticsearch indexing redacted match context, policy tags, and actor timelines |
| Policy Store | PostgreSQL managing detection rules, severity matrices, and suppression lists |
| Deduplication Cache | Redis storing content hashes and file fingerprint states to skip unchanged blobs |
| Ingestion API | FastAPI accepting webhook payloads from SaaS suites, code hosts, and cloud buckets |
| Governance UI | React console for policy authoring, incident assignment, and redaction-safe review |
| Container Runtime | Docker worker pools scaling consumer partitions independently per connector |
| Alert Connectors | Signed webhook dispatchers triggering Slack notifications, ticket creation, or quarantines |
Engineering Trade-offs & Solutions
| Engineering Challenge | Solution & Trade-off |
|---|---|
| Re-scanning large repositories on every minor push wastes CPU cycles | Implemented SHA-256 blob and diff-hunk caching in Redis so Python workers inspect only newly introduced lines; requires careful cache invalidation when policy rules change. |
| Large text files split into fixed chunks can sever multi-character secrets at boundaries | Used overlapping sliding-window buffers during streaming reads, adding minor boundary re-evaluation overhead to eliminate missed split tokens. |
| Storing exact matched strings aids verification but creates GDPR liability | Replaced raw values with deterministic masked snippets and salted HMAC digests in Elasticsearch; analysts verify structure without exposing full plaintext secrets. |
| High-cardinality regex sets slow Python scanning on dense minified JavaScript | Added pre-filter token heuristics and Aho-Corasick prefix checks before executing expensive validators, trading memory footprint for steady worker throughput. |
Security & Privacy Safeguards
Operating under strict European GDPR expectations meant minimizing sensitive data residency at every stage. Connectors fetch transient payloads over mTLS or signed short-lived credentials into volatile worker memory, immediately discarding plaintext buffers once classification finishes.
Salted HMAC-SHA256 digests allow the React console to correlate repeated leaks of the same API key across different teams without ever persisting the underlying credential. Role-based access controls enforced via PostgreSQL separate policy authors from incident reviewers, and every suppression or whitelist action writes an immutable audit trail.
Performance & Stream Scalability
Enterprise data activity fluctuates violently during automated CI builds, backup rotations, and quarterly reporting cycles. Partitioning Kafka topics by organization and connector source preserves ordering per asset while letting Dockerized Python consumer groups scale horizontally whenever consumer lag climbs.
Elasticsearch indices roll over automatically on time-and-size policies using warm/cold lifecycle tiers, keeping recent incident investigations snappy while compressing older audit metadata. Backpressure protections route oversized archive attachments onto dedicated slow-lane Kafka topics so multi-hundred-megabyte exports never stall real-time secret detection on Git pushes.
Operational Outcomes
Unifying disparate cloud and engineering streams under one zero-retention inspection pipeline reshaped how security and privacy teams respond to exposure risks:
- Dramatically cleaner alert queues: Checksum, entropy, and proximity corroboration suppressed noisy false alarms so analysts focus on genuine credential and PII leaks.
- Safe forensic auditing: Redacted evidence views and salted digests let investigators confirm exposure scope without creating risky plaintext copies of customer records.
- Resilient burst absorption: Kafka buffering eliminated webhook drops during bulk code migrations and directory permission sweeps.
- Cross-channel incident correlation: Unified Elasticsearch timelines reveal when a leaked credential travels from a chat channel into a repository or external share.