TrolyPage

An autonomous Marketing & Sales operating system for businesses that want AI-powered omni-channel growth.

Contact Info

Follow Us

12 min read

Post-Mortem #09: Customer Phone Numbers Leaked in Exported Chat Logs — Fixing PII Masking Rules

TrolyPage

Dec 02, 2026
9 views
Isometric golden glass data cubes moving along a transparent channel through a frosted-sapphire privacy filter lens into muted mint capsules entering a sealed vault.

Customer phone numbers usually leak in exported chat logs because teams export Async CSV conversation or subscriber dumps for external QA review before enabling Data Safety PII masking rules. Crucially, enabling PII masking in TrolyPage protects incoming inference, replies, and alerts going forward, but it does not retroactively purge historical database messages or previously generated CSV files—meaning legacy exports require offline regex sanitization and tighter role boundaries.

Editorial disclosure: Published by TrolyPage, the omni-channel AI marketing and support workspace examined in this field note. Capabilities, pricing, and workspace boundaries reflect live documentation checks completed on December 2, 2026; the incident trace below is framed transparently as a reproducible operational archetype grounded in TrolyPage’s Data Safety and export mechanics rather than a named customer case study.

1. Why Post-Launch Chat Exports Leak Raw Buyer PII

Support teams rarely discover a privacy gap inside the live inbox; they discover it in a shared spreadsheet two weeks after launch. During rapid onboarding on TrolyPage’s omni-channel AI inbox, operators focus on connecting pages, uploading knowledge files (bearing in mind the PDF parser reads embedded text layers and has no OCR for scanned image-only PDFs), and testing replies via pre-live Evaluation Chat. Data Safety PII masking rules often remain in their default off state until an external QA contractor asks for a spreadsheet of recent threads.

When an admin triggers an Async CSV or Excel customer/conversation export—or uses the single-thread chat export tools—the export job pulls directly from stored records. Under the OWASP Logging Cheat Sheet, personally identifiable information (PII) such as phone numbers, email addresses, and government IDs should never sit unredacted in logs or secondary files accessible to viewers who lack raw-data authorization. Likewise, NIST SP 800-122 emphasizes minimizing PII exposure before secondary operational use such as quality assurance or model tuning.

Two workspace mechanics turn a routine QA export into an exposure event:

  • Runtime Masking vs. Verbatim Storage: TrolyPage’s Data Safety rules govern three runtime boundaries—provider_input (text sent to the LLM), customer_output (AI replies), and team_notification (escalation alerts)—using off, flag, redact, or block modes. Conversation transcripts stored prior to enabling redact remain verbatim, and flipping the toggle later does not rewrite past rows.
  • Broad role:admin Seat Assignment: Both /data-export (Async CSV/XLSX exports) and /export-chat are gated to workspace admin roles. Adding agency reviewers or temporary QA contractors as admins—instead of scoping them to standard operator seats—gives them bulk export rights alongside full workspace control.

2. Tradeoff Analysis: Raw Exports vs. Export Bans vs. Day-1 Masking + Scrubbing

Once a team spots unmasked phone numbers in a QA sheet, knee-jerk reactions range from ignoring the issue to banning exports altogether. The table below quantifies the operational, compliance, and labor tradeoffs across all three paths.

