mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-12 07:20:45 +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";
|
||||
/** Mutable ref to track if a reply was sent (for "first" mode). */
|
||||
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 ?? "", {
|
||||
...writeOpts,
|
||||
mediaUrl: mediaUrl ?? undefined,
|
||||
mediaLocalRoots: context?.mediaLocalRoots,
|
||||
threadTs: threadTs ?? undefined,
|
||||
blocks,
|
||||
});
|
||||
|
||||
@@ -15,7 +15,10 @@ export function createSlackActions(providerId: string): ChannelMessageActionAdap
|
||||
normalizeChannelId: resolveSlackChannelId,
|
||||
includeReadThreadId: true,
|
||||
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,
|
||||
opts: SlackActionClientOpts & {
|
||||
mediaUrl?: string;
|
||||
mediaLocalRoots?: readonly string[];
|
||||
threadTs?: string;
|
||||
blocks?: (Block | KnownBlock)[];
|
||||
} = {},
|
||||
@@ -167,6 +168,7 @@ export async function sendSlackMessage(
|
||||
accountId: opts.accountId,
|
||||
token: opts.token,
|
||||
mediaUrl: opts.mediaUrl,
|
||||
mediaLocalRoots: opts.mediaLocalRoots,
|
||||
client: opts.client,
|
||||
threadTs: opts.threadTs,
|
||||
blocks: opts.blocks,
|
||||
|
||||
Reference in New Issue
Block a user