fix(feishu extension): forward reply target context in outbound sends#33575
fix(feishu extension): forward reply target context in outbound sends#33575bmendonca3 wants to merge 2 commits intoopenclaw:mainfrom
Conversation
Greptile SummaryThis PR correctly fixes a bug in the Feishu extension where outbound Changes verified:
The implementation is correct, backward-compatible, and ready to merge. Confidence Score: 5/5
Last reviewed commit: f85ec61 |
🔒 Aisle Security AnalysisWe found 1 potential security issue(s) in this PR:
1. 🟠 Feishu outbound IDOR: unvalidated replyToId/threadId can redirect replies to arbitrary message/chat
Description
Because Feishu’s This becomes a cross-conversation / cross-tenant risk when
Impact:
Vulnerable code (new forwarding of user-controlled IDs): sendText: async ({ cfg, to, text, accountId, replyToId, threadId }) => {
const replyToMessageId = resolveReplyToMessageId({ replyToId, threadId });
...
return sendMessageFeishu({ cfg, to, text, accountId, replyToMessageId });
}Relevant sink (reply uses only if (replyToMessageId) {
return await client.im.message.reply({
path: { message_id: replyToMessageId },
data: { ... }
});
}RecommendationConstrain Recommended options (choose one or combine):
import { getMessageFeishu } from "./send.js";
const replyInfo = replyToMessageId
? await getMessageFeishu({ cfg, messageId: replyToMessageId, accountId })
: null;
if (!replyInfo || replyInfo.chatId !== normalizeFeishuTarget(to) /* or resolved receiveId */) {
// refuse to reply (or fall back to non-reply create)
replyToMessageId = undefined;
}
Also consider returning/recording the actual destination chat id for replies (if Feishu API doesn’t provide it, fetch/verify it) to avoid misleading logs/auditing. Analyzed PR: #33575 at commit Last updated on: 2026-03-04T17:28:35Z |
|
Thanks again for this work. This PR is being closed as part of an AI-assisted PR merge/triage workflow. This landed indirectly via the synthesized PR #33789, and your contribution is credited in the changelog and as a co-author on the merge commit. Closing this PR as superseded by #33789. If anything here looks incorrect or incomplete, reply to reopen and we can reassess. |
|
Closing as superseded by #33789. |
Summary
Describe the problem and fix in 2–5 bullets:
extensions/feishuoutboundsendText/sendMediadropped reply target context (replyToId/threadId).replyToId ?? threadId) and forwardedreplyToMessageIdthrough text/media send paths.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
Feishu extension outbound sends now preserve reply target context by mapping
replyToId/threadIdtoreplyToMessageIdfor both text and media sends.Security Impact (required)
Yes/No) NoYes/No) NoYes/No) NoYes/No) NoYes/No) NoYes, explain risk + mitigation:Repro + Verification
Environment
extensions/feishu)Steps
sendTextorsendMediawithreplyToIdorthreadIdset.sendMessageFeishu/sendMediaFeishuinextensions/feishu/src/outbound.ts.replyToMessageIdis not forwarded.Expected
replyToMessageId.Actual
Evidence
Attach at least one:
Failing before fix:
pnpm test extensions/feishu/src/outbound.test.tsreplyToMessageIdwas missing.Passing after fix:
pnpm test extensions/feishu/src/outbound.test.tspnpm checkHuman Verification (required)
What you personally verified (not just CI), and how:
replyToIdforwarding onsendText,threadIdfallback forwarding onsendMedia.Compatibility / Migration
Yes/No) YesYes/No) NoYes/No) NoFailure Recovery (if this breaks)
c129a691fc.extensions/feishu/src/outbound.ts,extensions/feishu/src/outbound.test.ts.Risks and Mitigations
List only real risks for this PR. Add/remove entries as needed. If none, write
None.replyToIdfirst, thenthreadId) covered by regression tests.