Repository navigation
feat(antibot): an unban pardons the caller until its evidence is gone - #446
Merged
Merged
Conversation
An unban lifted the ban and forgot its offence, but the watchdogs kept what they had read. A rule that still read the caller guilty banned it again five minutes later (reflagInterval), as a first offence. UnbanPlayer now writes a pardon: a row of antibot.pardons or antibot.account_pardons, with when, the ban it lifted (flags, offence, end) and when the pardon ends. Every pardon is kept. While one runs: - the jury flags nothing on that key, however guilty it reads; - a pardoned caller convicts nobody, not even the accounts it rotates with; - an operator's BanPlayer still bans it. A pardon lasts antiBot.evidence.retention (72h). No evidence outlives retention, so when the pardon ends every reading rests on play after the unban. The evidence is not touched. The bans Record carries the latest pardon, read in the same query and written in the same transaction and lock as the ban. UnbanPlayer and InspectPlayer answer pardoned_until, and the backoffice shows it. Its unban hint no longer says the player is banned again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
An unban lifted the ban and forgot its offence, but the watchdogs kept what they had read. A rule that still read the player guilty banned it again 5 minutes later (
reflagInterval), as a first offence. An unban for "it was a mistake" did not hold, and nothing recorded the decision.What changed
An unban now writes a pardon. It is a row of
antibot.pardons(scope) orantibot.account_pardons(account), with when, the ban it lifted (flags,offence,banned_until) and when the pardon ends (expires_at). Every pardon is kept: one row per decision.While a pardon runs:
Banner.flaggable, checked under the ban's lock);Book.Pardoned, injury.flag). A pardoned accomplice is skipped and the rest of the ring still falls;BanPlayerstill bans the key. The pardon only holds off the jury.A pardon lasts
antiBot.evidence.retention(72h). No evidence outlives retention, so when the pardon ends, every reading rests on play after the unban. The evidence is not touched: forgetting it would take a forget in each of the ten watchdogs.Storage:
bans.Recordcarries the latest pardon.postgres_ban_storereads it in the same query as the ban (aLEFT JOIN LATERAL) and writes it in the same transaction and advisory lock. The adapter upserts the pardon row by(key, pardoned_at); it does not decide anything.API:
UnbanPlayerResponse.pardoned_until(5) andInspectPlayerResponse.pardoned_until(18), both new fields.antibot.PardonandGuard.Pardonare new names in the antibot API.Backoffice: the unban result says "Pardoned until …", the inspection shows a "Pardoned" line while one runs, and the unban hint no longer says the player is banned again on its next click.
For the reviewer
pardonduration in config is easy to add if you want a shorter one.shadowban→bans,Bans→Book).protoc-gen-esversion (1.10.0 and 1.10.1). Each one only adds the two fields.TestAnUnbanLeavesTheEvidenceSoTheJuryBansAgainis replaced byTestAnUnbanPardonsTheCallerUntilTheEvidenceThatBannedItIsGone: after the unban, an hour of the same play bans nothing; 72h later, the same play bans again, as a first offence.Checks
go test -tags testing ./...(the pardon contract runs on the memory store and on postgres),make deadcode,make lint,make check-formatnpm test,npm run lint,npm run build🤖 Generated with Claude Code