News for hackers. Stuff that matters.
Re:Klarna users are being signed in to random accounts by irjustin on Thursday May 27, 2021 @11:23AM (#27304192)
I can 100% see this being the cause if this comes out as the root.

But... API's really shouldn't be cached? At least not at the CDN level. The risk of serving up stale dashboard data alone makes users go ????... and we definitely don't want - not even mentioning the problem here, that's crazy.

Re:Klarna users are being signed in to random accounts by beejiu on Thursday May 27, 2021 @04:09PM (#27307674)
100% agree with this. A database is, in some form, a cache of its own. If you have to add additional cache on top, it's an additional source of complexity and risk. If you are building a financial platform, you should DESIGN around this.
Re:Klarna users are being signed in to random accounts by chrisrogers on Thursday May 27, 2021 @12:02PM (#27304609)
Depends on the scope of the API of course, but it's a good rule of thumb for any API with private auth
Re:Klarna users are being signed in to random accounts by toredash on Thursday May 27, 2021 @01:14PM (#27305462)
Of course you can cache it, but your assuming it should never. Nothing wrong with caching API calls on the CDN forever as long as your purge the cache once you need it. Event based purging.
Re:Klarna users are being signed in to random accounts by cowmoo728 on Thursday May 27, 2021 @04:49PM (#27308333)
"There are only two hard things in Computer Science: cache invalidation and naming things."

Cache invalidation is always a very tricky affair. It can work for a while but as complexity grows it gets very hard to maintain and debug. It's very much a "here be dragons" situation and you have to go into it with your guard up.

I was at a small startup that had a quick and dirty contractor built API. It worked, but for our largest customers, 99th percentile latency started going over the API gateway timeout. The quick and dirty hack on top of it was aggressive caching with too-clever invalidation logic. It worked until new features were added and then it started failing dramatically and unpredictably. The bugs were an absolute nightmare. We ended up spending almost a year cleaning up the data model, sharding things by customer, and fixing a bunch of N+1 queries, all so that we could get rid of our API cache layer and kill the bugs for good.