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

Manage Permissions channel override overrides ManageRoles Permission #754

Open
DeDiamondPro opened this issue Feb 10, 2023 · 8 comments
Open

Comments

@DeDiamondPro
Copy link

In TopGuildChannel.getEffectivePermissions, when the Manage Permissions channel override is denied, it will override the ManageRoles permission. These 2 permissions have nothing to do with each other, the manage permission overwrite is just for the permissions of that channel and should not influence the ManageRoles permission.

@baskerbyte
Copy link
Contributor

Do you have the debug logs?

@DeDiamondPro
Copy link
Author

DeDiamondPro commented Feb 10, 2023

Do you have the debug logs?

2023-02-10 21:32:05 | DEBUG | [R]:[KTOR]:[ExclusionRequestRateLimiter] | [RESPONSE]:200:GET:https://discord.com/api/v10/guilds/906206244119904287?with_counts=false body:{"id": "906206244119904287", "name": "Bot testing ground", "icon": null, "description": null, "home_header": null, "splash": null, "discovery_splash": null, "features": ["COMMUNITY", "NEWS"], "emojis": [], "stickers": [], "banner": null, "owner_id": "336764548017291265", "application_id": null, "region": "europe", "afk_channel_id": null, "afk_timeout": 300, "system_channel_id": "906206244119904290", "widget_enabled": false, "widget_channel_id": null, "verification_level": 1, "roles": [{"id": "906206244119904287", "name": "@everyone", "description": null, "permissions": "1071698529857", "position": 0, "color": 0, "hoist": false, "managed": false, "mentionable": false, "icon": null, "unicode_emoji": null, "flags": 0}, {"id": "907967386479628288", "name": "new role", "description": null, "permissions": "1071698660929", "position": 2, "color": 3066993, "hoist": false, "managed": false, "mentionable": false, "icon": null, "unicode_emoji": null, "flags": 0}, {"id": "950095868768440355", "name": "DevDiamondBot", "description": null, "permissions": "275146345472", "position": 4, "color": 0, "hoist": false, "managed": true, "mentionable": false, "icon": null, "unicode_emoji": null, "flags": 0, "tags": {"bot_id": "872532663628595210"}}, {"id": "1049413955568799808", "name": "Glacia Beta", "description": null, "permissions": "533046077504", "position": 3, "color": 0, "hoist": false, "managed": true, "mentionable": false, "icon": null, "unicode_emoji": null, "flags": 0, "tags": {"bot_id": "1049411363275030619"}}, {"id": "1060580723926515852", "name": "new role", "description": null, "permissions": "1071698529857", "position": 1, "color": 0, "hoist": false, "managed": false, "mentionable": false, "icon": null, "unicode_emoji": null, "flags": 0}], "default_message_notifications": 1, "mfa_level": 0, "explicit_content_filter": 2, "max_presences": null, "max_members": 500000, "max_stage_video_channel_users": 0, "max_video_channel_users": 25, "vanity_url_code": null, "premium_tier": 0, "premium_subscription_count": 0, "system_channel_flags": 0, "preferred_locale": "en-US", "rules_channel_id": "1049062888620425227", "safety_alerts_channel_id": null, "public_updates_channel_id": "1049062888620425228", "hub_type": null, "premium_progress_bar_enabled": false, "latest_onboarding_question_id": null, "nsfw": false, "nsfw_level": 0}
2023-02-10 21:32:07 | DEBUG | [R]:[KTOR]:[ExclusionRequestRateLimiter] | [RESPONSE]:200:GET:https://discord.com/api/v10/channels/906206244119904290 body:{"id": "906206244119904290", "last_message_id": "1073698765690634340", "type": 0, "name": "general", "position": 0, "flags": 0, "parent_id": "906206244119904288", "topic": "Server is offline | 1 unique players ever joined", "guild_id": "906206244119904287", "permission_overwrites": [{"id": "950095868768440355", "type": 0, "allow": "0", "deny": "268435456"}, {"id": "1049413955568799808", "type": 0, "allow": "0", "deny": "0"}, {"id": "906206244119904287", "type": 0, "allow": "2048", "deny": "0"}], "last_pin_timestamp": "2022-04-09T12:00:39+00:00", "rate_limit_per_user": 1, "nsfw": false}
2023-02-10 21:32:07 | DEBUG |        d.d.glacia.listeners.InfoListener | [dev.kord.common.entity.Permission$CreateInstantInvite@18ac525d, dev.kord.common.entity.Permission$AddReactions@4db9c704, dev.kord.common.entity.Permission$Stream@51d7f280, dev.kord.common.entity.Permission$ViewChannel@52558e59, dev.kord.common.entity.Permission$SendMessages@2a7a947e, dev.kord.common.entity.Permission$EmbedLinks@1efa76a3, dev.kord.common.entity.Permission$AttachFiles@605dd866, dev.kord.common.entity.Permission$ReadMessageHistory@1b70e195, dev.kord.common.entity.Permission$MentionEveryone@63765718, dev.kord.common.entity.Permission$UseExternalEmojis@2e746abb, dev.kord.common.entity.Permission$Connect@3c04283b, dev.kord.common.entity.Permission$Speak@6d9b7634, dev.kord.common.entity.Permission$UseVAD@4b58d430, dev.kord.common.entity.Permission$ChangeNickname@1474b64d, dev.kord.common.entity.Permission$UseApplicationCommands@70396d28, dev.kord.common.entity.Permission$RequestToSpeak@2e654a6b, dev.kord.common.entity.Permission$CreatePublicThreads@3d755b2f, dev.kord.common.entity.Permission$CreatePrivateThreads@39c768f8, dev.kord.common.entity.Permission$UseExternalStickers@7af64a00, dev.kord.common.entity.Permission$SendMessagesInThreads@d2892c9, dev.kord.common.entity.Permission$UseEmbeddedActivities@1a931c60]
logger.debug(
         kord.getChannelOf<TopGuildChannel>(Snowflake(906206244119904290))!!
                .getEffectivePermissions(kord.selfId).values.toString()
)

