2019-01-05
This post explores Privacy Pass, a protocol which "lets users prove their identity across multiple sites anonymously without enabling tracking". We will go through the protocol components and eventually see a fully-compatible implementation of Privacy Pass in Rust.
Privacy for users in the internet is often advocated for, and just as often, compromised. This happens for good reasons - creating social networks (i.e., Facebook), allowing smarter usage of our data (i.e., Gmail), convenience of usage (i.e., OAuth - "Login using Google"), Security (i.e., Cloudflare's HTTPS-for-every-site and Denial-of-Service protection) and many other reasons.
The privacy loss is usually not absolute - it allows privacy against some adversaries. For example, while Facebook has access to your personal data, it takes the responsibility of not exposing it to other users, and does it pretty well.
It makes me glad when these services which potentially compromise privacy also take additional steps to re-introduce it in creative ways.
One of the companies whose trade-offs I like is Cloudflare. I've been using their service for many years to easily introduce HTTPS to my websites without having to go through the usual complex processes of obtaining and managing an HTTPS certificate.
A few weeks ago, Cloudflare had a Crypto Week, where each day they posted about newly-developed features, who use cryptography to improve their services, in aspects such as privacy.
Although not part of the Crypto Week, this exposed me to a protocol Cloudflare supports since 2017 - Privacy Pass. This protocol has been developed in collboration with academic researchers and is provided as a service by Cloudflare.
The Privacy Pass protocol, as implemented in Cloudflare, attempts solving the following tension:
Cloudflare would like to give access to websites to humans rather than, let's say, mal-intentioned bots. To do that, Cloudflare requires users to solve a CAPTCHA when they have suspicion. On the one hand, these challenges protect the websites - no non-humans may access the site. On the other hand, false-positives cause inconvenience to users. That puts the burden on Cloudflare to improve their human-detection capbalities without compromising on security too much.
This is where Privacy Pass comes in. It allows a user to solve a CAPTCHA once and use this "proof-of-humanity" later on.
Rather than outlying the protocol directly, I'd like to build it step-by-step, to highlight the importance of each of the components in the protocol, and why stopping at that level might not be enough.
Methodology-wise, I believe the best way to understand a topic is being able to teach it. In teaching, there are multiple levels. Two of these are teaching another human (outlying the theory, proofs, math) and teaching a machine (implementing it so it can be used).
While teaching another human is highly valuable, some aspects are more readily exposed and understood when teaching a machine. This is one of the reasons I've chosen to implement Privacy Pass in Rust - in this way I could see the nitty-gritty details of how Cloudflare and the researchers made Privacy Pass work in practice.