Skip to content

fix: harden Mattermost slash callback auth#2404

Open
BingqingLyu wants to merge 1 commit intomainfrom
fork-pr-65655-fix-65624-mattermost-slash-callback-auth
Open

fix: harden Mattermost slash callback auth#2404
BingqingLyu wants to merge 1 commit intomainfrom
fork-pr-65655-fix-65624-mattermost-slash-callback-auth

Conversation

@BingqingLyu
Copy link
Copy Markdown
Owner

@BingqingLyu BingqingLyu commented Apr 28, 2026

Fix Summary

Mattermost native slash commands were insecure in two ways: when commands.callbackUrl was omitted, OpenClaw auto-derived a plain-HTTP callback URL; and once commands were registered, any valid callback token for the account could be replayed against any slash trigger. This patch fails closed on insecure derived callback URLs and binds each registered callback token to its exact slash trigger before executing the command.

Issue Linkage

Fixes openclaw#65624

Security Snapshot

  • CVSS v3.1: 7.6 (High)
  • CVSS v4.0: 8.6 (High)

Implementation Details

Files Changed

  • docs/channels/mattermost.md (+4/-1)
  • docs/gateway/configuration-reference.md (+2/-0)
  • extensions/mattermost/src/mattermost/monitor-slash.test.ts (+25/-11)
  • extensions/mattermost/src/mattermost/monitor-slash.ts (+13/-0)
  • extensions/mattermost/src/mattermost/slash-http.send-config.test.ts (+2/-0)
  • extensions/mattermost/src/mattermost/slash-http.test.ts (+17/-2)
  • extensions/mattermost/src/mattermost/slash-http.ts (+24/-1)
  • extensions/mattermost/src/mattermost/slash-state.ts (+12/-0)

Technical Analysis

The slash registration path previously accepted a derived http://... callback when operators omitted commands.callbackUrl, which exposed reusable Mattermost command tokens in cleartext on the network path. Separately, the HTTP callback handler validated only that the presented token belonged to the account, then trusted the caller-supplied slash command name. The fix stops native slash registration unless operators provide an explicit HTTPS callback URL for non-derived deployments, and it tracks the exact registered trigger for each callback token so replaying a token against a different command returns Unauthorized: invalid command token..

Validation Evidence

  • Command: pnpm test extensions/mattermost/src/mattermost/slash-http.test.ts
  • Status: passed
  • Command: pnpm test extensions/mattermost/src/mattermost/slash-http.send-config.test.ts
  • Status: passed
  • Command: pnpm test extensions/mattermost/src/mattermost/monitor-slash.test.ts
  • Status: passed

Risk and Compatibility

  • behavior change for insecure setups: native slash command auto-registration now stops until operators configure an explicit reachable HTTPS commands.callbackUrl; valid callbacks keep working once configured

AI-Assisted Disclosure

  • AI-assisted: yes
  • Model: github-copilot/gpt-5.4

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.

[Bug]: Mattermost slash commands default to cleartext callback URLs that expose reusable command tokens

2 participants