Skip to content

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

Meta Engineering 5 min read Case study easyNovice

Rust at Scale: An Added Layer of Security for WhatsApp

WhatsApp rewrote its cross-platform media consistency library, wamedia, from C++ to Rust and now ships it to billions of devices and browsers across Android, iOS, Mac, Web and wearables, which Meta calls the largest client-side Rust deployment it knows of. The library began after the 2015 Stagefright bug as a way to reject non-conformant MP4 files before vulnerable OS parsers saw them. It now underpins "Kaleidoscope," a set of checks for malformed structures, risky PDF features, spoofed file types and executables. The Rust version was built in parallel and validated with differential fuzzing. It replaced 160,000 lines of C++ with 90,000 lines of Rust and improved performance and memory use, with binary size and multi-platform build support as the main hurdles.

Assumes: memory safety vulnerabilitiesfile format parsing

Related posts

  • Migrating our Messages API to Rust

    Anthropic Engineering mediumAdept

    Anthropic migrated its production Messages API from Python to Rust, using the live Python service as an oracle because tests were incomplete and the API kept changing. Rust passed about 98% of tests but initially matched only about 24% of production inputs, so they ran the model once and replayed its output to Rust, comparing every pre- and post-model checkpoint piece by piece. Privacy-safe fingerprints grouped differences and dispatched Claude agents to fix them. A partial Rust rewrite of output parsing cut CPU only 8–10% while adding cross-language overhead, so they completed the full rewrite; the Rust API now uses about 70% less CPU per request and cuts median time to first token by about 20%, with no service outage or feature freeze.

  • WebAssembly and Back Again: Fine-Grained Sandboxing in Firefox 95

    Mozilla Hacks mediumAdept

    Firefox 95 ships RLBox, a fine-grained sandboxing technique that compiles third-party C/C++ libraries (Graphite, Hunspell, Ogg, with Expat and Woff2 following in 96) to WebAssembly and then back to native code, so untrusted code runs in-process but cannot jump to unexpected code or touch memory outside its region. This avoids the asynchrony refactoring and memory overhead of process-based isolation, needing only sanitization of values crossing the boundary via RLBox's tainting layer. The production pipeline replaced the Cranelift prototype with wasm2c, translating wasm to C and feeding it back into Clang, which preserves PGO, cross-boundary inlining, crash reporting and debugger support. Mozilla now pays bug bounties for sandbox escapes even without a library vulnerability.

  • Everything Is Broken: Shipping rust-minidump at Mozilla – Part 1

    Mozilla Hacks mediumAdept

    rust-minidump, a pure-Rust replacement for the minidump-processing half of Google Breakpad, has been Firefox's crash-processing backend for six months, running in about half the time of Breakpad and appearing more reliable. Part 1 covers what minidumps are and why Breakpad's permissive, multi-platform C++ parser became painful to maintain. It also explains why stackwalking over corrupted crash state is heuristic and error-prone. The bulk describes the testing strategy built before fuzzing exposed bugs: a synthetic minidump generator that deliberately shares no layout code with the parser, integration tests on real dumps, insta snapshot tests guarding the stable JSON output, and stackwalker unit tests.

  • Life of a Zed Extension: Rust, WIT, Wasm

    Zed mediumAdept

    Zed extensions are written in Rust but never compiled on the user's machine. A CI step in the zed-industries/extensions repository runs a small extensions CLI that compiles each extension's Rust code to a Wasm component targeting wasm32-wasip1 and its Tree-sitter grammars to Wasm. It packages them with Tree-sitter query files into an archive plus a manifest.json, uploads both to S3, and zed.dev mirrors the manifests into a database for the in-editor extension list. The extension API is a hand-written Rust trait layered over types that wit_bindgen generates at compile time from WIT definitions, so the WebAssembly Component Model can pass strings, records and resources like Worktree between the Wasm module and the Zed host.

  • How to build a 30M RPS CDN in 30 days with Rust and WASM

    Railway mediumAdept

    Railway built Hikari, its own CDN with 60 POPs and 180+ nodes, in 30 days. It serves ~1M RPS at peak, has absorbed 30M RPS DDoS attacks, and benchmarks to ~150M RPS. The design centers on safe deployment: a Rust reconciliation-loop sidecar (hikari-keeper) replaces Ansible for node config, BGP announcement and fd-handoff binary upgrades, while per-request business logic runs as versioned wasmtime/WASI guests that can be swapped in seconds without dropping connections. It also covers anycast routing pitfalls with global transit networks, mitigated by BGP community tagging, and a thread-per-core tokio design with thread-local warm guest pools that avoids the ~10μs cold-instantiate cost and cross-core contention.

The quest for software engineering knowledge.

Look:
Layout: