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

fix text obfuscation logic #7735

Merged
merged 5 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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 .changeset/afraid-ways-act.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'highlight.run': patch
---

fix innerText attribute change obfuscation
2 changes: 1 addition & 1 deletion frontend/src/__generated/rr/rr.js
Original file line number Diff line number Diff line change
Expand Up @@ -2574,7 +2574,7 @@ var MutationBuffer = class {
const enableStrictPrivacy = this.privacySetting === "strict";
const obfuscateDefaultPrivacy = this.privacySetting === "default" && shouldObfuscateTextByDefault(value);
const highlightOverwriteRecord = (_b2 = (_a2 = text.node) === null || _a2 === void 0 ? void 0 : _a2.parentElement) === null || _b2 === void 0 ? void 0 : _b2.getAttribute("data-hl-record");
if ((enableStrictPrivacy || obfuscateDefaultPrivacy) && highlightOverwriteRecord && value) {
if ((enableStrictPrivacy || obfuscateDefaultPrivacy) && !highlightOverwriteRecord && value) {
value = obfuscateText(value);
}
return {
Expand Down
43 changes: 43 additions & 0 deletions frontend/src/pages/Buttons/Buttons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
export const Buttons = () => {
const [hasError, setHasError] = useState(false)
const [showWebSocket, setShowWebSocket] = useState(false)
const [email, setEmail] = useState('')
const [sendEmail, { loading }] = useSendEmailSignupMutation()
if (hasError) {
throw new Error('this is a buttons error', {
Expand Down Expand Up @@ -129,6 +130,48 @@ export const Buttons = () => {
This is ignored.{' '}
<img src={Logo} height={16} alt="ignored" />
</div>
<button
onClick={() => {
for (const id of ['1', '2', '3']) {
const elem = document.getElementById(`email-${id}`)!
elem.innerText = `${(Math.random() + 1)
.toString(36)
.substring(7)} test@test.com ${(
Math.random() + 1
)
.toString(36)
.substring(7)}`
}
setEmail(
`${(Math.random() + 1)
.toString(36)
.substring(7)} test@test.com ${(
Math.random() + 1
)
.toString(36)
.substring(7)}`,
)
}}
>
set email
</button>
<div>
<b>hello, this is a b tag</b>
<b key="email-1">{email}</b>
Vadman97 marked this conversation as resolved.
Show resolved Hide resolved
<b id="email-1"></b>
</div>
<div>
<b>hello, this is a b tag</b>
<b key="email-2" data-hl-record>
{email}
</b>
<b data-hl-record id="email-2"></b>
</div>
<div data-hl-record>
<b>hello, this is a b tag</b>
<b key="email-3">{email}</b>
<b id="email-3"></b>
</div>
</div>
<section id="shadowDOM" className="foo" title="yo">
This is the shadow DOM.
Expand Down
2 changes: 1 addition & 1 deletion rrweb
Loading