merlinfuchs / embed-generator

Create rich embed messages for Discord (previously discord.club)
https://message.style
MIT License
329 stars 37 forks source link

Permissions rework #101

Closed merlinfuchs closed 1 year ago

merlinfuchs commented 1 year ago

This PR changes how permissions for actions are checked. This has to be done to prevent users with Manage Webhook permissions to create components or commands that hand out roles that they shouldn't have access to.

Previously permissions were checked when the message or command was created. This meant that all actions had to be statically analyzed to see what permissions they require. With more complex action types and nested / recursive actions this becomes nearly impossible.

Now permissions are checked when the action is executed. For this we store a DervivedPermission object with each action set which contains the permissions of the user that has sent the message or created the command.

Messages and commands before this change bypass the new permission checks because they should already have been checked when they were created.

closes #92