@baskerbyte
Copy link
Contributor

I don't understand very well, you don't have these permissions on debug, can you send the PATCH debug (when you disable the ManagePermissions permission)

@DeDiamondPro
Copy link
Author

these permissions on debug

That's not the problem, the bot never updates the channel override. The problem is (as far as I can see) the ManageRoles permission and ManagePermissions channel overwrite are handled as the same thing, while they should not be handled like that. The ManageRoles permission shouldn't be influenced by a channel overwrite.

@HopeBaron
Copy link
Member

Hello there, could you include the steps on how to reproduce this?
Also did you make sure you are on the latest version?

@DeDiamondPro
Copy link
Author

Hello there, could you include the steps on how to reproduce this? Also did you make sure you are on the latest version?

I'm using 0.8.x-SNAPSHOT

Steps to reproduce:

  1. Give the bot the manage roles permission
  2. Run the following code:
     kord.on<ReadyEvent> {
            val channelId = Snowflake(YOUR_CHANNEL_ID)
            val channel = kord.getChannelOf<TopGuildChannel>(channelId)
            val permissions = channel!!.getEffectivePermissions(kord.selfId)
            println(permissions.contains(Permission.ManageRoles))
        }

This returns true, as expected
3. Add a channel override for the bot and deny the permission Manage Permissions overwrite. image
4. Run the code again
You would expect this to also return true, since the Manage Permissions channel overwrite only denies the bot the permission to edit the overwrites of the channel, but for some reason it returns false.

@HopeBaron
Copy link
Member

@DeDiamondPro sorry I didn't ask you
Does the bot have admin permissions?

@DeDiamondPro
Copy link
Author

@DeDiamondPro sorry I didn't ask you Does the bot have admin permissions?

No it does not

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

No branches or pull requests

3 participants