mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-19 11:28:38 +00:00
fix(slack): propagate mediaLocalRoots through Slack send path
After the CVE fix in 2026.3.2 added `assertLocalMediaAllowed` enforcement, all outbound file uploads require files to be under explicit allowed directories. The Feishu plugin was patched (#27884) but Slack was not, causing all local file uploads to fail with `LocalMediaAccessError("path-not-allowed")`. The fix propagates `mediaLocalRoots` through the three-layer call chain: 1. slack.actions.ts: pass `ctx.mediaLocalRoots` into handleSlackAction 2. slack-actions.ts: add `mediaLocalRoots` to SlackActionContext, forward to sendSlackMessage 3. actions.ts: accept and pass `mediaLocalRoots` to sendMessageSlack (which already supports it) Fixes #36477 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -50,6 +50,8 @@ export type SlackActionContext = {
|
|||||||
replyToMode?: "off" | "first" | "all";
|
replyToMode?: "off" | "first" | "all";
|
||||||
/** Mutable ref to track if a reply was sent (for "first" mode). */
|
/** Mutable ref to track if a reply was sent (for "first" mode). */
|
||||||
hasRepliedRef?: { value: boolean };
|
hasRepliedRef?: { value: boolean };
|
||||||
|
/** Allowed local media directories for file uploads. */
|
||||||
|
mediaLocalRoots?: readonly string[];
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -209,6 +211,7 @@ export async function handleSlackAction(
|
|||||||
const result = await sendSlackMessage(to, content ?? "", {
|
const result = await sendSlackMessage(to, content ?? "", {
|
||||||
...writeOpts,
|
...writeOpts,
|
||||||
mediaUrl: mediaUrl ?? undefined,
|
mediaUrl: mediaUrl ?? undefined,
|
||||||
|
mediaLocalRoots: context?.mediaLocalRoots,
|
||||||
threadTs: threadTs ?? undefined,
|
threadTs: threadTs ?? undefined,
|
||||||
blocks,
|
blocks,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -15,7 +15,10 @@ export function createSlackActions(providerId: string): ChannelMessageActionAdap
|
|||||||
normalizeChannelId: resolveSlackChannelId,
|
normalizeChannelId: resolveSlackChannelId,
|
||||||
includeReadThreadId: true,
|
includeReadThreadId: true,
|
||||||
invoke: async (action, cfg, toolContext) =>
|
invoke: async (action, cfg, toolContext) =>
|
||||||
await handleSlackAction(action, cfg, toolContext as SlackActionContext | undefined),
|
await handleSlackAction(action, cfg, {
|
||||||
|
...(toolContext as SlackActionContext | undefined),
|
||||||
|
mediaLocalRoots: ctx.mediaLocalRoots,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -159,6 +159,7 @@ export async function sendSlackMessage(
|
|||||||
content: string,
|
content: string,
|
||||||
opts: SlackActionClientOpts & {
|
opts: SlackActionClientOpts & {
|
||||||
mediaUrl?: string;
|
mediaUrl?: string;
|
||||||
|
mediaLocalRoots?: readonly string[];
|
||||||
threadTs?: string;
|
threadTs?: string;
|
||||||
blocks?: (Block | KnownBlock)[];
|
blocks?: (Block | KnownBlock)[];
|
||||||
} = {},
|
} = {},
|
||||||
@@ -167,6 +168,7 @@ export async function sendSlackMessage(
|
|||||||
accountId: opts.accountId,
|
accountId: opts.accountId,
|
||||||
token: opts.token,
|
token: opts.token,
|
||||||
mediaUrl: opts.mediaUrl,
|
mediaUrl: opts.mediaUrl,
|
||||||
|
mediaLocalRoots: opts.mediaLocalRoots,
|
||||||
client: opts.client,
|
client: opts.client,
|
||||||
threadTs: opts.threadTs,
|
threadTs: opts.threadTs,
|
||||||
blocks: opts.blocks,
|
blocks: opts.blocks,
|
||||||
|
|||||||
Reference in New Issue
Block a user