fix(imessage): normalize leading echo-cache corruption bytes#73985
fix(imessage): normalize leading echo-cache corruption bytes#73985openclaw-clownfish[bot] wants to merge 1 commit into
Conversation
🔒 Aisle Security AnalysisWe found 1 potential security issue(s) in this PR:
1. 🔵 Over-permissive echo-cache text normalization can drop attacker-crafted inbound iMessages (echo suppression collision)
Description
This key is used by Impact:
Vulnerable code: function normalizeEchoTextKey(text: string | undefined): string | null {
if (!text) {
return null;
}
const normalized = stripLeadingIMessageEchoCorruption(text.replace(/\r\n?/g, "\n")).trim();
return normalized ? normalized : null;
}While the intent is to handle an iMessage echo corruption artifact, applying this stripping universally to all inbound message text expands canonicalization and introduces collision/suppression risk (CWE-180). RecommendationTighten the normalization to reduce attacker-controlled collisions:
Example approach (gating the stripping behind an explicit flag): function normalizeEchoTextKey(text: string | undefined, opts?: { stripLeadingCorruption?: boolean }): string | null {
if (!text) return null;
const lf = text.replace(/\r\n?/g, "\n");
const maybeStripped = opts?.stripLeadingCorruption ? stripLeadingIMessageEchoCorruption(lf) : lf;
const normalized = maybeStripped.trim();
return normalized ? normalized : null;
}Then call with Analyzed PR: #73985 at commit Last updated on: 2026-04-29T02:45:08Z |
|
Closing this PR because the author has more than 10 active PRs in this repo. Please reduce the active PR queue and reopen or resubmit once it is back under the limit. You can close your own PRs to get back under the limit. |
Greptile SummaryThis PR fixes iMessage echo-cache deduplication failures caused by leading Confidence Score: 5/5Safe to merge — the fix is well-scoped, symmetric across store and lookup paths, and backed by focused regression tests. The logic is correct: normalization is applied identically to both No files require special attention. Reviews (1): Last reviewed commit: "fix(imessage): normalize leading echo-ca..." | Re-trigger Greptile |
|
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Keep this PR open. Current main and the latest release still lack leading iMessage attributedBody corruption-marker normalization in the sent-message echo cache, so the PR is not obsolete or implemented. It should be reviewed or consolidated with the overlapping open Clownfish PR, and the security review should address the non-injective text normalization risk for group echo scopes. Best possible solution: Keep the PR open for maintainer review, preferably as the current candidate or after consolidating with #73891. The best fix should keep the normalization narrowly scoped to proven leading iMessage attributedBody artifacts, add regression tests for corrupted-prefix echoes and preserved interior content, and either address or explicitly bound the group-scope false-positive risk. Any TTL change for #59973 should be decided separately or covered by a narrower follow-up. What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 180033eeaedd. |
|
Thanks for pushing this. We merged the narrower canonical fix in #73942: #73942, merge be445dd. This broader control-byte variant had a real group-scope false-positive risk called out in review; #73942 avoids that by keeping normalization leading-marker-only and preserving tabs, line breaks, and interior markers. Testbox proof: tbx_01kqbp2m7s1mn1nd4fhgnp74wk focused iMessage tests plus check:changed passed. Closing this overlap. |
Summary
Canonical issue: #41330. Related issue: #59973. Source credit: @maguilar631697 via #62191. Preflight also mentions replacement #73891, but it must be hydrated before reuse or merge.
Validation:
pnpm test extensions/imessage/src/monitor/monitor-provider.echo-cache.test.ts;pnpm check:changed.ProjectClownfish replacement details: