Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Join Wave Short-Circuit Protection #280

Merged
merged 4 commits into from
May 6, 2022

Conversation

ShadowJonathan
Copy link
Contributor

@ShadowJonathan ShadowJonathan commented May 2, 2022

This partially addresses #267

This adds JoinWaveShortCircuit, a protection which will set the room to invite-only as soon as X amount of users (default 50) join the room in the last X minutes (default 60).

The protection works with a Bucket, starting the bucket at first join, and only counting users if its been X minutes since the last bucket start.

(The reasoning for this particular approach is likely sensitive (in relation to other protections), so please reach out if you'd like to hear it.)

It has two settings;

  • maxPer, which determines how many users will have to join in the last X minutes before it will trigger the protection.
  • timescaleMinutes, the timescale in X minutes, this determines on what time scale the bot will look at joins.

This adds a status command to the protection, with optional subcommands withExpired and withStart, to debug buckets and/or give more information.

Rationale

This is auto-moderation for a particular problem; Join-spam waves often come when a moderation can be inactive, busy, or otherwise unable to immediately respond. It often fills a room with hundreds of users within a few minutes. This protection is meant to "short-circuit" the wave, and keep it relatively contained for moderators to assess and clean up afterwards.

Usage

Use !mjolnir enable JoinWaveShortCircuit to enable this protection for all your protected rooms.

Then, run !mjolnir verify to make sure the bot has join_rules permissions in all relevant rooms. (Note: due to technical reasons, the bot will currently not check this on startup, #290 tracks this problem)

Tweak with !mjolnir config set JoinWaveShortCircuit.maxPer 50 and JoinWaveShortCircuit.timescaleMinutes 60 to your preference.

@ShadowJonathan
Copy link
Contributor Author

ShadowJonathan commented May 2, 2022

CI is stuck on #281, #282 should fix it. Rebased.

Copy link
Contributor

@Gnuxie Gnuxie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is nice, just a couple of questions though

src/protections/JoinWaveShortCircuit.ts Outdated Show resolved Hide resolved
src/protections/JoinWaveShortCircuit.ts Outdated Show resolved Hide resolved
@rubo77
Copy link

rubo77 commented May 4, 2022

Will we have to manually activate this protection in all rooms? Or will it be added automatically once the bot is updated?

@ShadowJonathan
Copy link
Contributor Author

ShadowJonathan commented May 5, 2022

If this PR gets merged, and a new release includes this, you will have to enable it using !mjolnir enable JoinWaveShortCircuit, then it'll be added to all your protected rooms.

However, you can deploy this early by checking out the PR branch, and building the docker image (if you are using that) yourself. I recommend asking about this in the mjolnir room, though.

@jesopo jesopo self-assigned this May 5, 2022
@jesopo
Copy link
Contributor

jesopo commented May 6, 2022

given this makes no existing tests fail and a protection like this is time-critical, i think i'm going to merge this shortly

@jesopo jesopo merged commit 9fce35c into matrix-org:main May 6, 2022
@ShadowJonathan ShadowJonathan deleted the join-short-circuit branch May 14, 2022 12:31
@turt2live turt2live mentioned this pull request Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants