A bug related to handling of authenticated sessions
github.blog
github.blog
If anyone at GitHub is reading this, it would have been nice to see an alert with this info on GitHub's status page, which is the first place I checked to see if it was a known issue.
Since the article mentions session ids returned to the wrong user my first guesses would be
1) something with thread-local storage saving the the auth info in the request handler, and then coroutines or async code that is overwriting that thread-local with info from a new request before the old request has finished.
2) messagequeue based micro service communication that was not properly checking if a received response belongs to the original request and thus returning mismatched data
AFAIK github is written in ruby. Does it even have thread local storage?
> Thread.current[:key] = value
Typically you’d only have one request at a time on each thread though. So your examples feel unlikely. Looking forward to finding out what happened here.
This would be my guess. This sounds like Ruby. But I've seen very similar bugs in Node, where user data is leaked across requests. The issue is typically the developer is using a global variable when they should be using the request context/storage.
In Node there is an insidious brother of this bug as well. It's where the developer is initializing some bit of code (often a 3rd party library, or loading a file) and they are doing it per request when they should be doing it once globally at process startup. It's just about the opposite of the first bug I mentioned. The result is Node leaks memory on every request until it runs out of memory and the process dies. This bug can be an incredible pain in the ass to hunt down.
This means:
* sessions last between 8 and 24+8 hours
* if you log in before 20:00, your session ends that night, if you log in after 20:00 it'll last one more day
* since this is a B2B application users are unlikely to use the application during session expiry
* it's possible to calculate the expiry time during log in and it doesn't require tracking session activity
This approach should have similar security properties as a 24h logout, while minimizing the disruption users experience.
While the application components can handle the load, sometimes the authentication system may not do well when everyone tries to login at the same time
Slack learnt that the hard way recently
My company has the same kind of "problem". A logged out customer might be a lost one. So we try extremely hard to never have to log out people. So when rewriting the app, the store couldn't be touched. When changing authentication provider the old tokens still had to work and be exchanged for a looong time etc.
Edit: Having hardware acceleration disabled doesn't help. :facepalm:
> The underlying bug existed on GitHub.com for a cumulative period of less than two weeks at various times between February 8, 2021 and March 5, 2021.
> There is no indication that other GitHub.com properties or products were affected by this issue, including GitHub Enterprise Server
Github enterprise does not include commit history, and the above two things together make it sound like this bug was in a change that was being slowly rolled out or a/b tested, and that never made it into a github enterprise release.
It's unlikely anyone outside of github can shed light on this one.
> For the very small population of accounts that we know to be affected by this issue, we’ve reached out with additional information and guidance.
So no it's not high. But I'm impressed if they were able to accurately quantify that less than 600 users were impacted by this race condition.
Also each time you login/ token refreshes is probably a new session. So they easily have million's of sessions daily. So in the one month period between 6th Feb and 5 March, you have
**(DAU) * 35* (average sessions / user)** .
So in the ballpark of 10M * 35 * 5 sessions ~ so anywhere between 700-1500 M sessions conservatively . That is in the ballpark of 15,000 users.Also 0.001% is their belief of the impact. I don't see any evidence or statistical model or details supporting the statement.
I am deeply skeptical of this number without knowing the methodology , as you say it would quite impressive to narrow down a race condition to that level.
I wish they could give more detail on this bit.
[1] https://github.blog/2021-02-24-hello-from-githubs-new-chief-...
> Further, this issue could not be intentionally triggered or directed by a malicious user.
Seems unrelated.