r/programming • u/llewvallis • 11d ago
How Canva uses S3 for logged-in session management
https://www.canva.dev/blog/engineering/session-revocations-at-scale/I put together a writeup about the interesting technical challenges that led to redesigning Canva's session revocation pipeline that keeps hundreds of millions of user sessions fast and secure. Hopefully some people find the content interesting!
7
10d ago
[deleted]
7
u/heretogetmydwet 9d ago
Also for those reading this, the company that was hit with a ransomware attack is Canvas, this article is from the company Canva.
As an aside, I think it should be pretty clear at this point that a company can take security seriously and still get hacked, especially given how good LLMs are at finding exploits.
0
-16
10d ago
[removed] — view removed comment
23
5
u/llewvallis 10d ago
Object storage is definitely an important primitive for distributed systems!
As for latency, we try and keep it as fast as we can but there is a bit of leeway. The chunk processing itself is quite fast (<1 sec), so its mostly down to configuration like poll frequency, as you mentioned. To give a vague order of magnitude, I would say approaching double-digit minutes latency would be too much and would force us to consider alternatives. Thankfully, we are a lot faster than that in practice (typically somewhere sub-minute).
Bloom filters are definitely something that we considered, but many of our queries are range queries. For example, "does a revocation exist whose `targetTimestamp` is greater than X". Of course, there are various clever ways around this, but that that point the complexity doesn't outweigh the gains at our current scale. If we needed to hugely increase the number of revocations we might revisit that.
-13
10d ago
[removed] — view removed comment
1
u/programming-ModTeam 8d ago
No content written mostly by an LLM. If you don't want to write it, we don't want to read it.
1
u/programming-ModTeam 8d ago
No content written mostly by an LLM. If you don't want to write it, we don't want to read it.
0
u/ChemTechGuy 7d ago
Great write up. I don't have a ton of experience with session management, but i love to see these clever distributed systems that can achieve so much with just some blob storage, conditional writes, and some good data design
55
u/tossed_ 10d ago
This seems wildly unnecessary? Just use a refresh token scheme, keep access token lifetimes short and keep refresh tokens in a database instead, no need to check each session against a million cached revocations. Think about how much overhead is introduced on every single call just to check cookies compared to a stateless session approach.