Skip to content

fix(discord): re-check gateway authorization for interactive component clicks - #33896

Closed
Dusk1e wants to merge 1 commit into
NousResearch:mainfrom
Dusk1e:fix/discord-component-auth-fail-closed
Closed

fix(discord): re-check gateway authorization for interactive component clicks#33896
Dusk1e wants to merge 1 commit into
NousResearch:mainfrom
Dusk1e:fix/discord-component-auth-fail-closed

Conversation

@Dusk1e

@Dusk1e Dusk1e commented May 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Enforces strict multi-tier gateway authorization re-checks over Discord interactive component views, preventing external boundary fail-open executions when Discord-specific platform allowlists are empty.

Why

A trust-boundary compliance failure existed inside the Discord platform adapter layer. While core slash commands complied with platform restrictions, interactive component views (such as buttons and selection dropdowns) bypassed runner-level policy verification pipelines whenever DISCORD_ALLOWED_USERS or DISCORD_ALLOWED_ROLES parameters were unconfigured. An unauthorized workspace participant could intercept and click active UI elements to forcefully resolve high-risk command approvals, bypass confirmation guards, mutate active models, or answer confirmation dialogs. This patch binds component click lifecycles directly to core runner verification layers.

Applied Authorization Precedence

  1. Explicit local Discord platform allowlist evaluation (DISCORD_ALLOWED_USERS or DISCORD_ALLOWED_ROLES).
  2. Live runner-level policy delegation checking for active global settings, session pairing matrices, or global allow-all overrides.
  3. Strict fail-closed cancellation if all tracking parameters evaluate as empty or unmatched.

Scope of Changes

  • plugins/platforms/discord/adapter.py: Integrated a central component authorization wrapper into interaction pipelines to protect active interactive element targets before final callback completion.
  • gateway/run.py: Connected the running gateway daemon pipeline reference hooks down into the active Discord component listeners during operational layout loops.
  • tests/gateway/: Expanded testing matrices to assert authorization rejection on mismatched global user contexts and secure layout behavior under unconfigured local configurations.

Affected Views

  • ExecApprovalView
  • SlashConfirmView
  • UpdatePromptView
  • ModelPickerView
  • ClarifyChoiceView

Verified Test Suites

All targeted interaction checks, authorization loops, and linter constraints completed with absolute success:

  • tests/gateway/test_discord_component_auth.py
  • tests/gateway/test_discord_bot_auth_bypass.py
  • tests/gateway/test_discord_clarify_buttons.py
  • tests/gateway/test_discord_model_picker.py
  • tests/gateway/test_discord_lazy_install_views.py
  • tests/gateway/test_discord_slash_auth.py
Total Checked Subsystem Interceptions: 81 passed, 0 failed

@alt-glitch alt-glitch added type/security Security vulnerability or hardening P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery comp/plugins Plugin system and bundled plugins platform/discord Discord bot adapter area/auth Authentication, OAuth, credential pools duplicate This issue or pull request already exists labels May 28, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #30964 — same security fix (Discord interactive component clicks bypass gateway authorization). #30964 is a cross-platform fix covering both Discord and Slack. Also related: #33844 (Slack-specific variant), #29627.

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the security-focused contribution. This is an automated hermes-sweeper review; current main already provides the requested fail-closed Discord component authorization behavior.

  • f6f363662e91ee1636a0eb67568dc26d2d7831b3 (fix(discord): fail closed for component button auth when no allowlist set) is on current main and shipped in v2026.6.19.
  • plugins/platforms/discord/adapter.py:6691 explicitly authorizes component interactions only through Discord/global allowlists, role membership, explicit allow-all flags, or approved pairing; the final path rejects.
  • plugins/platforms/discord/adapter.py:6863, :7001, :7105, :7212, and :7598 route all affected component views through that shared check.
  • tests/gateway/test_discord_component_auth.py:296 covers default rejection for the views, while :336 covers pairing-store authorization.
  • The member discussion correctly identified the overlap with fix(gateway): require auth for interaction buttons #30964; the cross-adapter salvage merged as fix(gateway): fail closed for approval-button auth on Slack, Feishu, Discord when no allowlist set #41226 and included the Discord fail-closed fix.

Closing as implemented on main.

@teknium1 teknium1 closed this Jul 13, 2026
@teknium1 teknium1 added the sweeper:implemented-on-main Sweeper: behavior already present on current main label Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/auth Authentication, OAuth, credential pools comp/gateway Gateway runner, session dispatch, delivery comp/plugins Plugin system and bundled plugins duplicate This issue or pull request already exists P2 Medium — degraded but workaround exists platform/discord Discord bot adapter sweeper:implemented-on-main Sweeper: behavior already present on current main type/security Security vulnerability or hardening

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants