Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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/rrweb-snapshot/src/rebuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,11 @@ function buildNode(
}
}
}
// Disable autocomplete on input fields to prevent the viewer's
// personal data from appearing during replay
if (tagName === 'input' || tagName === 'textarea') {
node.setAttribute('autocomplete', 'off');
}
return node;
}
case NodeType.Text:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,17 +361,17 @@ exports[`integration tests > [html file]: form-fields.html 1`] = `
</head> <body>
<form>
<label for=\\"text\\">
<input type=\\"text\\" value=\\"1\\" />
<input type=\\"text\\" value=\\"1\\" autocomplete=\\"off\\" />
</label>
<label for=\\"radio\\">
<input type=\\"radio\\" checked=\\"\\" />
<input type=\\"radio\\" checked=\\"\\" autocomplete=\\"off\\" />
</label>
<label for=\\"checkbox\\">
<input type=\\"checkbox\\" checked=\\"\\" />
<input type=\\"checkbox\\" checked=\\"\\" autocomplete=\\"off\\" />
</label>
<label for=\\"textarea\\">
<textarea name=\\"\\" id=\\"\\" cols=\\"30\\" rows=\\"10\\">1234</textarea>
<textarea name=\\"\\" id=\\"\\" cols=\\"30\\" rows=\\"10\\">1234</textarea>
<textarea name=\\"\\" id=\\"\\" cols=\\"30\\" rows=\\"10\\" autocomplete=\\"off\\">1234</textarea>
<textarea name=\\"\\" id=\\"\\" cols=\\"30\\" rows=\\"10\\" autocomplete=\\"off\\">1234</textarea>
</label>
<label for=\\"select\\">
<select name=\\"\\" id=\\"\\" value=\\"2\\">
Expand All @@ -380,7 +380,7 @@ exports[`integration tests > [html file]: form-fields.html 1`] = `
</select>
</label>
<label>
<input name=\\"tagName\\" />
<input name=\\"tagName\\" autocomplete=\\"off\\" />
</label>
</form>

Expand Down
Loading