fix(feishu): improve interactive card text extraction for all card formats#685
Open
BingqingLyu wants to merge 1 commit intomainfrom
Open
fix(feishu): improve interactive card text extraction for all card formats#685BingqingLyu wants to merge 1 commit intomainfrom
BingqingLyu wants to merge 1 commit intomainfrom
Conversation
…rmats (closes openclaw#32023) Extend parseInteractiveCardContent() to handle additional Feishu card formats that previously returned "[Interactive Card]" placeholder text: - Schema 2.0 cards (body.elements) in addition to 1.0 (elements) - New element tags: plain_text, lark_md, header (title+subtitle), note, column_set - Legacy rich-text content (array-of-arrays with text, a, at, code_block tags) - Top-level card.title string (some legacy formats) - DFS traversal bounded by CARD_MAX_NODES/CARD_MAX_OUTPUT_CHARS to prevent DoS - Sanitize extracted text to strip ANSI escapes and control chars (CWE-117) Add tests for all new element types: schema 2.0, header, lark_md, note, column_set, legacy array-of-arrays, and empty card fallback. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
[Interactive Card]placeholder instead of the actual card content.parseInteractiveCardContent()only handlesdivandmarkdownelement tags.parseInteractiveCardContent()inextensions/feishu/src/send.tsto support schema 2.0 cards (body.elements), additional element tags (plain_text,lark_md,header,note,column_set), legacy rich-textcontent(array-of-arrays withtext/a/at/code_blocktags), and top-levelcard.title. Added DFS traversal bounds (CARD_MAX_NODES=500, CARD_MAX_OUTPUT_CHARS=8000) to prevent DoS, andsanitizeCardText()to strip ANSI escapes/control chars (CWE-117).Change Type
Scope
Linked Issue/PR
Security Impact
Repro + Verification
Steps
header,column_set,plain_textelements) to a groupExpected
Actual (before fix)
[Interactive Card]placeholderEvidence
send.test.tscovering: schema 2.0, header/lark_md/note, column_set, legacy rich-text, and empty card fallbackHuman Verification
Review Conversations
Compatibility / Migration
divandmarkdownextraction paths unchangedFailure Recovery
extensions/feishu/src/send.ts,extensions/feishu/src/send.test.tsRisks and Mitigations
None — purely additive text extraction logic with bounds to prevent DoS.
This PR was AI-assisted (fully tested with unit tests, pre-existing build tooling issues prevent full pnpm build/check locally).