Repository navigation
🐛 [RUM-SR] Mask <video poster> under MASK privacy levels - #5297
kcro303913 wants to merge 2 commits into
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
The `poster` attribute on <video> elements was never masked. Under the default `mask` privacy level this leaks the poster image — often a data URL embedding an actual frame/screenshot — into Session Replay, exactly like an unmasked <img src>. Treat `<video poster>` like `<img src>`: flag it in shouldMaskAttribute() and, when masked, emit a size-matched censored placeholder so the replay keeps the video's layout. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: 624ed2a | Docs | View more details | Give us feedback! |
Bundles Sizes Evolution
|
4f461d0 to
930c413
Compare
|
I have read the CLA Document and I hereby sign the CLA |
There was a problem hiding this comment.
Videos sized by their posters can grow in replay because the masked placeholder includes borders, padding, and CSS transforms in its intrinsic dimensions.
🤖 Bits Code Review · Commit 930c413
…Attribute.ts Co-authored-by: datadog-official[bot] <214633350+datadog-official[bot]@users.noreply.github.com>
There was a problem hiding this comment.
More details
The PR masks video posters under mask and mask-unless-allowlisted privacy levels. The follow-up fixes the earlier border, padding, and transform sizing regression by using content-box dimensions; focused browser checks confirm layout preservation, and no findings remain open.
🤖 Bits Code Review · Commit 624ed2a
Motivation
A customer with Session Replay enabled and the default
defaultPrivacyLevel: 'mask'reported that the image on a
<video>element rendered unmasked in the replay.The culprit is the
posterattribute.shouldMaskAttribute()masks<img src/srcset>and
<source src/srcset>, but never<video poster>. A poster is an image (very oftena
data:URL embedding an actual frame/screenshot) rendered in the video's box beforeplayback, so leaving it unmasked leaks user data exactly like an unmasked
<img src>.Changes
Treat
<video poster>like<img src>:privacy.ts—shouldMaskAttribute()now returnstrueforVIDEO/posterunder themaskandmask-unless-allowlistedlevels.serializeAttribute.ts— when masked, emit a censored placeholder sized to the video'sbounding box (
censoredImageForSize), falling back toCENSORED_IMG_MARKwhen the sizeis unknown, so the replay keeps the video's layout.
Behavior matches the existing
<img src>contract: unmasked underallow/mask-user-input,dropped under
hidden, masked undermask/mask-unless-allowlisted.Test instructions
DD_RUM.init({ ..., defaultPrivacyLevel: 'mask' })and Session Replay on,add
<video poster="data:image/png;base64,...">.sized to the video, not the original image.
Unit tests added to
serializeAttributes.spec.ts(<video poster>→maskable-image,<div poster>→always-unmasked). Ran locally:serializeAttributes.spec.ts— 13/13 passprivacy.spec.ts— 88/88 passChecklist