diff --git a/packages/rum-core/src/domain/privacy.spec.ts b/packages/rum-core/src/domain/privacy.spec.ts
index 2155388cf5..72cb6ba123 100644
--- a/packages/rum-core/src/domain/privacy.spec.ts
+++ b/packages/rum-core/src/domain/privacy.spec.ts
@@ -175,6 +175,11 @@ describe('getNodeSelfPrivacyLevel', () => {
html: '',
expected: NodePrivacyLevel.MASK,
},
+ {
+ msg: 'is an "input" element and has an autocomplete attribute ending with "-password" (forced override)',
+ html: '',
+ expected: NodePrivacyLevel.MASK,
+ },
{
msg: 'is an "input" element and has an autocomplete attribute not starting with "cc-"',
html: '',
diff --git a/packages/rum-core/src/domain/privacy.ts b/packages/rum-core/src/domain/privacy.ts
index 512b65cb0b..13faf19537 100644
--- a/packages/rum-core/src/domain/privacy.ts
+++ b/packages/rum-core/src/domain/privacy.ts
@@ -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
}
}