Files
openclaw/extensions
zw-xysk ebf9fcc02c fix(feishu): log message content JSON parse failures instead of silently swallowing (#107947)
* fix(feishu): log message content JSON parse failures instead of silently swallowing

Replace formatErrorMessage(err) with safe metadata-only logging in
parseFeishuMessageContent to prevent potential message content leaks
through V8 JSON.parse error messages.

Changes:
- Remove formatErrorMessage import (security: V8 JSON.parse errors can
  include input content in the message)
- Log only msgType and optional messageId (safe metadata) when parse
  fails, never the exception message or raw content
- Add assertion that raw content is NOT present in the log output
- Pass messageId through to enable richer diagnostics

The raw content is still preserved as the function return value (existing
fallback behavior).

* fix(feishu): move parse-failure test into getMessageFeishu suite

The test 'logs a safe diagnostic (not raw content) when message content
is not valid JSON' was declared after the closing brace of
describe('getMessageFeishu'), so it did not inherit that suite's fixture
setup and reset hooks (beforeEach/afterAll). Move it inside the suite
so it benefits from the shared mock reset and cleanup.

Fixes ClawSweeper P2: 'Keep the parse-failure test inside the fetch suite'

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-07-29 07:16:24 -04:00
..