mirror of
https://github.com/antonkomarev/github-profile-views-counter.git
synced 2026-05-14 11:51:42 -04:00
Race condition vulnerability causes counter reset #44
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Brikaa on GitHub (Sep 2, 2023).
A user's counter can be reset by spamming requests, this happens due to a race condition while truncating and writing to a file. The following NodeJS script can be used to reset a user's counter:
Run it as
and observe the counter, it will reset at a certain point in time.
Here is an explanation of the race condition that happens according to my understanding:
Requests need to do the following:
The following race can happen between two requests (A and B):
This can be fixed by using a lock on the
views-countfile or by migrating to using a database management system that automatically handles concurrency issues.