Skip to content

fix(bot): enforce role lists in DMs, other servers and autocomplete - #141

Merged
retardgerman merged 2 commits into
devfrom
fix/dm-role-bypass
Nov 6, 2026
Merged

retardgerman merged 2 commits into
devfrom
fix/dm-role-bypass

Conversation

@retardgerman

Copy link
Copy Markdown
Contributor

Problem

ROLE_ALLOWLIST and ROLE_BLOCKLIST could be bypassed:

  • DMs: slash commands are available in DMs with the bot, where there is no server member to check roles on. The check simply allowed those interactions, so a restricted user could use /request and /search by messaging the bot directly.
  • Other servers: the check didn't look at which server an interaction came from. A blocklisted user could use the bot in any other server it is in, where the blocked role doesn't exist.
  • Autocomplete: suggestions (TMDB search, Seerr tags, Radarr/Sonarr servers and quality profiles) were never gated.

Fix

  • When a role list is set, the bot only accepts interactions from members of the configured GUILD_ID. DMs and other servers are denied. If role lists are set but GUILD_ID is empty, interactions are denied and a warning is logged.
  • Restricted users get an empty suggestion list in autocomplete.
  • Two unused select menu IDs are no longer exempt from the check.
  • Without role lists, nothing changes. With role lists, nobody can use the bot in DMs anymore, including allowed users.

checkRolePermission() returned true whenever there was no guild member,
which is the case for interactions in a DM with the bot. Since slash
commands are registered globally and available in DMs, a user missing
from ROLE_ALLOWLIST or listed in ROLE_BLOCKLIST could still use /request
and /search by messaging the bot directly. The check also ignored which
guild an interaction came from, so a blocklisted user could use the bot
in any other server it is in, where the blocked role doesn't exist.

When a role list is set, interactions are now only allowed from members
of the configured GUILD_ID (denied and logged if GUILD_ID is empty).
Autocomplete is gated as well (empty suggestions instead of TMDB/Seerr
lookups), and two select menu prefixes that no handler uses are no
longer exempt from the check. Without role lists, nothing changes.
@retardgerman
retardgerman merged commit 42864de into dev Nov 6, 2026
1 of 2 checks passed
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

Successfully merging this pull request may close these issues.

1 participant