Skip to content

Slack: harden slash and interactions ingress checks#29091

Merged
Takhoffman merged 2 commits intoopenclaw:mainfrom
Solvely-Colin:Solvely/slack-mismatch-hardening
Mar 1, 2026
Merged

Slack: harden slash and interactions ingress checks#29091
Takhoffman merged 2 commits intoopenclaw:mainfrom
Solvely-Colin:Solvely/slack-mismatch-hardening

Conversation

@Solvely-Colin
Copy link
Contributor

Summary

Describe the problem and fix in 2–5 bullets:

  • Problem: Slack mismatch filtering (api_app_id / team_id) was enforced for event subscriptions, but slash and interaction entry points could process payloads without the same ingress guard.
  • Why it matters: Slash commands and interactive controls are privileged paths that can drive command/tool execution; mismatch filtering should be consistent before any authorization/dispatch logic.
  • What changed: Added early mismatch drops in Slack slash command handlers, slash arg menu options/actions, block actions, and modal lifecycle handlers; extended mismatch parsing to support interaction-style nested team.id.
  • What did NOT change (scope boundary): No changes to Slack token verification primitives, DM/group policy semantics, or tool permission policy models.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #
  • Related #

User-visible / Behavior Changes

  • Slack now drops mismatched app/team payloads earlier on slash and interaction surfaces (same trust boundary behavior as event handlers).

Security Impact (required)

  • New permissions/capabilities? (Yes/No): No
  • Secrets/tokens handling changed? (Yes/No): No
  • New/changed network calls? (Yes/No): No
  • Command/tool execution surface changed? (Yes/No): Yes
  • Data access scope changed? (Yes/No): No
  • If any Yes, explain risk + mitigation:
    • Tightened ingress checks on privileged Slack entry points to fail closed earlier when app/team identity does not match the configured account context.

Repro + Verification

Environment

  • OS: macOS
  • Runtime/container: Node 22+, pnpm
  • Model/provider: N/A
  • Integration/channel (if any): Slack
  • Relevant config (redacted): Slack config with teamId/apiAppId context and slash/interactions enabled

Steps

  1. Register Slack slash commands and interactions with a context whose mismatch guard returns true (or payload with mismatched app/team identifiers).
  2. Send slash/interaction payloads.
  3. Observe they are acknowledged but not dispatched/enqueued.

Expected

  • Mismatched payloads are dropped before command dispatch/system-event enqueue.

Actual

  • Verified in tests: no dispatch/system-event enqueue for mismatched slash/interactions payloads.

Evidence

Attach at least one:

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios:
    • pnpm test -- src/slack/monitor/slash.test.ts src/slack/monitor/events/interactions.test.ts src/slack/monitor/context.test.ts
    • Confirmed new tests cover slash, interaction block actions, modal lifecycle drops, and nested team.id mismatch parsing.
  • Edge cases checked:
    • Slash arg-menu options/actions mismatch handling still acks safely without dispatch.
    • Existing authorized interaction flow remains intact.
  • What you did not verify:
    • Full repo pnpm check currently fails on unrelated pre-existing type errors outside this change set.

Compatibility / Migration

  • Backward compatible? (Yes/No): Yes
  • Config/env changes? (Yes/No): No
  • Migration needed? (Yes/No): No
  • If yes, exact upgrade steps:

Failure Recovery (if this breaks)

  • How to disable/revert this change quickly:
    • Revert this PR commit.
  • Files/config to restore:
    • src/slack/monitor/slash.ts
    • src/slack/monitor/events/interactions.ts
    • src/slack/monitor/context.ts
  • Known bad symptoms reviewers should watch for:
    • Legitimate slash or interaction payloads being dropped due to unexpected app/team identifier mismatch.

Risks and Mitigations

List only real risks for this PR. Add/remove entries as needed. If none, write None.

  • Risk:

    • Overly strict mismatch checks could block valid Slack payload variants.
    • Mitigation:
      • Added test coverage for nested team.id payload form and preserved non-mismatch paths.
  • AI-assisted:

    • This PR was AI-assisted and manually reviewed/tested as described above.

@openclaw-barnacle openclaw-barnacle bot added channel: slack Channel integration: slack size: M labels Feb 27, 2026
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 27, 2026

Greptile Summary

Extended Slack ingress validation to slash commands and interactions, bringing them to parity with event subscription security checks.

