Skip to content

fix(webapp): keep PHI out of PostHog and Sentry - #6906

Open
macko911 wants to merge 5 commits into
masterfrom
matej/nan-6428-hipaa-posthog-and-sentry-mustnt-capture-any-potential-phi
Open

fix(webapp): keep PHI out of PostHog and Sentry#6906
macko911 wants to merge 5 commits into
masterfrom
matej/nan-6428-hipaa-posthog-and-sentry-mustnt-capture-any-potential-phi

Conversation

@macko911

@macko911 macko911 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Problem

The dashboard renders customer-supplied data (records, logs, connection metadata, action outputs) that can contain PHI, and our frontend telemetry captures some of it: PostHog session recordings only mask inputs (rendered text is recorded), Sentry runs session replays in prod, and the SWR fetcher throws the full API response body, which Sentry serializes into error events. If PostHog or Sentry receive PHI they become PHI subprocessors and we'd need BAAs with both.

Solution

  • PostHog: mask all rendered text in session recordings (maskTextSelector: '*' + maskTextFn) and autocapture (mask_all_text, mask_all_element_attributes) by default, so new UI can't leak by accident; static Nango-owned chrome opts out via data-ph-unmask (applied to sidebar nav labels).
  • Sentry: remove replayIntegration() entirely; drop console breadcrumbs; strip serialized non-Error throw payloads via beforeSend; pin sendDefaultPii: false.
  • SWRError is now a real Error subclass (same json/status fields, all consumers unchanged), so Sentry only sees name/message/stack instead of the response body.

Connection ids are deliberately not scrubbed from captured URLs: Nango has generated UUID4 ids for years, and customers are required to keep PHI out of custom ids.

Fixes NAN-6428

Testing

  • Verified live against the dev API: Sentry's runtime integration list no longer contains Replay, and a console.log with a canary string produced zero console breadcrumbs while fetch/nav/click breadcrumbs flowed normally.
  • Recording text masking (and the data-ph-unmask opt-out) will be validated end-to-end with a sentinel sweep after deploy, per the ticket.

Customer-supplied data rendered in the dashboard (records, logs,
connection metadata) can contain PHI and must not reach telemetry
subprocessors (NAN-6428):

- Mask all rendered text in PostHog session recordings and
  autocapture by default; static Nango-owned chrome can opt out
  via data-ph-unmask.
- Remove Sentry session replays entirely.
- Drop console breadcrumbs and strip serialized non-Error throw
  payloads from Sentry events; SWRError is now a real Error
  subclass so response bodies stay out of error reports.
- Redact customer-chosen connection ids from URLs captured by
  both tools.
@linear-code

linear-code Bot commented Jul 24, 2026

Copy link
Copy Markdown

NAN-6428

@github-actions

github-actions Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Preview Deploy

Status URL Deploy Logs Last Updated
✅ Ready Preview URL Deploy Logs 24 Jul 2026, 11:20 UTC

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 6 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread packages/webapp/src/utils/sentry.tsx Outdated
Comment thread packages/webapp/src/main.tsx Outdated
macko911 added 2 commits July 24, 2026 12:11
Session recordings capture network entries whose urls include
/api/v1/connections/<id>; run them through the same redaction as
event urls so recordings can keep network timing enabled.
Navigation breadcrumbs carry urls in data.from/data.to, not data.url.
rrweb matches maskTextSelector against ancestors, so the :not()
opt-out never applied; mask everything and unmask via maskTextFn.
@macko911
macko911 marked this pull request as ready for review July 24, 2026 10:30
@macko911
macko911 requested a review from a team July 24, 2026 10:37
Connection ids are UUID4-generated for years and customers are
required to keep PHI out of custom ids, so redacting them from
PostHog/Sentry urls adds moving parts without a real risk behind
it. Masking, replay removal and error-payload fixes stay.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant