Menu

1 / 2

Vary Is Not a Privacy Boundary for Authenticated Responses

DEV Community: security·Ioneyrezende·28 days ago
#44ZgbuMA
#devtosecurity#devto#dev#cache#response
Long article (615 words) — no AI summary yet.
Reading 0:00
15s threshold

Vary Is Not a Privacy Boundary for Authenticated Responses

An HTTP cache can save bandwidth and reduce latency, but it also makes decisions about which request may reuse a stored response. The Vary response header tells caches which request header fields contributed to the response. RFC 9111 requires a cache to avoid reusing a stored response unless the nominated header fields match the original request, or the cache revalidates the response. That is a correctness rule for content negotiation. It is not a promise that a shared cache will protect private data.

A common mistake is to vary on Accept-Encoding or User-Agent while forgetting the cookie or authorization context that produced the body. If a response contains a personalized account panel and the cache key does not include the relevant identity, a second request can receive the first user's body. Adding Vary: Cookie can reduce the risk in some deployments, but it is a blunt instrument.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.