(no title)
mavster | 4 years ago
"developer gets a great idea - let's push an update to the API as a GET request so we can cache this on the CDN... forgetting that the JWT token is potentially returned in the call. Now, whoever makes the call first gets their JWT token stored for everyone else to load instead when the API call is made."
Ta-da, Klarna.
akamia|4 years ago
When you test features like this or caching a response with a JWT it can be very easy to default to the happy path or ignore the impact of a large volume of concurrent users.
auggierose|4 years ago
Nope. That definitely wasn't an engineer.
dminor|4 years ago
We immediately started getting reports of random products appearing in our customers' shopping carts, as people's sessions got merged with random strangers.
Puts|4 years ago
miohtama|4 years ago
However, one common source for this kind of bugs is to ”cache any URL ending .pdf as a static file” and then you are in fact serving logged in PDFs like customer invoices that come with the session cookie.
I think CloudFlare used to come with a default rule to treat .pdf as a static content. The responses were cached when you hit their ”cache the good stuff” checkbox.
AtNightWeCode|4 years ago
mekkkkkk|4 years ago
darthrupert|4 years ago
jordanbeiber|4 years ago
Manhandled in-house though...
piva00|4 years ago
irjustin|4 years ago
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.
beejiu|4 years ago
chrisrogers|4 years ago
toredash|4 years ago
elamje|4 years ago
A couple of years back, I was making https://lifeboxhq.com which involved users uploading quite a bit of content. I was happily testing security with some url resource enumeration and for some reason, I could non-deterministically access user uploads via url, even on accounts I didn't own. I spent several days looking at my Flask code, javascript, etc. to debug....
I knew it wasn't my code, but I was getting more and more frustrated, then I remembered I set up Cloudflare....
Remember to exclude certain routes from Cloudflare if you want to avoid arbitrary user content from being cached without authentication.
growt|4 years ago
yawaramin|4 years ago
zitterbewegung|4 years ago
unknown|4 years ago
[deleted]
iratewizard|4 years ago
secureleaf|4 years ago
remram|4 years ago