[Mutes] Re-joining guild is nullifying the mute if autorole exist #6329

Closed
opened 2024-03-24 08:18:47 +01:00 by cool-aid-man · 4 comments
cool-aid-man commented 2024-03-24 08:18:47 +01:00 (Migrated from github.com)

What Red version are you using?

3.5.7

Cog name

Mutes

Command name

mute

What did you expect to happen?

This came to our attention when a few users of our server recently were able to re-join the server with no muted - bypassing the mute persistent (when they were muted permanently beforehand)

So I tested it and it turns out, you can actually bypass mute by rejoining a server, in the presence of ANY autorole/joinrole cog - In a system where you set certain role(s) as joinrole which gets added to the user upon joining the server.

So, to answer the question, The expected behavior would be - Persistent Mute over guild Re-Join.
(I know Red already does but it's failing, details are as follows - )

What actually happened?

Findings from the test:

  • It doesn't matter which autorole cog you're using (I tested with 3rd party autoroler cog by dav & autorole by lemon - both verified), when there's autorole + mute, autorole gets 1st priority nullifying the mute on member_join.
  • Both the Mutes & autorole cogs are loaded on the same red instance. There's NO other interference from ANY other bots whatsoever (I made sure of it before testing)
  • It's even happening when the autorole system is present on a completely different 3rd party bot that has no connection with red & the muting is done with red instance. Which is really weird. Same result here - roles that are set as joinrole/autorole gets added to the user but not the mute role.
  • Here's the issue: This could be an underlying red or, dpy issue as this is happening on multiple occasions not entirely restricted to Mutes cog. (For example, if you execute say, 3 commands in one go, with one invoke - then chances are any of the 2 commands won't even get executed in the first place 5 out of 10 times - but this requires its own issue).
  • Audit log (server audit log) says red did add the role. 👇
    image
  • But , in reality, the mute role got removed from the user - logs (from extendedmodlog - by trusty ) support that statement - "The mute role got removed by the bot." Now yes it's true that extendedmodlog guesses the events but still as there's nothing in the server audit log that says otherwise.
    image
    image
    image
  • Here in the SS ^ the 3k role was set as autorole/joinrole through the 3rd party autoroler cog (by dav) | The muted was set on the same bot as well.
  • There's NOTHING else in the guild_audit log that says the mute role was removed in any other way.

How can we reproduce this error?

Test 1 - Mutes and AutoRole Cogs are on the same instance

  1. Load Mutes cog & set a muted role + logs.

  2. Install ANY autorole/joinrole cog and set a test role to be added as autorole - cog that adds a role as soon as a human joins a guild.

  3. Test it in a 3k+ server.

  4. Mute a test-account/user for any duration - enough so it can cover the test duration.

  5. Leave the guild after that - from that user account.

  6. Re-join as the same user.
    You will notice the user doesn't have the mute role anymore, however they will have the autorole.

  • You can install extendedmodlog by trusty (verified) to check further.

Test 2 - Mutes is on the Red instance, Autorole is set to any 3rd party bot.

  1. Load Mutes cog & set a muted role + logs.
  2. Use any 3rd party bot such as carl bot (235148962103951360) - it has a autorole module, set any test role as autorole/joinrole.
  3. Mute a test-account/user for any duration with the Red instance - enough so it can cover the test duration.
  4. Leave the guild after that - from that user account.
  5. Re-join as the same user.
    You should be able to notice the same result - that the user doesn't have the mute role anymore, however They will have the autorole.

Anything else?

I've tried to fill this issue, with as much info as possible, sry if it is still not enough.
If it's not enough or requires more testing, then I'd love to give a hand. Please ping me if you need more info or testing.

Btw I believe red current versions are not the reason for this issue, since these are minor bump 3.5.x and this could be an overlong persisting issue coming from 3.5.0 dpy 2.0 causing not just mute persistent problem but also multiple role add & remove issue.

