CommandKit has incorrect command name exposure in context object for message command aliases
Moderate severity
GitHub Reviewed
Published
Oct 11, 2025
in
underctrl-io/commandkit
•
Updated Oct 13, 2025
Package
Affected versions
>= 1.2.0-rc.1, <= 1.2.0-rc.11
Patched versions
1.2.0-rc.12
Description
Published to the GitHub Advisory Database
Oct 13, 2025
Reviewed
Oct 13, 2025
Last updated
Oct 13, 2025
Impact
A logic flaw exists in the message command handler of CommandKit that affects how the
commandName
property is exposed to both middleware functions and command execution contexts when handling command aliases. When a message command is invoked using an alias, thectx.commandName
value reflects the alias rather than the canonical command name. This occurs in both middleware functions and within the command’s own run function.Developers who rely on
ctx.commandName
for logic that assumes it represents the canonical command identifier may introduce unintended behavior. In security-sensitive cases, such as middleware used for permission checks, rate limiting, or audit logging, this behavior could allow unauthorized command execution or inaccurate access control decisions. Slash commands and context menu commands are not affected.Patches
Fixed in v1.2.0-rc.12.
ctx.commandName
now consistently returns the actual command name, regardless of the alias used to invoke it.Workaround
If upgrading isn't immediately possible:
ctx.command.data.command.name
for permission validations, orReferences
References