Decision Axis Option A: Leave PII Masking Off & Share Raw CSVs Option B: Ban All Exports or Manually Find-and-Replace Weekly Option C: Day-1 Data Safety Rules + Export RBAC + Offline Regex Scrub
Raw PII Exposure Risk 100% exposed: every buyer phone, email, and street address in exported rows is visible to external link holders. 0% under total ban (breaks offline QA), or high residual miss rate when operators rely on manual Ctrl+F edits across 1,000+ rows. 0% in validated shares: new flows masked at runtime; historical CSVs pass deterministic regex check (0 raw hits) before sharing.
Weekly Ops Toil & Error Mode ~5 min/week to export and upload, at the cost of a reportable privacy incident and partner trust erosion. Total ban: 3–5 hrs/week reading threads one by one inside the UI. Manual scrub: 45–90 min/week and frequently mangles 12–14 digit order IDs. <2 min/week running a one-command Python CSV sanitizer on legacy exports while preserving order and tracking IDs.
Workspace Seat & Cost Impact Zero immediate seat savings; exposes full subscriber tables if contractors hold admin rights. Often forces extra paid reviewer seats ($1.00/seat/mo add-on on TrolyPage paid plans) just to inspect threads in-app. Keeps QA contractors off admin seats; admins export on a 1/hr cooldown and share sanitized CSVs with zero extra SaaS spend.
Failure Cost if Chosen Wrong External leak of buyer contact lists, spam/phishing liability, and mandatory link revocation under NIST SP 800-122 incident response. QA cadence stalls completely, or unescaped =/+ characters in manual edits trigger spreadsheet formula errors. Only fails if operators forget the non-retroactive rule and assume toggling Data Safety ON automatically cleans old transcripts.

3. Post-Mortem Dossier: Unmasked Phone Numbers in Shared QA Logs

Following the blameless post-mortem methodology in Google’s SRE Book, this reproducible incident archetype documents how an unmasked export leak occurs and how to contain and permanently close it.

Three-column light-mode architecture diagram tracing an unmasked Async CSV chat export leak, immediate shared-link revocation and non-retroactive historical CSV regex scrubbing, and a hardened Day-1 privacy gate.
Incident lifecycle from unmasked CSV export exposure to non-retroactive historical cleanup and Day-1 Data Safety guardrails.

Part 1 — Symptoms

Three weeks after launching automated Messenger and Website Chat support, an external QA contractor flags that their shared Google Sheet contains full 10-digit buyer mobile numbers, email addresses, and home delivery notes inside the last_message and phone columns. Roughly 1,400 customer conversation rows pulled for prompt-accuracy grading are readable by anyone holding the sheet’s viewer URL. Because the workspace had no Data Safety rules active at launch—and because TrolyPage’s public docs are currently published in Vietnamese—the international ops lead had assumed PII filtering was enabled globally by default.

Part 2 — Logs & Root Cause Trace

Tracing the lifecycle across workspace audit records and export behavior exposes three compounding misconfigurations:

  1. Default-Off Safety Policy: In Agent Builder’s Data Safety configuration, provider_input, customer_output, and team_notification were all left at off. Incoming buyer messages containing phone numbers (for example, 0912 345 678 or +1 415 555 0192) flowed verbatim into conversation storage and downstream payloads.
  2. Excessive Admin Privilege: Three QA and agency collaborators had been invited with admin privileges instead of scoped non-admin roles, violating the least-privilege standard in the OWASP Authorization Cheat Sheet. One collaborator ran an Async CSV customer export (full column preset including phone, email, and address) and pasted it directly into a shared workbook.
  3. Misunderstood Non-Retroactive Masking: When the ops lead noticed the leak mid-incident and switched Data Safety rules to redact, a re-export of last week’s conversations still contained raw phone numbers. Masking intercepts live runtime flows; it does not retroactively purge or rewrite historical conversation rows already committed to storage.

Part 3 — Immediate Hotfix (Containment Under 15 Minutes)

Before touching permanent settings, stop active external exposure immediately:

  • Revoke External Link Access: Open the shared QA Google Sheet, switch link access from Anyone with the link to Restricted per Google Drive’s access revocation workflow, remove external contractor emails from the file ACL, and disable download/copy permissions on all historical drafts.
  • Purge Raw Export Artifacts: Delete any unredacted CSV/XLSX downloads from local workstations, Slack/email attachments, and temporary export links generated by the workspace export queue.
  • Apply Emergency Runtime Masking: In Agent Builder Data Safety, switch provider_input, customer_output, and team_notification to redact and validate sample inputs in the built-in Safety Preview pane before saving.

Part 4 — Permanent Fix (Configuration & RBAC Hardening)

