-
Notifications
You must be signed in to change notification settings - Fork 162
✨ [RUM-10415] Add support for action name allowlist masking #3648
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
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3648 +/- ##
==========================================
+ Coverage 92.20% 92.22% +0.02%
==========================================
Files 333 336 +3
Lines 8322 8357 +35
Branches 1874 1894 +20
==========================================
+ Hits 7673 7707 +34
- Misses 649 650 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
8e29d87
to
dc2ecea
Compare
Bundles Sizes Evolution
🚀 CPU Performance
🧠 Memory Performance
|
9654e39
to
489bf17
Compare
packages/rum-core/src/domain/action/privacy/allowedDictionary.ts
Outdated
Show resolved
Hide resolved
packages/rum-core/src/domain/action/privacy/allowedDictionary.spec.ts
Outdated
Show resolved
Hide resolved
packages/rum-core/src/domain/action/privacy/allowedDictionary.ts
Outdated
Show resolved
Hide resolved
packages/rum-core/src/domain/action/privacy/allowedDictionary.ts
Outdated
Show resolved
Hide resolved
packages/rum-core/src/domain/action/privacy/allowedDictionary.ts
Outdated
Show resolved
Hide resolved
packages/rum-core/src/domain/action/privacy/allowedDictionary.ts
Outdated
Show resolved
Hide resolved
packages/rum-core/src/domain/action/privacy/allowedDictionary.ts
Outdated
Show resolved
Hide resolved
packages/rum-core/src/domain/action/privacy/allowedDictionary.ts
Outdated
Show resolved
Hide resolved
packages/rum-core/src/domain/action/privacy/allowedDictionary.ts
Outdated
Show resolved
Hide resolved
lifeCycle.notify(LifeCycleEventType.RAW_RUM_EVENT_COLLECTED, processAction(action)) | ||
) | ||
const actionNameDictionary = createActionAllowList() | ||
addAllowlistObserver(actionNameDictionary) |
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 createActionAllowList()
register the observer? It feels like this code shouldn't need to know about that. (Maybe createActionAllowList()
is really startActionAllowListObserver()
or something?)
Going a bit further: right now, there is no code that removes the allowlist observer when startActionCollection()
's stop()
is called. So we create a new dictionary and add another observer whenever startActionCollection()
is called, but nothing ever removes them, and they keep building up. I don't think we want that.
We should pick one of two approaches:
- Use a single global allowlist observer and dictionary, and never replace them or clear them. (Reasonable, since
$DD_ALLOW
is also global.) - Register the allowlist observer and set up the dictionary when action collection starts; unregister the allowlist observer and clear the underlying dictionary when action collection stops.
The first avoids reprocessing the raw strings when recording restarts, so it has a performance benefit, but naturally you'll have to add some additional affordances for testing with that approach.
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 see.
With the first approach, do we need end-to-end tests or just keeping the contexts in unit tests would be enough? I'm ok to proceed with the second approach for now but clearing the dictionary and re-process could get expensive. We might need some field data on this.
Fixed with the 2nd approach.
|
||
let masked = false | ||
return { | ||
name: name.replace(getMatchRegex(), (word: string) => { |
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.
❓ question: IIUC, when multiple tokens are masked, we might end up with a name like "MASKED MASKED MASKED", which could be confusing from a UI perspective. Especially, given that the other masking strategy displays "Masked Element", shouldn’t we aim for consistency? Do we have product input on this?
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.
Indeed, although Masked Element
is not idea for tokenized the names either, maybe we should seek another way, ie XXX XXX in session replay. Will ping product on this.
@@ -14,8 +14,9 @@ export const enum ActionNameSource { | |||
TEXT_CONTENT = 'text_content', | |||
STANDARD_ATTRIBUTE = 'standard_attribute', | |||
BLANK = 'blank', | |||
MASK_DISALLOWED = 'mask_disallowed', |
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.
💬 suggestion: I find this source name confusing. As mentioned in my other comment, I think we should ensure consistent behavior across our masking strategies. That way, we can keep using MASK_PLACEHOLDER as the source. If we need to identify which masking strategy was applied, we could include it as a separate event attribute. Wdyt?
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.
Ideally, yes we would like to distinguish the two strategies. We did add mask_disallowed
as a name source in rum-event-format
as a separate attribute. But I'm open to change it to another name.
1de7145
to
ce564c5
Compare
617489d
to
129b1aa
Compare
129b1aa
to
549159f
Compare
16affe6
to
6f20b2b
Compare
d69e70c
to
6e5063b
Compare
7c8f655
to
5105112
Compare
/to-staging |
packages/rum-core/src/domain/action/privacy/allowedDictionary.spec.ts
Outdated
Show resolved
Hide resolved
packages/rum-core/src/domain/action/privacy/allowedDictionary.spec.ts
Outdated
Show resolved
Hide resolved
packages/rum-core/src/domain/action/privacy/allowedDictionary.ts
Outdated
Show resolved
Hide resolved
packages/rum-core/src/domain/action/privacy/allowedDictionary.ts
Outdated
Show resolved
Hide resolved
packages/rum-core/src/domain/action/privacy/allowedDictionary.ts
Outdated
Show resolved
Hide resolved
packages/rum-core/src/domain/action/privacy/allowedDictionary.ts
Outdated
Show resolved
Hide resolved
packages/rum-core/src/domain/action/privacy/allowedDictionary.ts
Outdated
Show resolved
Hide resolved
aea0f2c
to
da92015
Compare
ca8df7f
to
045d430
Compare
065c031
to
febd0bb
Compare
39038bd
to
5196475
Compare
Per discussion internally, we changed to the exact match with DD_ALLOW approach. |
/to-staging |
View all feedbacks in Devflow UI.
Commit cf3170f0f0 will soon be integrated into staging-30.
We couldn't automatically merge the commit cf3170f0f0 into staging-30! To solve the conflicts directly in Github, click here to create a fix pull request. Alternatively, you can also click here reset the integration branch or use the following Slack command: |
🚂 Branch Integration: starting soon, merge expected in approximately 11m53s (p90) Commit cf3170f0f0 will soon be integrated into staging-30. |
🚂 Branch Integration Commit cf3170f0f0 has been merged into staging-30 in merge commit 5897d98d7e. Check out the triggered pipeline on Gitlab 🦊 If you need to revert this integration, you can use the following command: |
|
Motivation
Mask action name with allowlists generated from rum privacy build plugin(WIP). This approach is purely client side and allowlist-based. We aim to mask all action names (custom & auto) OOTB with build time configuration using a build plugin.
The raw string literals would be extracted at build time and loaded on demand in runtime with pre-injected helpers. In SDK, we only check action names and node text in SR with allowlist to mask action names.
Note: As we are using
innerText
to get action names, we can over mask in some cases.Changes
Test instructions
Tests with BrowserStack should pass (for regEx compatibility)
Checklist