AdvancedBan icon indicating copy to clipboard operation
AdvancedBan copied to clipboard

Race condition between adding new bans and checking if the user is already banned

Open A248 opened this issue 3 years ago • 4 comments

If you are an everyday user, and you try to ban another player twice, AdvancedBan will tell you "this player is already banned." However, since AdvancedBan does not use transactional consistency, this guarantee does not hold solid. If you are somehow able to execute /ban quickly enough twice, you can successfully ban another player twice.

Most humans will not be able to execute commands quickly enough to exercise this race condition. However, there are plenty of other ways to accomplish quick successive commands. One common reason is automated punishment mechanisms - for example, anticheats, which may automatically ban the player using a command.

I think this should be considered a bug, because it makes correctness dependent on execution speed. AdvancedBan is supposed to guarantee that a user cannot be banned twice, right? However, the API does not perform the same "check if the user is already banned," which suggests that AdvancedBan never guaranteed that a user cannot be banned twice. At the very least, this bug should be fixed in the commands, so that AdvancedBan's behavior is no longer subject to execution speed.

A248 avatar Dec 22 '21 13:12 A248

Hey i think there's a slight bug... Where if a ban command is ran more than once in a very short span of time (i mean inhumanely short), it bans the user multiple times.

Why this is a issue? Cuz even if a user can't ban that quick.. an anticheat can. I use ab for the banning... And sometimes it runs the command twice.

Y'all can add a code that says that one person can have only one ban at once. If they have more than one, the one with the longest duration would be kept and rest would be removed. If all have the same duration only one would be working. So that /unban would work.

Yes, trying to unban a user who's been banned more than once means I have to unban them that many times. So even if an error occurs and a user is banned twice of the same duration and reason, ab should combine them or remove the duplicates.

Deeptanil avatar Jan 03 '22 02:01 Deeptanil

You knew about the bug a year ago, but a year later it still exists

KOFTWAR avatar Feb 01 '23 12:02 KOFTWAR

https://github.com/DevLeoko/AdvancedBan/issues/593

KOFTWAR avatar Feb 01 '23 12:02 KOFTWAR

AdvancedBan is open-source, allowing other developers to freely contribute towards AdvancedBan if they wanted. Nobody has decided to contribute as of now.

Hopefuls avatar Feb 01 '23 22:02 Hopefuls