Because TrolyPage’s Public Developer REST API is still in progress, teams cannot wire an automated custom REST export sanitizer directly against a public API endpoint; instead, permanent remediation pairs workspace Data Safety + RBAC controls with an offline sanitization gate (or scoped read-only views via TrolyPage’s 330-tool MCP gateway across 12 servers—noting the pricing page still displays legacy 86-tool copy—where HTTP writes require explicit workspace admin/owner approval).

Control Surface Before (Vulnerable Launch State) After (Hardened Privacy Gate) Operational Verification
Data Safety: provider_input off — raw buyer phones/emails sent to LLM context redact — masks phone, email, card, bank account, and ID numbers Verified via Safety Preview + Evaluation Chat prior to go-live
Data Safety: customer_output off — AI could echo raw contact digits back in chat redact — partial masking preserves last-digit recognition safely Confirmed 0912 345 678 renders masked while order IDs stay intact
Data Safety: team_notification off — raw PII forwarded in internal handoff alerts redact — masks contact fields in external notification payloads Checked test escalation alert after inbox human handoff
Export RBAC (/data-export & /export-chat) 4 admin seats including external QA contractors 1 workspace owner + 1 backup admin; QA scoped to non-admin inbox seat Confirmed non-admin QA seat receives HTTP 403 on bulk export
Historical CSV Sharing Workflow Direct CSV upload to link-shared Google Sheet (unscrubbed) Offline Python regex scrub + CSV formula-prefix escape gate Script asserts 0 unmasked 9–15 digit phone matches before upload

Part 5 — Recurrence-Prevention Rules

  • Pre-Live Privacy Gate: Treat Data Safety configuration and Evaluation Chat verification as mandatory launch blockers alongside knowledge indexing and channel token checks—especially ahead of weekends, since live TrolyPage staff support operates during Vietnam business hours (UTC+7), as highlighted in Post-Mortem #05.
  • Separate QA Views from Admin Exports: Never grant admin status solely so a reviewer can read transcripts. Remember TrolyPage uses AI knowledge + trigger-condition-action rules (not a visual drag-and-drop flow builder), and human handoff pauses AI replies only inside the unified inbox—so keep QA reviewers inside scoped inbox views or give them pre-scrubbed CSV slices.
  • Protect Downstream Sheets from Schema & Formula Drift: When syncing or sharing operational spreadsheets, pair PII scrubbing with header-lock protections as detailed in Post-Mortem #03.

4. Deterministic Python/Regex CSV Sanitizer (Order-ID Safe)

Because turning on PII masking does not rewrite historical transcripts already stored in your workspace, any CSV exported from pre-hardening dates must be scrubbed locally before sharing. Naive regex patterns like \d{9,15} cause collateral damage: they shred 13-digit order IDs, courier tracking numbers, and ISO timestamps (2026-12-02 14:30:00).

The Python 3 script below uses the standard-library re module with three safeguards: (1) an ISO date guard so timestamps remain intact, (2) a 24-character lookbehind context check for business identifiers (order, tracking, ref, sku), and (3) leading-character escaping (=, +, -, @) to neutralize spreadsheet formula risks documented by OWASP CSV Injection guidance. Replace the file paths and run it locally on any legacy export.

import csv
import re
import sys

DATE_RE = re.compile(r"^(?:19|20)\d{2}[-/]\d{1,2}[-/]\d{1,2}")
ORDER_CTX = re.compile(r"(?:order|tracking|ref|sku|ma_don|van_don|txn)[\s:#-]*$", re.I)
PHONE_RE = re.compile(
    r"(?<![A-Za-z0-9_])(?:\+?\d{1,3}[\s.\-]?)?(?:\(?\d{2,4}\)?[\s.\-]?){2,4}\d{3,4}(?![A-Za-z0-9_])"
)
EMAIL_RE = re.compile(r"[A-Za-z0-9._%+\-]+@[A-Za-z0-9.\-]+\.[A-Za-z]{2,}")
FORMULA_PREFIXES = ("=", "+", "-", "@", "\t", "\r")


