Skip to content

fix(snapshot): Don't record the default value of cleared inputs - #349

Merged
gggritso merged 1 commit into
sentry-v2from
fix/mask-cleared-input-defaults
Oct 28, 2026
Merged

gggritso merged 1 commit into
sentry-v2from
fix/mask-cleared-input-defaults

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

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.

serializeElementNode copies every HTML attribute as-is. It then replaces value with 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 live value is 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]

`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]>
@linear-code

linear-code Bot commented Oct 28, 2026

Copy link
Copy Markdown

REPLAY-1035

@gggritso

Copy link
Copy Markdown
Member

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ 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.

@gggritso
gggritso marked this pull request as ready for review October 28, 2026 15:51
@gggritso
gggritso requested a review from a team October 28, 2026 15:52

@logaretm logaretm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

@gggritso

Copy link
Copy Markdown
Member

@logaretm you are right, sorry, I'll update the description!

@gggritso
gggritso merged commit c94bfd6 into sentry-v2 Oct 28, 2026
24 checks passed
@gggritso
gggritso deleted the fix/mask-cleared-input-defaults branch October 28, 2026 21:41
gggritso added a commit to getsentry/sentry that referenced this pull request Nov 12, 2026
…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]>
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.

2 participants