### What Red version are you using? 3.5.7 ### Cog name Mutes ### Command name mute ### What did you expect to happen? This came to our attention when a few users of our server recently were able to __re-join__ the server with `no muted` - bypassing the mute persistent (when they were muted __**permanently beforehand**__) So I tested it and it turns out, you can actually bypass mute by `rejoining` a server, __**in the presence of**__ `ANY` autorole/joinrole cog - In a system where you set certain role(s) as `joinrole` which gets added to the user upon joining the server. So, to answer the question, The expected behavior would be - Persistent Mute over guild Re-Join. (I know Red already does **but** it's failing, details are as follows - ) ### What actually happened? Findings from the test: - It doesn't matter **which autorole cog** you're using (I tested with 3rd party autoroler cog by dav & autorole by lemon - both verified), when there's autorole + mute, autorole gets 1st priority nullifying the mute on **member_join**. > - Both the `Mutes` & `autorole` cogs are loaded on the **same red instance**. There's NO other interference from ANY other bots whatsoever (I made sure of it before testing) - It's even happening when the `autorole` system is present on a **completely** different 3rd party bot that has no connection with red & the muting is done with `red instance`. Which is really weird. Same result here - roles that are set as joinrole/autorole gets added to the user but **not** the mute role. - **Here's the issue**: This could be an underlying red or, dpy issue as this is happening on multiple occasions not entirely restricted to `Mutes` cog. (For example, if you execute say, 3 commands in one go, with one invoke - then chances are any of the 2 commands won't even get executed in the first place 5 out of 10 times - but this requires its own issue). - Audit log (server audit log) says red did add the role. :point_down: ![image](https://github.com/Cog-Creators/Red-DiscordBot/assets/84676543/e3bac6f6-842f-408b-8a3b-5b682064d7b6) - But **, in reality,** the mute role got removed from the user - logs (from `extendedmodlog - by trusty` ) support that statement - "The mute role got removed by the bot." Now **yes** it's true that extendedmodlog guesses the events but still as there's nothing in the server audit log that says otherwise. ![image](https://github.com/Cog-Creators/Red-DiscordBot/assets/84676543/10740937-e60f-4b51-99c3-9688c34cc63f) ![image](https://github.com/Cog-Creators/Red-DiscordBot/assets/84676543/318b7d09-4e23-44b7-8e56-6059faa5d1c4) ![image](https://github.com/Cog-Creators/Red-DiscordBot/assets/84676543/6b97ef95-3e91-4a75-a026-f315f85c7f29) > - Here in the SS ^ the `3k` role was set as autorole/joinrole through the 3rd party `autoroler` cog (by dav) | The `muted` was set on the same bot as well. - There's **NOTHING** else in the guild_audit log that says the mute role was removed in any other way. ### How can we reproduce this error? ## Test 1 - `Mutes` and `AutoRole` Cogs are on the same instance 1. Load `Mutes` cog & set a muted role + logs. 2. Install ANY autorole/joinrole cog and set a **test role** to be added as autorole - cog that adds a role as soon as a human joins a guild. 3. Test it in a 3k+ server. 4. Mute a test-account/user for any duration - enough so it can cover the test duration. 5. Leave the guild after that - from that user account. 6. Re-join as the same user. You will notice the user doesn't have the mute role anymore, **however** they will have the autorole. - You can install `extendedmodlog` by trusty (verified) to check further. --------------- ## Test 2 - `Mutes` is on the Red instance, `Autorole` is set to any 3rd party bot. 1. Load `Mutes` cog & set a muted role + logs. 2. Use any 3rd party bot such as carl bot (`235148962103951360`) - it has a autorole module, set any test role as autorole/joinrole. 3. Mute a test-account/user for any duration with the `Red instance` - enough so it can cover the test duration. 4. Leave the guild after that - from that user account. 5. Re-join as the same user. You should be able to notice the same result - that the user doesn't have the mute role anymore, **however** They will have the autorole. ### Anything else? I've tried to fill this issue, with as much info as possible, sry if it is still not enough. If it's not enough or requires more testing, then I'd love to give a hand. Please ping me if you need more info or testing. Btw I believe red current versions are not the reason for this issue, since these are minor bump 3.5.x and this could be an overlong persisting issue coming from 3.5.0 dpy 2.0 causing not just mute persistent problem but also multiple role add & remove issue.
Flame442 commented 2024-03-24 09:03:02 +01:00 (Migrated from github.com)

