fix(slack): propagate mediaLocalRoots through Slack send path

Restore Slack local file upload parity with CVE-era local media allowlist enforcement by threading `mediaLocalRoots` through the Slack send call chain.

- pass `ctx.mediaLocalRoots` from Slack channel action adapter into `handleSlackAction`
- add and forward `mediaLocalRoots` in Slack action context/send path
- pass `mediaLocalRoots` into `sendMessageSlack` for upload allowlist enforcement
- add changelog entry with attribution for this behavior fix

Co-authored-by: 2233admin <1497479966@qq.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
This commit is contained in:
2233admin
2026-03-06 09:52:49 +11:00
committed by GitHub
parent a0b731e2ce
commit 7830366f3c
4 changed files with 10 additions and 1 deletions

View File

@@ -26,6 +26,7 @@ Docs: https://docs.openclaw.ai
### Fixes
- Slack/local file upload allowlist parity: propagate `mediaLocalRoots` through the Slack send action pipeline so workspace-rooted attachments pass `assertLocalMediaAllowed` checks while non-allowlisted paths remain blocked. (synthesis: #36656; overlap considered from #36516, #36496, #36493, #36484, #32648, #30888) Thanks @2233admin.
- Agents/compaction safeguard pre-check: skip embedded compaction before entering the Pi SDK when a session has no real conversation messages, avoiding unnecessary LLM API calls on idle sessions. (#36451) thanks @Sid-Qin.
- Config/schema cache key stability: build merged schema cache keys with incremental hashing to avoid large single-string serialization and prevent `RangeError: Invalid string length` on high-cardinality plugin/channel metadata. (#36603) Thanks @powermaster888.
- iMessage/cron completion announces: strip leaked inline reply tags (for example `[[reply_to:6100]]`) from user-visible completion text so announcement deliveries do not expose threading metadata. (#24600) Thanks @vincentkoc.

View File

@@ -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,
});

View File

@@ -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,
}),
});
},
};

View File

@@ -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,