[Mod] rename doesn’t respect user hierarchy #5187

Closed
opened 2021-07-13 21:52:51 +02:00 by phenom4n4n · 3 comments
phenom4n4n commented 2021-07-13 21:52:51 +02:00 (Migrated from github.com)

What Red version are you using?

3.4.12

Cog name

Mod

Command name

rename

What did you expect to happen?

The bot would respond, telling the user that they cannot edit the names of members higher than them.

What actually happened?

The user was able to edit the name of a member higher than them.

How can we reproduce this error?

  1. Place the bot’s role above 2 users in a server.
  2. Have one user have a role higher than the other.
  3. Give the user that is lower manage nickname perms.
  4. Have user that is lower run [p]nickme on the user that is higher, allowing the lower user to bypass Discord hierarchy and edit that user’s nickname.

Anything else?

No response

### What Red version are you using? 3.4.12 ### Cog name Mod ### Command name rename ### What did you expect to happen? The bot would respond, telling the user that they cannot edit the names of members higher than them. ### What actually happened? The user was able to edit the name of a member higher than them. ### How can we reproduce this error? 1. Place the bot’s role above 2 users in a server. 2. Have one user have a role higher than the other. 3. Give the user that is lower manage nickname perms. 4. Have user that is lower run `[p]nickme` on the user that is higher, allowing the lower user to bypass Discord hierarchy and edit that user’s nickname. ### Anything else? _No response_
qenu commented 2021-08-12 08:30:47 +02:00 (Migrated from github.com)

As red responses,

I do not have permission to rename that member. They may be higher than or equal to me in the role hierarchy.

I don't think the original design for red was to acknowledge and compare the role hierarchy between ctx.author and user, but instead it compares redbots' role to users' role

although if you want to make it that way its pretty simple, just swap ctx.me to ctx.author in names.py#L41 , and change up the response to match outcome L54

something like this

As red responses, > I do not have permission to rename that member. They may be higher than or equal to me in the role hierarchy. I don't think the original design for red was to acknowledge and compare the role hierarchy between ctx.author and user, but instead it compares redbots' role to users' role although if you want to make it that way its pretty simple, just swap ctx.me to ctx.author in names.py#L41 , and change up the response to match outcome L54 [something like this](https://github.com/qenu/Red-DiscordBot/blob/563cd805fd66b8d1359e9e9a233048268cfff085/redbot/cogs/mod/names.py)
Flame442 commented 2021-08-13 00:34:08 +02:00 (Migrated from github.com)

qenu, the current handling you are referring to is there to prevent API errors from the bot attempting to rename a member who is higher or equal to the bot user in the hierarchy. That check needs to remain.

What phen is referring to is the fact that the bot does not check if the invoker is higher than the member in the hierarchy, as that invoker would not normally be able to change the member's nickname, and probably should not be able to by default using [p]rename. This should probably be bundled in the [p]modset hierarchy setting, disallowing users from renaming members higher or equal in the hierarchy UNLESS that setting states the hierarchy should be ignored.

qenu, the current handling you are referring to is there to prevent API errors from the bot attempting to rename a member who is higher or equal to the bot user in the hierarchy. That check needs to remain. What phen is referring to is the fact that the bot does not check if the *invoker* is higher than the member in the hierarchy, as that invoker would not normally be able to change the member's nickname, and probably should not be able to by default using `[p]rename`. This should probably be bundled in the `[p]modset hierarchy` setting, disallowing users from renaming members higher or equal in the hierarchy UNLESS that setting states the hierarchy should be ignored.
qenu commented 2021-08-13 03:05:34 +02:00 (Migrated from github.com)

I see I have misunderstood what he meant,
Seeing that theres' a built-in hierarchy check function, I've went ahead on adding it
#5211

I see I have misunderstood what he meant, Seeing that theres' a built-in hierarchy check function, I've went ahead on adding it #5211
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#5187
No description provided.