skip to content

A tax-filing web app's forms hold income figures and national ID numbers; what must its error reports strip in the browser, and how do breadcrumbs and consent fit?

level: seniorimportance: must knowfreq 40%

answer

  1. once it leaves, it is everywhere
  2. allow-list, not deny-list
  3. route templates, never raw URLs
  4. breadcrumbs name elements, never values
  5. hold reports until the choice is known

basics

~20 s

Build reports from an allow-list in the browser: route templates instead of URLs, no form values or request bodies, breadcrumbs that name elements but never values, digits masked in messages, and nothing sent until the user's diagnostics choice allows it.

solid answer

~50 s

Scrub in the browser, because once a report leaves the page its contents sit in transit logs, ingest buffers and the error service's storage, out of the app's control; scrubbing at ingest is the second net, not the first. Build each report from an **allow-list** of fields rather than deleting known-bad ones, since the forms change weekly and a deny-list misses the new field. URLs become route templates with no query string; messages have digit runs, emails and quoted values masked, because validation messages often echo what was typed; request breadcrumbs keep method, route template, status and duration but never bodies or headers; UI breadcrumbs record an element's role and a stable name, never typed values or text content. Capture starts early, but reports wait in memory until the user's diagnostics choice is known, are dropped if it is declined, and stop if it is withdrawn.

code

json · 12 lines
json
{
  "release": "2026.10.06-4f9c2a",
  "session": "s-7f3c91",
  "route": "/returns/:returnId/income",
  "type": "RangeError",
  "message": "Value [digits] is outside the allowed range for [field]",
  "breadcrumbs": [
    { "kind": "navigation", "to": "/returns/:returnId/income" },
    { "kind": "click", "role": "button", "name": "save-step" },
    { "kind": "request", "method": "PUT", "route": "/api/returns/:returnId/income", "status": 422, "ms": 310 }
  ]
}

go deeper

for a junior

Recall that error reports can carry personal data from URLs, messages and recent actions, and that it must be removed before anything leaves the page.

for a middle

Explain each leak path in a report and the client rule for it, and why breadcrumbs name elements and requests but never record values.

for a senior

Defend allow-list over deny-list for forms that change weekly, gate sending on the user's choice with capture-early-send-late, and prove the scrubber works with a production tripwire.

for a principal

Decide who owns the allow-list and reviews new fields, and how the page's scrubbing, ingest scrubbing and retention together meet the privacy team's policy.

## Why the browser is where scrubbing happens A **tax-filing web app** holds some of the most sensitive data a person types into a browser: income figures, bank details, dependants, and **national ID numbers**. Error reports are built from exactly the places that data lives: the page URL, the error message, the recent user actions, the requests in flight. **Scrubbing** means removing or masking personal data before it is stored. Doing it only on the server is too late: by then the data has crossed the network, passed through load balancers and logs, and landed in the error service's buffers and storage, possibly in another jurisdiction and under another company's retention. Data that never leaves the device needs no deletion request later. So the client scrubs first, and a server-side scrubber is the second net for what the client missed. Deciding which fields count as personal data is a question for data governance; this design takes that classification as an input and enforces it in the page. ## Where personal data leaks into a report | Field | How it leaks | Client rule | |---|---|---| | Page URL | identifiers in the path, a query string such as `?id=` | replace with the route template, drop query and fragment | | Error message | validation code echoes the value it rejected | mask digit runs of four or more, emails and quoted strings | | UI breadcrumbs | an input's value, a button's text containing a name | record role and a stable name, never values or text content | | Request breadcrumbs | URLs with queries, request and response bodies | method, route template, status, duration only | | Extra context | a snapshot of app state attached for debugging | never attach state; attach named, reviewed fields only | | User identity | the account email or the national ID as user id | a random session id, rotated on sign-out | ## Allow-list beats deny-list A **deny-list** scrubber removes fields whose names look dangerous (`ssn`, `taxId`, `income`). It fails open: next week's release adds a "spouse identifier" field and nobody updates the list. An **allow-list** builds the report only from fields known to be safe, so a new field is simply absent until someone reviews it. For a tax app the allow-list is the default, and the deny-style pattern masking (digit runs, emails) is applied on top, to free text the allow-list cannot avoid, such as messages. ## Breadcrumbs without personal data **Breadcrumbs** are the short trail of events before an error: navigations, clicks, requests, console warnings. They are what makes an error debuggable, so the design keeps them, but records them in a deliberately poor vocabulary: - **navigation**: from route template to route template; - **click**: the element's role and a stable identifier such as a `name` or a data attribute added for the purpose, never its visible text; - **input**: at most "field X changed", never the value, and no keystrokes; - **request**: method, route template, status code, duration. A breadcrumb trail like "opened income step, clicked save-step, PUT income returned 422" is enough to reproduce most bugs and contains nothing about the person. ## Gating on the user's choice What makes a choice valid, and whether error reporting needs consent at all or rests on another basis, is the privacy team's decision. The page's job is to **enforce whatever that decision says**: 1. **Capture early, send late.** Listeners start before the bundle, but reports wait in the in-memory queue until the user's diagnostics choice is known. 2. **Declined: drop the queue and send nothing** beyond what the policy allows without the choice. 3. **Withdrawn mid-session: stop immediately** and drop anything queued. 4. **Read the choice at boot** from where the app stores it, so a reload does not reset it. ## Proving the scrubber works Scrubbers rot quietly, so they need tests and a tripwire. Unit tests feed reports containing fake national IDs and income figures through the scrubber. In production, the ingest side counts reports whose text matches the national-ID pattern; the expected count is zero, and anything above zero alerts the team, which then fixes the client rule and purges the affected reports.

  • Why mask digit runs in error messages when the allow-list already controls which fields are sent?
    The message is a field the report needs, and its text is written by code, including validation code that echoes the rejected input: 'Value 123456789 is not a valid ID'. The allow-list can include or exclude the message, not clean it. Masking digit runs, emails and quoted strings inside messages catches what the allow-list cannot.
  • How would you find out the scrubber has started leaking after a release?
    Run a tripwire at ingest: count reports whose text matches the national-ID pattern or long digit runs. The expected value is zero, so any match alerts the owning team, who fix the client rule, purge the affected reports, and add the case to the scrubber's tests.

  • The error service scrubs on ingest, so the browser can send everything.
  • Masking fields named like ssn or taxId keeps national IDs out of reports.
  • Breadcrumbs should record what the user typed so bugs can be reproduced.
  • The account email is the simplest way to tie reports to a session.
  • Send reports before the user chooses; delete them later if they decline.