All articles Privacy & compliance

Session Replay Privacy: Masking Done Right

Session Replay Privacy: Masking Done Right

Session replay privacy is not a setting you enable once. A recorder that captures the DOM captures whatever your page renders: the email a person types at signup, the address they paste at checkout, the one-time code they read off their phone. If a data attribute in the browser is the only thing standing between those values and storage, your policy depends on every future front-end change being perfect.

That is where teams get caught. Masking is added during onboarding, one test session looks clean, and nobody checks again. A release later, a component ships without the attribute, or a widget injects a form after the recorder starts — and the session in storage is not the session anyone approved.

Masking done right uses two independent layers: default-deny in the browser, and a second masking pass on the server before anything is written. Either layer alone is a single point of failure.

Why browser-side masking alone is not enough

Browser masking is necessary, and it is the cheapest place to do the work: values never leave the device. But the browser is a moving target.

  • Client-side rendering. Rules can run before the field’s component exists.
  • Third-party widgets. Embedded forms, chat composers and payment elements often render inside iframes you do not control.
  • Custom components. Shadow DOM, contenteditable fields and canvas inputs do not behave like a native input.
  • A client you do not own. A build, an extension or a modified script can drop attributes.
  • Values nobody typed into a form. File names, page titles, error messages and query strings carry personal data too.

Any one of these produces a session your policy says you should not hold. The fix is not to remove browser masking — it is to stop treating it as the last line.

Layer one: mask by default in the browser

Start from default-deny and allowlist the narrow set of regions that are safe: navigation, product copy, images. Redacting a dashboard after the fact costs more than never recording it.

Define three states and apply them in order:

<input type="email" data-replay="mask">
<div data-replay="block">… recovery form …</div>
<p data-replay="allow">Setup guide</p>

Then make the rules survive change. Re-apply them on DOM mutations, not only at load. Cover input, textarea, select, checkboxes and radios, contenteditable and autofill events. Drop request and response bodies for auth, checkout and OTP endpoints instead of redacting them field by field, and treat iframes you do not own as opaque.

Layer two: re-mask on the server, before storage

The collector should assume the payload it receives is hostile. That assumption changes the design: re-apply the rule set server-side, add patterns for emails, phone numbers, card numbers and one-time codes, and strip query strings and headers that can carry identifiers.

Three consequences matter:

  1. Reject, do not repair. If a session cannot be validated against a known policy version, drop the payload and log the reason. A dropped session costs a recording; an unauditable one costs a policy.
  2. Keep hashes, not values. Identifiers belong in your system as keyed hashes for correlation, not as text you can read back.
  3. No unmask path. If a button reveals a masked field, the masking is decorative. Make “no unmask option” a requirement in product review.

Prynt Replay works this way: every form field is masked in the browser and again on the server, and there is no unmask option. Setup is in https://pryntid.com/docs.

What actually needs masking

Build the checklist from how your product renders data, not from your form components:

  • Every input value, including hidden fields and autofill.
  • Text inside contenteditable regions and message composers.
  • File names, upload previews and thumbnails.
  • Email, phone and token fragments in URLs, referrers and page titles.
  • Error messages and logs that quote a value back.
  • Anything inside third-party iframes and embeds.

Set the policy, then prove it works

Masking decides what leaves the page; retention, access and sharing decide who ever sees it. Keep retention to what debugging needs, scope support access to named roles, expire share links, and separate sessions per tenant. If you embed sessions inside your own admin per company or user, that isolation lives in your product: the call carries the account with the user, identify(userId, { accountId }), and the session list stays scoped.

State the purpose in your privacy notice and cover session data in your data processing agreement — ours is at https://pryntid.com/dpa. Honor opt-outs at collection, not after.

Then verify. Put a canary value in a test form, run your normal end-to-end flow, and scan the stored payload for that string. Any hit is a bug with a date on it. Run the same check in CI on every component that touches forms, and review a sample of real sessions after each redesign.

FAQ

Does masking make sessions useless for debugging?

You lose the values, not the journey. Clicks, rage clicks, JavaScript errors, Web Vitals and the order of steps still show where the flow broke, and Py explains a session in plain language so an engineer can read the story without reading what the person typed.

Should we mask text outside forms too?

Yes, wherever the text carries personal data: search queries, chat messages, addresses rendered back to the user, log lines printed to the page. Blanket-masking everything makes replays unreadable; masking whole regions with an allowlist for known-safe copy keeps them useful.

Can support staff unmask a field to solve a ticket?

That is the trade you are making. If support needs the value, read it from the system of record, with its own access controls and audit trail. A recorder that can unmask becomes a second copy of your customers’ data.

Start with masking you can verify

Prynt Replay masks every form field in the browser and again on the server, with no unmask option. The free plan covers 1,000 sessions a month with 14-day retention and one site, bot sessions do not count against your quota, and Pro is $279/month for 10,000 sessions, 30-day retention and three sites, with native mobile replay and Py included. Start at https://pryntid.com/products/replay.

Try it free

Prynt is device intelligence with a free plan: 5,000 identifications a month, visitor IDs with confidence and bot detection — no credit card. Upgrade to Pro for VPN, proxy, tampering and behavioral signals.

Keep reading