Mitigating a token-length side-channel attack in our AI products
Mar 14, 2024Celso Martinho, Michelle Chen

Summary
Implemented a mitigation for a token-length side-channel attack affecting streaming AI responses by adding a 'p' property with a variable-length random string to JSON objects in streaming responses. This obfuscates the actual token length, preventing attackers from inferring information from network packet lengths. This mitigation is applied automatically to both Workers AI and AI Gateway.
More from the Artificial Intelligence Integration & Impact trail
- Introducing Clef-omni with full multimodality, plus a faster Clef and a cheaper Clef-flash
- Introducing Web Search API via AI Gateway
- Introducing Clef: our open-source decision models, and new RL fine-tuning platform
- One year later: Sovereign AI and the fight for choice
- AI Search is now generally available