I can't reproduce test case 1, my bot properly gives back both roles. Though I didn't do it in a 3k+ server since I don't have access to a server that large where I can easily test something like this. Please try this on a fresh instance and report back if you still experience this issue, to rule out any potential for other cogs to be conflicting in some way (ie exclusive roles).

image

image

I can't reproduce test case 1, my bot properly gives back both roles. Though I didn't do it in a 3k+ server since I don't have access to a server that large where I can easily test something like this. Please try this on a fresh instance and report back if you still experience this issue, to rule out any potential for other cogs to be conflicting in some way (ie exclusive roles). ![image](https://github.com/Cog-Creators/Red-DiscordBot/assets/34169552/fb5316b5-75db-4af6-bdcf-21da706e0d44) ![image](https://github.com/Cog-Creators/Red-DiscordBot/assets/34169552/3afe2bfb-84b0-4126-bad5-ffa97daf6a8f)
cool-aid-man commented 2024-03-24 12:20:36 +01:00 (Migrated from github.com)

Sure, Here are the results.

Test case 2 - Mutes is on the Red instance, Autorole is set to any 3rd party bot.

  1. Made a new instance for a fresh start, with a New test-mute role to avoid conflicting with other roles.
    (Testing Server is 3k+ here as well).
    image
    image
  2. For the autorole I used two different 3rd party bots; one that I had mentioned earlier carl bot (235148962103951360) another one is a red instance different than the bot I'm muting with ofc.
  3. Upon re-joining after getting muted, the server-audit log says, the test bot, added the mute role. The 3rd part bot also says they added the autorole.
    image
  4. In Both cases the role that is set as autorole, gets added first (and I think this is purely because of how fast the 3rd party bots/instances are - in terms of adding autorole), and whenever the autorole gets added first, the mute role gets removed. 👇 - There are No other influences whatsoever.
    image
  5. In reality: The user got unmuted. 👆

6/6 Times - same results. i.e. Muted role getting removed upon re-joining.


Test case 1 - Mutes & Autorole are on the same New Red instance

Everything is the same as test case 1. (3k+ test server as well)
Results:

  1. 4/6 Times upon rejoining the mute role got removed & autorole got added alone. 2/6 times the mute role got added ONLY but no autorole.

And I think this is also because this new test instance isn't fast enough to add the autorole first (unlike the # test-case-1 where the bots and the red instance were super-fast adding the autorole ).

Tl;dr: Whenever a role is getting added first (upon joining the guild), the mute role somehow gets removed from the user.
Doesn't matter which bot you're using, if its fast enough adding role(s), then the mute role will get removed leading to nullifying the process overall.


I don't have any other autorole or exclusive role cogs in any of the instances, as a precaution I had quarantined ALL the other bots before doing the test. (Had done it earlier as well)

