Repository navigation
fix(snapshot): Don't record the default value of cleared inputs - #349
Conversation
`serializeElementNode` copies every HTML attribute first, then replaces `value` with the (possibly masked) live value. That replacement was skipped when the live value was empty, so a field whose server-rendered default had been cleared, or whose value the browser sanitized away, kept the raw `value` attribute in the snapshot. This applied to password inputs too. Overwrite the attribute whenever the live value or the attribute is present. Full snapshots now record the field's current value, matching the mutation path for `value` changes. Co-Authored-By: George Gritsouk <[email protected]>
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 93a3118. Configure here.
logaretm
left a comment
There was a problem hiding this comment.
LGTM, just one question on the jr description there.
If the field had a value set in the HTML e.g., and it was never filled in by the user (why would a user fill in a hidden input), the current live value is blank, so the value is never stripped, and it leaks into the snapshot.
Is this accurate? i think it will already be masked since a hidden input's .value mirrors its attribute. The leak would be for pre-filled input fields that was cleared, like what the tests show.
|
@logaretm you are right, sorry, I'll update the description! |
…130930) Bumps the Sentry JavaScript SDK from 11.7.0 to [11.12.0](https://github.com/getsentry/sentry-javascript/releases/tag/11.12.0), mainly to pick up rrweb [2.46.0](https://github.com/getsentry/rrweb/releases/tag/2.46.0) (getsentry/sentry-javascript#26241). rrweb 2.46.0 fixes: - Clear leftover nodes when `document.open()` is skipped (getsentry/rrweb#350) - Don't record the default value of cleared inputs (getsentry/rrweb#349) - Keep adopted stylesheets on seek when their first host was removed (getsentry/rrweb#352) - Don't throw when tearing down a locked `adoptedStyleSheets` patch (getsentry/rrweb#351) Changes: - `@sentry/browser`, `@sentry/core`, `@sentry/node`, `@sentry/react`: 11.7.0 → 11.12.0 across `static/app`, `static/gsApp`, `static/gsAdmin`, `static/packages/scraps`, and `tests/js`. - `@sentry/rrweb`, `@sentry/rrweb-player`, `@sentry/rrweb-snapshot`: 2.45.0 → 2.46.0, so the replay player uses the same rrweb as the SDK. - `@sentry/rrweb-types`: 2.44.0 → 2.46.0. This drops the duplicate `@sentry/[email protected]` / `@sentry/[email protected]` entries from the lockfile. <!-- junior-request-attribution:start --> via **George Gritsouk**. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:slack%3AD0AR76A9F5G%3A1794502210.473359 --> Closes REPLAY-1029 Closes REPLAY-1019 -- [View Session](https://junior-prod.sentry.dev/conversations/slack%3AD0AR76A9F5G%3A1794502210.473359) [[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AD0AR76A9F5G%3A1794502210.473359/?project=4510944073809921) <!-- junior-session-footer:end --> Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: George Gritsouk <[email protected]>
This is a somewhat more speculative fix found by Claude, but it makes sense. It was found when rooting around for REPLAY-1035, but isn't part of the original vulnerability report.
serializeElementNodecopies every HTML attribute as-is. It then replacesvaluewith the live value, which is masked when masking applies. That replacement was skipped whenever the live value was empty.If the field had a value set in the HTML e.g.,
<input type="password" value="ruh-roh">and it was never filled in by the user or somehow cleared, the current livevalueis blank, so the value is never stripped, and it leaks into the snapshot.So, if there's ever a situation where the HTML itself had a
value=set but the live values is empty (a cleared pre-filled field, etc.) those values made it into the snapshot.Instead, we need to be careful and make sure to strip the value in both cases.
Related to REPLAY-1035.
We may want to upstream this, too, I didn't see a fix for this problem in the main repo.
via George Gritsouk.
--
View Junior Session [Sentry]