Key changes:

  • Added team.id nested payload format support for interaction-style bodies
  • Implemented early mismatch drops in slash command handlers (direct commands, arg menu options/actions)
  • Implemented mismatch guards for block actions and modal lifecycle events (view submission/closed)
  • Fail-closed approach: payloads acknowledged but silently dropped with server-side logging when app/team IDs don't match configured context

Implementation quality:

  • Mismatch checks correctly placed after ack() (prevents Slack timeout warnings) but before dispatch/enqueue
  • Comprehensive test coverage for all new code paths including nested team.id format
  • Consistent with existing event subscription mismatch handling patterns already in place for messages, app_mentions, and reactions
  • Edge cases handled properly (missing IDs, empty values, nested formats)

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk - it's a defensive security hardening change with comprehensive test coverage.
  • Clean security hardening implementation: extends existing mismatch filtering pattern to slash/interaction entry points, handles edge cases correctly, includes comprehensive tests, no logical errors found, and follows fail-closed security principles. The changes are additive (only dropping mismatched requests) with no modifications to core processing logic.
  • No files require special attention - all changes follow established patterns and are well-tested.

Last reviewed commit: 13a5eb3

@Takhoffman Takhoffman force-pushed the Solvely/slack-mismatch-hardening branch from 13a5eb3 to ee2317f Compare March 1, 2026 15:40
@Takhoffman Takhoffman merged commit 0f36ee5 into openclaw:main Mar 1, 2026
9 checks passed
@Takhoffman
Copy link
Contributor

PR #29091 - Slack: harden slash and interactions ingress checks (#29091)

Merged via squash.

  • Merge commit: 0f36ee5
  • Verified: pnpm build, pnpm check, pnpm test:macmini
  • Changes made:
    M CHANGELOG.md
    A src/slack/monitor/context.test.ts
    M src/slack/monitor/context.ts
    M src/slack/monitor/events/interactions.test.ts
    M src/slack/monitor/events/interactions.ts
    M src/slack/monitor/slash.test.ts
    M src/slack/monitor/slash.ts
  • Why these changes were made:
    Required changelog policy for autoland; code path and tests from contributor branch were preserved after rebase.
  • Changelog: CHANGELOG.md updated=true required=true opt_out=false

Thanks @Solvely-Colin!

zooqueen added a commit to hanzoai/bot that referenced this pull request Mar 1, 2026
ansh pushed a commit to vibecode/openclaw that referenced this pull request Mar 2, 2026
…thanks @Solvely-Colin

Verified:
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: Solvely-Colin <211764741+Solvely-Colin@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
steipete pushed a commit to Sid-Qin/openclaw that referenced this pull request Mar 2, 2026
…thanks @Solvely-Colin

Verified:
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: Solvely-Colin <211764741+Solvely-Colin@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
safzanpirani pushed a commit to safzanpirani/clawdbot that referenced this pull request Mar 2, 2026
…thanks @Solvely-Colin

Verified:
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: Solvely-Colin <211764741+Solvely-Colin@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
steipete pushed a commit to Sid-Qin/openclaw that referenced this pull request Mar 2, 2026
…thanks @Solvely-Colin

Verified:
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: Solvely-Colin <211764741+Solvely-Colin@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
robertchang-ga pushed a commit to robertchang-ga/openclaw that referenced this pull request Mar 2, 2026
…thanks @Solvely-Colin

Verified:
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: Solvely-Colin <211764741+Solvely-Colin@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
hanqizheng pushed a commit to hanqizheng/openclaw that referenced this pull request Mar 2, 2026
…thanks @Solvely-Colin

Verified:
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: Solvely-Colin <211764741+Solvely-Colin@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
execute008 pushed a commit to execute008/openclaw that referenced this pull request Mar 2, 2026
…thanks @Solvely-Colin

Verified:
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: Solvely-Colin <211764741+Solvely-Colin@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
dorgonman pushed a commit to kanohorizonia/openclaw that referenced this pull request Mar 3, 2026
…thanks @Solvely-Colin

Verified:
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: Solvely-Colin <211764741+Solvely-Colin@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
sachinkundu pushed a commit to sachinkundu/openclaw that referenced this pull request Mar 6, 2026
…thanks @Solvely-Colin

Verified:
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: Solvely-Colin <211764741+Solvely-Colin@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
…thanks @Solvely-Colin

Verified:
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: Solvely-Colin <211764741+Solvely-Colin@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
zooqueen added a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
Mateljan1 pushed a commit to Mateljan1/openclaw that referenced this pull request Mar 7, 2026
…thanks @Solvely-Colin

Verified:
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: Solvely-Colin <211764741+Solvely-Colin@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: slack Channel integration: slack size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants