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

[Test CI] add privacy rule for autocomplete password value #3103

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/rum-core/src/domain/privacy.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,11 @@ describe('getNodeSelfPrivacyLevel', () => {
html: '<input type="text" class="dd-privacy-allow" autocomplete="cc-foo">',
expected: NodePrivacyLevel.MASK,
},
{
msg: 'is an "input" element and has an autocomplete attribute ending with "-password" (forced override)',
html: '<input type="text" class="dd-privacy-allow" autocomplete="foo-password">',
expected: NodePrivacyLevel.MASK,
},
{
msg: 'is an "input" element and has an autocomplete attribute not starting with "cc-"',
html: '<input type="text" autocomplete="email">',
Expand Down
4 changes: 2 additions & 2 deletions packages/rum-core/src/domain/privacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ export function getNodeSelfPrivacyLevel(node: Node): NodePrivacyLevel | undefine
return NodePrivacyLevel.MASK
}
const autocomplete = inputElement.getAttribute('autocomplete')
// Handle input[autocomplete=cc-number/cc-csc/cc-exp/cc-exp-month/cc-exp-year]
if (autocomplete && autocomplete.indexOf('cc-') === 0) {
// Handle input[autocomplete=cc-number/cc-csc/cc-exp/cc-exp-month/cc-exp-year/new-password/current-password]
if (autocomplete && (autocomplete.startsWith('cc-') || autocomplete.endsWith('-password'))) {
return NodePrivacyLevel.MASK
}
}
Expand Down