Sure, Here are the results. ## Test case 2 - `Mutes` is on the Red instance, `Autorole` is set to any 3rd party bot. 1. Made a **new instance** for a fresh start, with a New `test-mute` role to avoid conflicting with other roles. (**Testing Server is 3k+** here as well). ![image](https://github.com/Cog-Creators/Red-DiscordBot/assets/84676543/d170c241-8a1a-4656-af73-1e9dd86a87d1) ![image](https://github.com/Cog-Creators/Red-DiscordBot/assets/84676543/f7c222a6-6a72-4b72-8681-60cfce778b5f) 2. For the `autorole` I used two different 3rd party bots; one that I had mentioned earlier carl bot (`235148962103951360`) another one is **a red instance** different than the bot I'm muting with ofc. 3. Upon re-joining after getting muted, the server-audit log says, the test bot, added the mute role. The 3rd part bot also says they added the autorole. ![image](https://github.com/Cog-Creators/Red-DiscordBot/assets/84676543/e4d8fff9-faec-4eab-b742-df6f791ceef4) 4. **In Both cases** the role that is set as `autorole`, gets added **first** (and I think this is purely because of how fast the 3rd party bots/instances are - in terms of adding autorole), and whenever the autorole gets added first, the `mute role` gets removed. 👇 - There are **No** other influences whatsoever. ![image](https://github.com/Cog-Creators/Red-DiscordBot/assets/84676543/6a182d21-790f-4c69-9b02-ce25bbccf755) 5. In reality: The user got unmuted. 👆 > 6/6 Times - same results. i.e. Muted role getting removed upon re-joining. ------- ## Test case 1 - `Mutes` & `Autorole` are on the same New Red instance Everything is the same as test case 1. (**3k+ test server as well**) Results: 1. 4/6 Times upon rejoining the `mute role` got removed & `autorole` got added **alone**. 2/6 times the `mute role` got added **ONLY** but no `autorole`. > And I think this is also because this new test instance isn't fast enough to add the `autorole` **first** (unlike the # test-case-1 where the bots and the red instance were super-fast adding the autorole ). Tl;dr: Whenever a role is getting added **first** (upon joining the guild), the `mute role` somehow gets removed from the user. Doesn't matter which bot you're using, if its fast enough adding role(s), then the mute role will get removed leading to nullifying the process overall. ---- I don't have any other autorole or exclusive role cogs in any of the instances, as a precaution I had quarantined **ALL** the other bots before doing the test. (Had done it earlier as well)
cool-aid-man commented 2024-03-25 04:53:20 +01:00 (Migrated from github.com)

One more thing,
Since test servers (with <100 members) are not ideal for testing - due to several reasons and since it's kind of hard to get your hands on 3k+ servers, what we can do is - we can provide a private space for ANY ORG/staff member who may wish to come in, to test this out in our server, yes with their own bots to pinpoint the root of this issue and make it better for everyone else.
I think from our end, we as a server, will be able to provide as much info and help as is needed to solve it.

@Flame442 Flame, if you wish you can come to our server with your own bot .gg/thestarship that's The Starship (this is where the test results are from - and for the "13-year-olds" no this is Not an advertisement, this is a mere attempt to find what is causing it). We will provide you with all you need to see this phenomenon happening with your own eyes and may be able to find the reason behind it.

  • Anyone is welcome, just ping me if any-one decides to come in so that I can provide you the tools that you need for testing.

Servers under 100 might not be able to showcase this issue 10/10 times but I believe any server 1000+ with lots of roles, should be able to recreate the mentioned issues (both test cases: 1 and 2).

One more thing, Since test servers (with <100 members) are not ideal for testing - due to several reasons **and** since it's kind of hard to get your hands on 3k+ servers, what we can do is - we can provide a `private space` for **ANY** **ORG/staff member** who may wish to come in, to test this out in our server, yes **with their own bots** to pinpoint the root of this issue and make it better for everyone else. I think from our end, we as a server, will be able to provide as much info and help as is needed to solve it. @Flame442 Flame, if you wish you can come to our server **with** your own bot `.gg/thestarship` that's `The Starship` (this is where the test results are from - and for the "13-year-olds" no this is **Not an advertisement**, this is a mere attempt to find what is causing it). We will provide you with all you need to see this phenomenon happening with your own eyes and may be able to find the reason behind it. > - Anyone is welcome, just ping me if any-one decides to come in so that I can provide you the tools that you need for testing. Servers under 100 might not be able to showcase this issue 10/10 times but I believe any server 1000+ with lots of roles, should be able to recreate the mentioned issues (both test cases: 1 and 2).
Flame442 commented 2024-03-25 07:28:24 +01:00 (Migrated from github.com)

