SoloMedium8m

The Network Buffer That Leaked Credit Cards

#security-critical — Alice received Bob's shipping address on her order

CISO: Cross-customer PII leak via use-after-free in C FFI response builder. C called free() on Rust's buffer — allocator reused memory — dangling pointer read another customer's JSON.

The trap: unsafe FFI bypasses the borrow checker. C frees memory Rust still references.

Your task

Fix `SafeResponseBuilder::build_response()` in `response_builder.rs`: pure safe Rust with format!() — no pointers, no unsafe, no FFI.

Book: ownership prevents use-after-free · Prod: Alice's confirmation showed Bob's address — GDPR breach.

Skills you'll prove

rustmemory-safetyuse-after-freeownershipborrow-checkerffisecuritybook-vs-prod

Interview Tip

When asked why Rust for systems programming, say: "Rust's ownership model prevents use-after-free at compile time. I debugged a production incident where a C library called free() on a buffer Rust allocated. The allocator reused the memory for another customer's request — Alice's order confirmation showed Bob's shipping address. In pure safe Rust, this is impossible: the borrow checker ensures references never outlive their data. For FFI, the rule is: establish a clear ownership contract — Rust allocates and frees, C only reads and writes. Never let C code call free() on Rust-allocated memory. The unsafe keyword is a contract: break it and you get the same bugs as C."

Browse freely — sign in when you're ready to open a ticket and prove your skills.