From 9025597ce46cbb4fa66f418c3613c178fb4810ab Mon Sep 17 00:00:00 2001 From: Dotta <34892728+cryppadotta@users.noreply.github.com> Date: Thu, 12 Nov 2026 20:06:39 -0600 Subject: [PATCH] fix(feedback): keep run ids and dates intact when redacting phone numbers (#21251) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - People can export a feedback bundle that holds run records for review > - The bundle is redacted before export, and one rule removes phone numbers > - The phone rule also matched two all-digit groups inside a run UUID > - A run id such as `9224d1c8-1dbf-4314-9924-e16fcf3ad1fa` became `9224d1c8-1dbf-[REDACTED_PHONE]-e16fcf3ad1fa`, so the bundle no longer named its run > - This pull request keeps UUIDs and ISO dates out of the phone rule > - The benefit is that exported ids and dates stay correct and real phone numbers stay redacted ## Linked Issues or Issue Description **What happened?** In the paid chat eval `cli-operations.feedback-bundle`, the exported bundle's `envelope.targetId` was `9224d1c8-1dbf-[REDACTED_PHONE]-e16fcf3ad1fa`. The phone rule `(? --- .../src/__tests__/feedback-redaction.test.ts | 12 +++++++++ server/src/services/feedback-redaction.ts | 25 +++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/server/src/__tests__/feedback-redaction.test.ts b/server/src/__tests__/feedback-redaction.test.ts index 868cbb399a7..85c8aa6059c 100644 --- a/server/src/__tests__/feedback-redaction.test.ts +++ b/server/src/__tests__/feedback-redaction.test.ts @@ -81,6 +81,18 @@ describe("feedback redaction", () => { expect(output).toContain("[REDACTED_PHONE]"); }); + it("keeps run ids and dates intact while still redacting a phone number beside them", () => { + const state = createFeedbackRedactionState(); + const runId = "9224d1c8-1dbf-4314-9924-e16fcf3ad1fa"; + const allDigitId = "12345678-1234-4234-9234-123456789012"; + const input = `Run ${runId} and ${allDigitId} on 2026-11-12 at 2026-11-12 00:43:37; call +1 (415) 555-1234.`; + + expect(sanitizeFeedbackText(input, state, "body", 10_000)).toBe( + `Run ${runId} and ${allDigitId} on 2026-11-12 at 2026-11-12 00:43:37; call [REDACTED_PHONE].`, + ); + expect(finalizeFeedbackRedactionSummary(state).counts).toEqual({ phone: 1 }); + }); + it("preserves nested metadata while masking structured secrets", () => { const state = createFeedbackRedactionState(); const input = { diff --git a/server/src/services/feedback-redaction.ts b/server/src/services/feedback-redaction.ts index e57341407d5..43db38d6eac 100644 --- a/server/src/services/feedback-redaction.ts +++ b/server/src/services/feedback-redaction.ts @@ -17,8 +17,12 @@ type RedactionPattern = { kind: string; regex: RegExp; replacement: PatternReplacement; + preservesIdentifiers?: boolean; }; +const PUBLIC_IDENTIFIER_RE = + /\b(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|\d{4}-\d{2}-\d{2}(?:[T ]\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:?\d{2})?)?)\b/gi; + const SECRET_ASSIGNMENT_RE = /\b(api[-_]?key|access[-_]?token|auth(?:_?token)?|authorization|bearer|secret|passwd|password|credential|jwt|private[-_]?key|cookie|connectionstring)\s*[:=]\s*([^\s,;]+)/gi; @@ -67,6 +71,7 @@ const FREE_TEXT_PATTERNS: RedactionPattern[] = [ kind: "phone", regex: /(? { const replacement = typeof pattern.replacement === "function"