Skip to content

feat: Ensure password inputs are always masked#78

Merged
mydea merged 2 commits intosentry-v1from
fn/never-unmask-passwords
Mar 8, 2023
Merged

feat: Ensure password inputs are always masked#78
mydea merged 2 commits intosentry-v1from
fn/never-unmask-passwords

Conversation

@mydea
Copy link
Copy Markdown
Member

@mydea mydea commented Mar 7, 2023

This PR does two things:

  1. Ensure you cannot opt-out of masking type="password" inputs
  2. Ensure inputs that used to have type=password and have this type changed (so e.g. through a "show password" toggle) always keep the password masked, even afterwards.

We should never record passwords, and e.g. toggle password type buttons are quite common and would easily leak the password into the replay as of now.

We do this by adding a rr_is_password attribute to the HTML input when the type is changed from password to something else. This is IMHO the easiest solution for this, and since we only add this when the type is really changed (so not eagerly for all inputs) IMHO it's an acceptable tradeoff to have this in the DOM.

Closes #34

@mydea mydea requested review from Lms24 and billyvg March 7, 2023 12:12
@mydea mydea self-assigned this Mar 7, 2023
Copy link
Copy Markdown
Member

@billyvg billyvg left a comment

Choose a reason for hiding this comment

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

Is this something we'd want to upstream? If so it should probably an option, though we could start an issue since 2.0 would be a good place to make that breaking change.

The password -> text is a good candidate to upstream though 👍

// Change type to text (simulate "show password")
await page.click('#show-password');
await page.type('#password', 'XY');
await page.click('#show-password');
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.

This toggles it back to type: password? It might be better to test leaving it as text

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We test before this line (on 512) that it works while being a text field, so I think this should be OK?

Copy link
Copy Markdown
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

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

Nice, thanks for addressing this!

@mydea
Copy link
Copy Markdown
Member Author

mydea commented Mar 8, 2023

Is this something we'd want to upstream? If so it should probably an option, though we could start an issue since 2.0 would be a good place to make that breaking change.

The password -> text is a good candidate to upstream though 👍

Yeah, I think the type change stuff makes sense to upstream. Not sure if they would like to have the "do not allow to opt-out of password" stuff upstream, but I guess I can also just ask!

@mydea
Copy link
Copy Markdown
Member Author

mydea commented Mar 8, 2023

Added upstream PR: rrweb-io#1170

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.

Never unmask password inputs

3 participants