fix(analytics): mask session replays by default, chrome-only unmask (#1639)

* fix(analytics): mask session replays by default, chrome-only unmask

Invert PostHog session-replay masking from visible-by-default with pattern
masking to deny-by-default: every input value is masked wholesale (rrweb
maskAllInputs, no maskInputFn) and every text node is masked unless it sits
under data-ph-unmask chrome or a table column header (th). Chrome tags live
on the shared UI primitives (PageHeader, Label, Button except combobox
triggers, TabsTrigger, Badge, Card/Dialog/Sheet titles, tooltips, help
popovers, empty states, settings labels), and tagged chrome is still
pattern-scrubbed for amounts and person-/organisationsnummer. data-ph-mask
beats data-ph-unmask, so call sites that interpolate user data into chrome
stay masked; a very-thorough audit swept every unmasked primitive and each
found site got a call-site mask. Confirm-dialog wrappers and toasts stay
masked centrally: their copy describes user objects by design. Untagged new
UI over-masks instead of leaking. Privacy policy, RoPA and decision log
updated in the same change.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(analytics): tag detail-section chrome merged from main

The register-detail primitives landed on main after the replay-masking
audit ran: kickers and DefRow labels are static i18n chrome, values stay
masked.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(analytics): close skeptic and review findings on replay masking

Explicit data-ph tags now resolve before the th chrome fallback, so a th
nested inside a data-ph-mask container masks correctly (regression test
added). Seven missed text-leak sites get call-site masks: delete-invoice
and credit-page invoice numbers, IB-correction voucher reference, TIC
orgnr (served unnormalized, so the separator-based scrub cannot be relied
on), articles search-term empty state, dimension segment labels, and
activate-account buttons. The attribute channel is closed with rrweb's
blockClass: inputs whose placeholder carries an effective user value
(salary overrides, correction description, danger-zone confirms, credit
confirm) get ph-no-capture, removing the element from recordings while
the prefill UX stays intact; the pivot-th title attribute is dropped.
Privacy-policy effective date bumped to 2026-08-17.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Mattsson
2026-08-17 11:32:45 +02:00
committed by GitHub
co-authored by Claude Fable 5
parent 1bb423b2b3
commit f8db38f989
74 changed files with 366 additions and 224 deletions
@@ -2373,7 +2373,7 @@ function PurchaseRow({
{/* A chip only when the row deviates: here, when we can actually
tell the user where to go. */}
{purchase.portal && (
<Badge variant="outline" className="text-[10px] font-normal">
<Badge data-ph-mask="" variant="outline" className="text-[10px] font-normal">
{purchase.portal.vendor}
</Badge>
)}
@@ -328,10 +328,13 @@ export default function TicWorkspace({ userId }: WorkspaceComponentProps) {
<CardHeader>
<CardTitle className="flex items-center gap-2 text-base">
<Building2 className="h-4 w-4" />
{profile.companyName}
{/* data-ph-mask: the looked-up company name is user data */}
<span data-ph-mask="">{profile.companyName}</span>
</CardTitle>
<CardDescription>
{profile.orgNumber} &middot; {profile.legalEntityType}
{/* data-ph-mask: TIC serves the orgnr in unnormalized format, so
the separator-based pattern scrub cannot be relied on */}
<span data-ph-mask="">{profile.orgNumber}</span> &middot; {profile.legalEntityType}
{!isActive && (
<span className="ml-2 text-destructive">&middot; {t('deregistered')}</span>
)}
@@ -477,7 +480,8 @@ export default function TicWorkspace({ userId }: WorkspaceComponentProps) {
{profile.statuses.slice(0, 6).map((status, i) => (
<li key={i} className="flex items-center justify-between gap-3 text-sm">
<div className="flex items-center gap-2">
<Badge variant={statusColorToVariant(status.color)}>
{/* data-ph-mask: the Bolagsverket status text is user data */}
<Badge variant={statusColorToVariant(status.color)} data-ph-mask="">
{status.description ?? status.code ?? '-'}
</Badge>
{status.isCeased && (
@@ -179,7 +179,8 @@ export default function CsvImportWizard({
<TableHeader>
<TableRow>
{headers.map(h => (
<TableHead key={h} className="text-xs whitespace-nowrap">{h}</TableHead>
/* data-ph-mask: CSV headers are user data */
<TableHead key={h} data-ph-mask="" className="text-xs whitespace-nowrap">{h}</TableHead>
))}
</TableRow>
</TableHeader>
@@ -341,7 +341,8 @@ export default function MockDataImportDialog<T>({
<TableHeader>
<TableRow>
{csvHeaders.map(h => (
<TableHead key={h} className="text-xs whitespace-nowrap">{h}</TableHead>
/* data-ph-mask: CSV headers are user data */
<TableHead key={h} data-ph-mask="" className="text-xs whitespace-nowrap">{h}</TableHead>
))}
</TableRow>
</TableHeader>