

























@@ -111,31 +111,25 @@ function isCrossChatMismatch(
111111cached: BlueBubblesReplyCacheEntry,
112112ctx: BlueBubblesChatContext,
113113): boolean {
114+// Compare each identifier independently based on availability on both sides.
115+// Earlier versions gated chatIdentifier/chatId comparisons on `!ctxChatGuid`,
116+// which let any non-empty `ctx.chatGuid` suppress the fallback checks when
117+// the cached entry happened to lack chatGuid — letting a short id from
118+// chat A be reused while acting in chat B.
114119const cachedChatGuid = normalizeOptionalString(cached.chatGuid);
115120const ctxChatGuid = normalizeOptionalString(ctx.chatGuid);
116-if (cachedChatGuid && ctxChatGuid && cachedChatGuid !== ctxChatGuid) {
117-return true;
121+if (cachedChatGuid && ctxChatGuid) {
122+return cachedChatGuid !== ctxChatGuid;
118123}
119124const cachedChatIdentifier = normalizeOptionalString(cached.chatIdentifier);
120125const ctxChatIdentifier = normalizeOptionalString(ctx.chatIdentifier);
121-if (
122-!ctxChatGuid &&
123-cachedChatIdentifier &&
124-ctxChatIdentifier &&
125-cachedChatIdentifier !== ctxChatIdentifier
126-) {
127-return true;
126+if (cachedChatIdentifier && ctxChatIdentifier) {
127+return cachedChatIdentifier !== ctxChatIdentifier;
128128}
129129const cachedChatId = typeof cached.chatId === "number" ? cached.chatId : undefined;
130130const ctxChatId = typeof ctx.chatId === "number" ? ctx.chatId : undefined;
131-if (
132-!ctxChatGuid &&
133-!ctxChatIdentifier &&
134-cachedChatId !== undefined &&
135-ctxChatId !== undefined &&
136-cachedChatId !== ctxChatId
137-) {
138-return true;
131+if (cachedChatId !== undefined && ctxChatId !== undefined) {
132+return cachedChatId !== ctxChatId;
139133}
140134return false;
141135}
@@ -145,17 +139,19 @@ function describeChatForError(values: {
145139chatIdentifier?: string;
146140chatId?: number;
147141}): string {
142+// Surface only the *shape* of the chat target, never the raw identifier,
143+// to avoid leaking phone numbers / email addresses / chat GUIDs into
144+// error messages that may end up in agent transcripts, tool results,
145+// remote channel deliveries, or third-party log aggregators.
148146const parts: string[] = [];
149-const guid = normalizeOptionalString(values.chatGuid);
150-if (guid) {
151-parts.push(`chatGuid=${guid}`);
147+if (normalizeOptionalString(values.chatGuid)) {
148+parts.push("chatGuid=<redacted>");
152149}
153-const identifier = normalizeOptionalString(values.chatIdentifier);
154-if (identifier) {
155-parts.push(`chatIdentifier=${identifier}`);
150+if (normalizeOptionalString(values.chatIdentifier)) {
151+parts.push("chatIdentifier=<redacted>");
156152}
157153if (typeof values.chatId === "number") {
158-parts.push(`chatId=${values.chatId}`);
154+parts.push("chatId=<redacted>");
159155}
160156return parts.length === 0 ? "<unknown chat>" : parts.join(", ");
161157}
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。