Files
claudemesh/apps/cli/tests/unit/inbound-undecryptable.test.ts
Alejandro Gutiérrez b5bb19c59c fix(cli): never inject undecryptable ciphertext into a session (bug2)
A sealed DM (nonce + senderPubkey) that no key opened fell through to a
base64 "plaintext" fallback. Buffer#toString never throws — invalid bytes
become U+FFFD — so the raw ciphertext reached Claude as
«21e425db: ��a.�tH�/…» (flexicar report 2026-09-26).

- daemon/inbound: the base64 fallback only applies to unsealed v1
  broadcasts, decoded with a fatal TextDecoder + renderable-text check.
  An undecryptable topic post renders an honest placeholder pointing at
  `topic tail`; anything else is dropped: logged `inbound_decrypt_failed`,
  acked (stops redelivery), no inbox row, no bus event.
- mcp/server: second guard — a body with U+FFFD or C0 controls is never
  emitted as a channel notification.
- utils/text: isRenderableText + decodeBase64Utf8.

Test fails 3/6 on the old inbound.ts, passes on the new one.
Spec: .artifacts/specs/2026-09-26-session-identity-and-routing.md §1

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-26 21:29:03 +01:00

4.2 KiB