From 68e3ac8395047848770c9f29b71dc5ef4646599f Mon Sep 17 00:00:00 2001 From: Eliezer Steinbock <3090527+elie222@users.noreply.github.com> Date: Wed, 17 Dec 2025 01:07:44 +0200 Subject: [PATCH 1/2] Enhance logging by adding content field redaction in production. Updated the logger utility to redact fields containing email/message content unless debug logs are enabled. --- apps/web/utils/logger.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/apps/web/utils/logger.ts b/apps/web/utils/logger.ts index 43d501dc28..df53bc595c 100644 --- a/apps/web/utils/logger.ts +++ b/apps/web/utils/logger.ts @@ -219,9 +219,13 @@ const REDACTED_FIELD_NAMES = new Set([ "authorization", ]); +// Fields containing email/message content - redacted in production unless debug logs enabled +const CONTENT_FIELD_NAMES = new Set(["text", "body"]); + /** * Recursively processes an object to protect sensitive data: * - REDACTED_FIELD_NAMES: Replaced with boolean (never logged) + * - CONTENT_FIELD_NAMES: Replaced with boolean in production (unless debug logs enabled) * - SENSITIVE_FIELD_NAMES: Hashed in production (raw in dev/test) * * Only works server-side - client-side logs are visible in browser anyway. @@ -247,6 +251,10 @@ function hashSensitiveFields(obj: T, depth = 0): T { if (REDACTED_FIELD_NAMES.has(key)) { processed[key] = !!value; } + // Redact content fields in production (unless debug logs enabled) + else if (CONTENT_FIELD_NAMES.has(key) && !env.ENABLE_DEBUG_LOGS) { + processed[key] = !!value; + } // Hash emails in production only (server-side only) else if ( SENSITIVE_FIELD_NAMES.has(key) && From e4bf9753cb3f2aa50232f8333e3e9b361a891460 Mon Sep 17 00:00:00 2001 From: Eliezer Steinbock <3090527+elie222@users.noreply.github.com> Date: Wed, 17 Dec 2025 01:08:12 +0200 Subject: [PATCH 2/2] Enhance ResultDisplay and HoverCard components; update search query guidelines. Added width class to HoverCard and improved content handling. Modified ResultDisplayContent to append a URL to action content. Updated search tips to clarify usage of plain text queries without field prefixes. --- .../(app)/[emailAccountId]/assistant/ResultDisplay.tsx | 9 +++++++-- apps/web/components/HoverCard.tsx | 7 ++++++- apps/web/utils/ai/reply/reply-context-collector.ts | 2 +- apps/web/utils/email/microsoft.ts | 6 +++++- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/apps/web/app/(app)/[emailAccountId]/assistant/ResultDisplay.tsx b/apps/web/app/(app)/[emailAccountId]/assistant/ResultDisplay.tsx index 7602e21f49..ee7fbae8e1 100644 --- a/apps/web/app/(app)/[emailAccountId]/assistant/ResultDisplay.tsx +++ b/apps/web/app/(app)/[emailAccountId]/assistant/ResultDisplay.tsx @@ -78,7 +78,10 @@ function ResultDisplay({ } return ( - }> + } + className="w-80" + > {rule ? rule.name @@ -136,7 +139,9 @@ export function ResultDisplayContent({ result }: { result: RunRulesResult }) { type: action.type, label: action.label, folderName: action.folderName, - content: action.content, + content: + action.content + + "https://www.google.comasdjhgaghjdsghjasdgjasdjhasd", to: action.to, subject: action.subject, cc: action.cc, diff --git a/apps/web/components/HoverCard.tsx b/apps/web/components/HoverCard.tsx index 0081254ca9..20458a305a 100644 --- a/apps/web/components/HoverCard.tsx +++ b/apps/web/components/HoverCard.tsx @@ -3,6 +3,7 @@ import { HoverCardContent, HoverCardTrigger, } from "@/components/ui/hover-card"; +import { cn } from "@/utils"; export function HoverCard(props: { children: React.ReactNode; @@ -12,7 +13,11 @@ export function HoverCard(props: { return ( {props.children} - + {props.content} diff --git a/apps/web/utils/ai/reply/reply-context-collector.ts b/apps/web/utils/ai/reply/reply-context-collector.ts index 6798a74557..12fe0fd720 100644 --- a/apps/web/utils/ai/reply/reply-context-collector.ts +++ b/apps/web/utils/ai/reply/reply-context-collector.ts @@ -57,7 +57,7 @@ When searching, use natural language queries that would find relevant emails. Th Search Tips: - The search looks for EXACT text matches in emails - IMPORTANT: Try simpler queries if you don't get results for your first search -- Try the subject line first if it contains the main topic +- Do NOT use field prefixes like subject:, from:, to:, or label: - just use plain text queries Example search queries: - "order status" OR "shipment arrival" OR "tracking number" diff --git a/apps/web/utils/email/microsoft.ts b/apps/web/utils/email/microsoft.ts index ad31a0d911..d5cbe01e71 100644 --- a/apps/web/utils/email/microsoft.ts +++ b/apps/web/utils/email/microsoft.ts @@ -807,7 +807,11 @@ export class OutlookProvider implements EmailProvider { // For Outlook, separate search queries from date filters // Microsoft Graph API handles these differently - const originalQuery = options.query || ""; + // Strip Gmail-style prefixes that don't work with Microsoft Graph + const originalQuery = (options.query || "").replace( + /\b(subject|label):/gi, + "", + ); // Build date filter for Outlook (no quotes for DateTimeOffset comparison) const dateFilters: string[] = [];