While it seems like this issue is possible to reproduce given the specific server environment you have, it does seem like it requires some stars to align in order to happen. I'm also not entirely convinced we've tracked down the source of the issue, but we at least found that adding a sleep before adding the autoroles or moving the autorole to the default onboarding roles will fix this issue. I think it's a bit too niche and a bit too risky to fix in Mutes, since the only way to do it would be to delay adding the mute role on rejoin. For that reason, I'm going to consider this an issue that would be better fixed in other ways, namely in the 3rd party autorole cogs.

While it seems like this issue is possible to reproduce given the specific server environment you have, it does seem like it requires some stars to align in order to happen. I'm also not _entirely_ convinced we've tracked down the source of the issue, but we at least found that adding a sleep before adding the autoroles or moving the autorole to the default onboarding roles will fix this issue. I think it's a bit too niche and a bit too risky to fix in Mutes, since the only way to do it would be to delay adding the mute role on rejoin. For that reason, I'm going to consider this an issue that would be better fixed in other ways, namely in the 3rd party autorole cogs.
Sign in to join this conversation.
No labels
Automated PR
Blocked
Blocked By: Damage Control
Blocked By: Dependency
Blocked By: Other PR
Breaking Change
Category: CI
Category: Cogs - Admin
Category: Cogs - Alias
Category: Cogs - Audio
Category: Cogs - Bank
Category: Cogs - Cleanup
Category: Cogs - CustomCommands
Category: Cogs - Dev
Category: Cogs - Downloader
Category: Cogs - Economy
Category: Cogs - Filter
Category: Cogs - General
Category: Cogs - Image
Category: Cogs - Mod
Category: Cogs - Modlog
Category: Cogs - Mutes
Category: Cogs - Permissions
Category: Cogs - Reports
Category: Cogs - Streams
Category: Cogs - Trivia
Category: Cogs - Trivia - Lists
Category: Cogs - Warnings
Category: Core - API - App Commands Package
Category: Core - API - Audio
Category: Core - API - Bank
Category: Core - API - Commands Package
Category: Core - API - Config
Category: Core - API - Other
Category: Core - API - Utils Package
Category: Core - Bot Class
Category: Core - Bot Commands
Category: Core - Command-line Interfaces
Category: Core - Downloader
Category: Core - Help
Category: Core - i18n
Category: Core - Modlog
Category: Core - Other Internals
Category: Core - RPC/ZMQ
Category: Docker
Category: Docs - Changelogs
Category: Docs - For Developers
Category: Docs - Install Guides
Category: Docs - Other
Category: Docs - User Guides
Category: Meta
Category: RPC/ZMQ methods
Category: Vendored Packages
Changelog Entry: Added
Changelog Entry: Pending
Changelog Entry: Skipped
Closed: Duplicate
Closed: External
Closed: Invalid
Closed: User Error
Closed: Won't Fix
Complex Issue
Docs-only
Feature Branch
Good First Issue
Help Wanted
High Priority
Needs Backport To stable-docs
No Activity
No Repro
QA: Bypassed
QA: Changes Requested
QA: Passed
Release Blocker
Status: Accepted
Status: Frozen
Status: In Progress
Status: Needs Discussion
Status: Needs Info
Status: Needs Triage
Status: PRs Welcome
Type: Bug
Type: Dependency Update
Type: Deprecation
Type: Enhancement
Type: Feature
Type: Informational
Type: Merge
Type: Optimisation
Type: Question
Type: Removal
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Mrcoolgamer11/Red-DiscordBot#6329
No description provided.