-
Notifications
You must be signed in to change notification settings - Fork 213
Enable scrubbing options for dom inputs #1383
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! I think I found something in the scrubInputValue
logic where I'm not sure what it does is what we want, so left two comments.
src/browser/telemetry.js
Outdated
this.maskInputOptions[inputType] | ||
) { | ||
if (this.maskInputFn) { | ||
value = this.maskInputFn(value, element); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If value
happens to be masked in the conditionals in line 802:813, you'd be passing the masked value to this.maskInputFn
here.
Maybe store the value in some originalValue
var and pass that here?
src/browser/telemetry.js
Outdated
if ( | ||
domUtil.isMatchingElement(element, this.scrubClasses, this.scrubSelectors) | ||
) { | ||
value = mask; | ||
} | ||
|
||
if (inputType === 'password') { | ||
value = mask; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this override the return value of the custom this.maskInputFn
? Is that expected behavior?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is expected. If it's a password field, it is always masked. Making it an early return at the top would make that more obvious.
test/browser.telemetry.test.js
Outdated
((options = { scrubFields, autoInstrument: { log: false } }), | ||
(rollbar = new Rollbar({}))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
non-blocking, don't feel strongly, just asking
Is there any reason this is like this and not just
options = { scrubFields, autoInstrument: { log: false } };
rollbar = new Rollbar({});
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think prettier did this? Let me see what happens when I undo it.
test/fixtures/html/dom-events.html
Outdated
<title>Elements for testing DOM event handling</title> | ||
</head> | ||
<body> | ||
<div class="container" id"main-container"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yikes, there's an =
missing between id
and "main-container"
here!
Description of the change
Enables scrubbing of DOM inputs in telemetry.
telemetryScrubber
andscrubTelemetryInputs
as documented here: https://docs.rollbar.com/docs/rollbarjs-telemetryType of change
Checklists
Development