fix(slack): drop mismatched Socket Mode events (#889)

Filter Slack Socket Mode events by api_app_id/team_id.
Refs: #828
Contributor: @roshanasingh4

Co-authored-by: Roshan Singh <roshanasingh4@users.noreply.github.com>
This commit is contained in:
Peter Steinberger
2026-01-14 15:53:45 +00:00
parent 53465a4d2d
commit dadef27d7a
9 changed files with 152 additions and 75 deletions

View File

@@ -10,8 +10,10 @@ import type { SlackPinEvent } from "../types.js";
export function registerSlackPinEvents(params: { ctx: SlackMonitorContext }) {
const { ctx } = params;
ctx.app.event("pin_added", async ({ event }: SlackEventMiddlewareArgs<"pin_added">) => {
ctx.app.event("pin_added", async ({ event, body }: SlackEventMiddlewareArgs<"pin_added">) => {
try {
if (ctx.shouldDropMismatchedSlackEvent(body)) return;
const payload = event as SlackPinEvent;
const channelId = payload.channel_id;
const channelInfo = channelId ? await ctx.resolveChannelName(channelId) : {};
@@ -45,8 +47,10 @@ export function registerSlackPinEvents(params: { ctx: SlackMonitorContext }) {
}
});
ctx.app.event("pin_removed", async ({ event }: SlackEventMiddlewareArgs<"pin_removed">) => {
ctx.app.event("pin_removed", async ({ event, body }: SlackEventMiddlewareArgs<"pin_removed">) => {
try {
if (ctx.shouldDropMismatchedSlackEvent(body)) return;
const payload = event as SlackPinEvent;
const channelId = payload.channel_id;
const channelInfo = channelId ? await ctx.resolveChannelName(channelId) : {};