Repository navigation
Conversation
Greptile SummaryThis PR adds defense-in-depth guards in Key changes:
Confidence Score: 4/5Safe to merge after addressing the unguarded sendMedia fallback path that can still leak NO_REPLY to end users. The sendText guard is complete and correct. The sendMedia guard covers the primary use-case (mediaUrl present) but misses the no-mediaUrl fallback branch, leaving the original leak vector partially open. This is a present defect on the changed code path that should be fixed before merging. extensions/feishu/src/outbound.ts — the sendMedia fallback block (lines 204–211) needs a NO_REPLY guard matching the one added for sendText.
|
| Filename | Overview |
|---|---|
| extensions/feishu/src/outbound.ts | Adds NO_REPLY guard to sendText (correct) and the conditional text-send inside sendMedia (correct), but the fallback path in sendMedia that fires when no mediaUrl is present is unguarded and still leaks the token. |
| extensions/feishu/src/outbound.test.ts | Adds 4 well-structured test cases covering the sendText and sendMedia (with mediaUrl) guard paths; missing a test for the sendMedia-without-mediaUrl edge case that exposes the leak. |
Comments Outside Diff (1)
-
extensions/feishu/src/outbound.ts, line 204-211 (link)NO_REPLY token leaks through the
sendMediafallback pathWhen
sendMediais called withtext = "NO_REPLY"and nomediaUrl, the guard at line 169 correctly skips the text send, but execution falls through to this fallback block which callssendOutboundTextdirectly with the unguardedtext ?? ""— which is"NO_REPLY". The token is never suppressed on this path.Example triggering flow:
sendMedia({ text: "NO_REPLY", mediaUrl: undefined, ... })- Guard at L169: condition is
false(correctly suppressed) → skip if (mediaUrl)block at L180: skipped (no URL)- L205:
sendOutboundText({ text: "NO_REPLY", ... })→ token leaks to user
This code path isn't covered by the four new test cases (all test the
mediaUrl-present branch). A guard is needed here before the fallback call:// No media URL, just return text result const textToSend = text ?? ""; if (isSilentReplyText(textToSend.trim())) { return { messageId: "suppressed", chatId: "" }; } return await sendOutboundText({ cfg, to, text: textToSend, accountId: accountId ?? undefined, replyToMessageId, });
Prompt To Fix With AI
This is a comment left during a code review. Path: extensions/feishu/src/outbound.ts Line: 204-211 Comment: **NO_REPLY token leaks through the `sendMedia` fallback path** When `sendMedia` is called with `text = "NO_REPLY"` and no `mediaUrl`, the guard at line 169 correctly skips the text send, but execution falls through to this fallback block which calls `sendOutboundText` directly with the unguarded `text ?? ""` — which is `"NO_REPLY"`. The token is never suppressed on this path. Example triggering flow: 1. `sendMedia({ text: "NO_REPLY", mediaUrl: undefined, ... })` 2. Guard at L169: condition is `false` (correctly suppressed) → skip 3. `if (mediaUrl)` block at L180: skipped (no URL) 4. L205: `sendOutboundText({ text: "NO_REPLY", ... })` → token leaks to user This code path isn't covered by the four new test cases (all test the `mediaUrl`-present branch). A guard is needed here before the fallback call: ```typescript // No media URL, just return text result const textToSend = text ?? ""; if (isSilentReplyText(textToSend.trim())) { return { messageId: "suppressed", chatId: "" }; } return await sendOutboundText({ cfg, to, text: textToSend, accountId: accountId ?? undefined, replyToMessageId, }); ``` How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: extensions/feishu/src/outbound.ts
Line: 204-211
Comment:
**NO_REPLY token leaks through the `sendMedia` fallback path**
When `sendMedia` is called with `text = "NO_REPLY"` and no `mediaUrl`, the guard at line 169 correctly skips the text send, but execution falls through to this fallback block which calls `sendOutboundText` directly with the unguarded `text ?? ""` — which is `"NO_REPLY"`. The token is never suppressed on this path.
Example triggering flow:
1. `sendMedia({ text: "NO_REPLY", mediaUrl: undefined, ... })`
2. Guard at L169: condition is `false` (correctly suppressed) → skip
3. `if (mediaUrl)` block at L180: skipped (no URL)
4. L205: `sendOutboundText({ text: "NO_REPLY", ... })` → token leaks to user
This code path isn't covered by the four new test cases (all test the `mediaUrl`-present branch). A guard is needed here before the fallback call:
```typescript
// No media URL, just return text result
const textToSend = text ?? "";
if (isSilentReplyText(textToSend.trim())) {
return { messageId: "suppressed", chatId: "" };
}
return await sendOutboundText({
cfg,
to,
text: textToSend,
accountId: accountId ?? undefined,
replyToMessageId,
});
```
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "fix(feishu): suppress NO_REPLY silent to..." | Re-trigger Greptile
Heartbeat and cron push messages without reply context can bypass the upstream normalize pipeline, leaking the internal NO_REPLY silent token to end users as visible text. Add defense-in-depth guards in feishuOutbound.sendText and sendMedia (matching the existing Slack guard) that suppress NO_REPLY before any Feishu API call. Closes openclaw#56117
2d9d0ce to
112211c
Compare
|
This directly fixes #56117 — Feishu push messages leaking internal NO_REPLY token to end users, which we have tracked as a high-priority issue. The fix follows the same defense-in-depth pattern already used in the Slack plugin, and adds proper test coverage (4 new test cases). LGTM, requesting maintainer review. |
|
Codex review: needs changes before merge. Summary Reproducibility: yes. at source level. On current main, Next step before merge Security Review findings
Review detailsBest possible solution: Land one Feishu-owned fix on current main that filters exact silent tokens before every Feishu outbound text API boundary, preserves media and substantive text, adds focused regression tests, and records the user-facing fix in the changelog. Do we have a high-confidence way to reproduce the issue? Yes, at source level. On current main, Is this the best way to solve the issue? No. The PR chooses the right SDK helper and plugin boundary, but it is incomplete until all Feishu text exits, including the no-media fallback, are guarded and covered by tests plus a changelog entry. Full review comments:
Overall correctness: patch is incorrect Acceptance criteria:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 39bc94e4ddf5. |
|
This assigned pull request has been automatically marked as stale after being open for 27 days. |
|
Closing due to inactivity. |
Summary
NO_REPLYsilent-token guard tofeishuOutbound.sendTextandfeishuOutbound.sendMedia, matching the existing guard in the Slack plugin (extensions/slack/src/send.ts).normalizeReplyPayloadpipeline, leaking the internalNO_REPLYtoken as visible text to end users.sendTextpath now suppresses pureNO_REPLYmessages before any Feishu API call; thesendMediapath stripsNO_REPLYtext captions while still delivering media attachments.Changes
extensions/feishu/src/outbound.ts: ImportisSilentReplyTextfromopenclaw/plugin-sdk/reply-runtimeand add guards in bothsendTextandsendMediahandlers.extensions/feishu/src/outbound.test.ts: Add 4 test cases covering NO_REPLY suppression (exact match, whitespace-padded, substantive text passthrough, media-with-NO_REPLY-caption).Test Plan
pnpm test -- extensions/feishu/src/outbound.test.ts— all 18 tests pass (14 existing + 4 new).Closes #56117