def mask_cell(value: str, column_name: str = "") -> str:
    if not value:
        return value
    col = column_name.lower()
    if col in ("phone", "mobile", "telephone"):
        digits = re.sub(r"\D", "", value)
        return f"{digits[:3]}****{digits[-3:]}" if len(digits) >= 7 else "****"
    if col in ("email", "customer_email") and "@" in value:
        local, domain = value.split("@", 1)
        return f"{local[:1]}***@{domain}"

    cleaned = EMAIL_RE.sub(
        lambda m: f"{m.group(0)[:1]}***@{m.group(0).split('@', 1)[1]}", value
    )

    def _replace_phone(match: re.Match[str]) -> str:
        raw = match.group(0)
        prefix = cleaned[max(0, match.start() - 24) : match.start()]
        digits = re.sub(r"\D", "", raw)
        if DATE_RE.match(raw) or len(digits) < 9 or len(digits) > 15 or ORDER_CTX.search(prefix):
            return raw
        return f"{digits[:3]}****{digits[-3:]}"

    cleaned = PHONE_RE.sub(_replace_phone, cleaned)
    if cleaned.startswith(FORMULA_PREFIXES) and not re.match(r"^-\d+(\.\d+)?$", cleaned):
        cleaned = "'" + cleaned
    return cleaned


def scrub_csv(src_path: str, dst_path: str) -> None:
    with open(src_path, "r", encoding="utf-8-sig", newline="") as infile, \
         open(dst_path, "w", encoding="utf-8-sig", newline="") as outfile:
        reader = csv.DictReader(infile)
        if not reader.fieldnames:
            raise ValueError("Empty CSV header.")
        writer = csv.DictWriter(outfile, fieldnames=reader.fieldnames)
        writer.writeheader()
        for row in reader:
            writer.writerow({k: mask_cell(v or "", k) for k, v in row.items()})


if __name__ == "__main__":
    scrub_csv(sys.argv[1], sys.argv[2])

5. Day-1 Workspace Privacy & Export Hygiene Checklist

Copy this six-point gate into your internal English workspace runbook (especially important because official TrolyPage documentation is currently in Vietnamese) and verify every item before onboarding external QA staff or exporting customer history:

Dark-mode Data Safety and Export Governance configuration diff comparing vulnerable off defaults against active PII redaction and admin-only CSV permissions, linked to three operational guardrail callouts.
Before-and-after Data Safety and workspace RBAC configuration enforcing runtime PII masking, order ID preservation, and least-privilege export access.
  1. Confirm Plan Connections & Seats Explicitly: Remember that on TrolyPage plans (Free time-limited trial with 50,000 tokens and 10 no-link auto-posts; Lite $8/mo to Scale $104/mo), each Page using both publishing and messaging consumes 2 service connections, extra Pages cost $2.00/mo, and extra seats cost $1.00/mo—budget dedicated non-admin operator seats for reviewers instead of sharing one admin login.
  2. Enable All Three Data Safety Destinations: Set provider_input, customer_output, and team_notification to redact (or block on output/alerts for strict compliance), then run Safety Preview with sample phone numbers, emails, and real order IDs.
  3. Verify Pre-Live in Evaluation Chat: Run at least five multi-turn privacy probes in Evaluation Chat before enabling live auto-reply so you confirm masking works without breaking SKU or tracking lookups.
  4. Audit Workspace role:admin Count Monthly: Restrict admin privileges to workspace owners and lead engineers; verify external QA, content, and shift agents cannot hit /data-export or /export-chat.
  5. Never Share Raw Async CSVs Directly: Always pass historical conversation or subscriber exports (noting Async customer exports enforce a 60-minute cooldown per request) through the Python sanitizer above and verify zero unmasked 9–15 digit phone strings remain.
  6. Lock Downstream Sheet Permissions: Use named-user Restricted sharing rather than link sharing in Google Drive, set sheet download/copy restrictions for contractor viewers, and expire temporary files after the QA sprint closes.

Comments

Your comment will appear after review.

Sign in to comment

No comments to show.