Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Meta Engineering 17 min read Case study mediumAdept

PrivacyLib: Privacy Controls at the Data Access Boundary

PrivacyLib is a common library embedded in the clients of hundreds of Meta data and processing systems that enforces and observes privacy requirements at the point of data access. Each system integrates once by mapping its native APIs to five common operations (read, write, RPC, request entry, inline execution). New requirements then ship as enforcing modules such as Policy Zones or observing modules such as Privacy Probes and Agent Observability, taking days per system instead of months. To sustain billions of checks per second, requirements are compiled at build time, checks are answered from per-request and per-host caches, telemetry is deduplicated with Bloom filters, and signed tokens let ServiceRouter verify raw RPCs that passed client-side checks. A walkthrough shows Logger blocking writes of messaging metadata to tables that lack the right annotation.

Assumes: information flow controlRPC and client librariescaching basics

Related posts

  • How Meta enforces purpose limitation via Privacy Aware Infrastructure at scale

    Meta Engineering mediumAdept

    Meta enforces purpose limitation (data used only for allowed purposes) with Policy Zones, an information flow control system built into HHVM, Presto, Spark and other infrastructure. It replaces fragile point checks and ACL-based physical data separation with runtime checks on annotated data flows. Developers label data assets and requests or functions with annotations. Zones then propagate context through function call stacks or SQL batch jobs and flag violations in logging mode before switching to blocking enforcement. Policy Zone Manager tooling, backed by data lineage and an ML classifier, guides large rollouts through four steps: identify assets, discover downstream flows, remediate each flow (annotate the sink, block it, or reclassify it), and enforce and monitor.

  • Policy Zones: How Meta enforces purpose limitation at scale in batch processing systems

    Meta Engineering mediumAdept

    Meta's Policy Zones, part of its Privacy Aware Infrastructure, applies information flow control to enforce purpose limitation across an exabyte-scale data warehouse. Datasets and loggers carry Governable Data Annotations such as MESSAGING_DATA, and downstream data must be at least as restrictive as its sources. A SQL parser (UPM) turns queries from processors like Presto into semantic trees. A Policy Evaluation Service checks each flow and issues a cryptographically signed token that the Warehouse Permission Service validates at access time. Policy Zone Manager tooling handles label creep through reclassification, letting the system run across millions of datasets, tens of millions of daily flows and trillions of consent checks per hour.

  • How Meta discovers data flows via lineage at scale

    Meta Engineering mediumAdept

    Meta builds a data lineage graph across its web, data warehouse and AI systems to find where sensitive data such as Facebook Dating religion fields flows, so privacy controls like Policy Zones can be applied. Signals come from static code analysis, from Privacy Probes runtime instrumentation, and from SQL analysis of Presto and Spark query logs and AI training configs. Privacy Probes captures sampled source and sink payloads within a request and classifies pairs as a high-confidence match-set (exact or contains match) or a noisier full-set that can include transformed flows. An iterative tool in Policy Zone Manager then walks the graph from sources, with developers or heuristics excluding irrelevant nodes so that whole downstream branches are pruned at once.

  • Scaling Privacy Infrastructure for GenAI Product Innovation

    Meta Engineering easyNovice

    Meta scales its Privacy Aware Infrastructure (PAI) to cover GenAI products such as its AI glasses, using cross-stack data lineage as the foundation for automated privacy enforcement. Lineage signals are collected from web privacy probes, logger-to-warehouse flows, parsed SQL and batch-processing logs, RPC boundaries for LLM inference calls, and training manifests, then stitched into an end-to-end graph. A shared library, PrivacyLib, links reads to writes through a common correlation key across languages and data systems. The resulting lineage guides where Policy Zones are placed and blocks training jobs on data not permitted for that purpose, while verifiers continuously watch flow edges to catch new or changed processing early.

  • How Meta understands data at scale

    Meta Engineering mediumAdept

    Meta's Privacy Aware Infrastructure builds data understanding by schematizing every data asset in a canonical Thrift-based format (DataSchema, covering over 100 million schemas across 100+ systems) and annotating fields with a universal privacy taxonomy of semantic types. Annotation is shifted left into developer workflows. A classification pipeline of scheduling, sampling, scanning, heuristics and ML models predicts labels, auto-assigns them above a confidence threshold, and propagates them along lineage so copies inherit equivalent classifications. A Facebook Dating religious-views walkthrough shows how schema, annotation and OneCatalog inventory let purpose-limitation controls follow sensitive data across heterogeneous systems.

The quest for software engineering knowledge.

Look:
Layout: