Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ add new privacy rule for autocomplete password value #3094

Merged
merged 2 commits into from
Oct 31, 2024

Conversation

zyhou
Copy link
Contributor

@zyhou zyhou commented Oct 24, 2024

Hello,

Motivation

There are multiple ways to hide an element from RUM Session Replay (documentation):

  • Using an HTML attribute: data-dd-privacy="allow" | "mask" | "hidden" | "mask-user-input"
  • Using CSS classes: class="dd-privacy-allow" | "dd-privacy-mask-user-input" | "dd-privacy-mask" | "dd-privacy-hidden"

By default, some HTML elements are automatically masked:

  • Input elements of type password, email, and tel
  • Elements with autocomplete attributes for credit card numbers, expiration dates, and security codes

However, this doesn't currently handle new-password and current-password autocomplete attributes.

Why isn't type="password" sufficient?
This is mainly due to password visibility toggle components, where libraries and custom code temporarily change the input type from password to text to show the password, then revert it back to password.

image

Changes

I have updated the condition for autocomplete attributes using the same logic as cc- prefixes.
My main question is whether we should use an endsWith logic? This would match the current cc- implementation, or we could be more explicit:

if (autocomplete && (
    autocomplete.indexOf('cc-') === 0 ||
    autocomplete === 'new-password' ||
    autocomplete === 'current-password'
)) {
    return NodePrivacyLevel.MASK
}

Can you update the documentation too?

Testing

  • Local
  • Staging
  • Unit
  • End to end

I have gone over the contributing documentation.

@zyhou zyhou requested a review from a team as a code owner October 24, 2024 16:28
@bits-bot
Copy link

bits-bot commented Oct 24, 2024

CLA assistant check
All committers have signed the CLA.

@cy-moi
Copy link
Contributor

cy-moi commented Oct 31, 2024

Hi @zyhou,
Thank you for contributing! This is a great change. We are going to take over and merge this.

@cy-moi cy-moi merged commit e6d05d0 into DataDog:main Oct 31, 2024
22 checks passed
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.

3 participants