-
Notifications
You must be signed in to change notification settings - Fork 11
[doc] RUM Privacy Plugin #243
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
Merged
gh-worker-dd-mergequeue-cf854d
merged 3 commits into
master
from
congyao/privacy-plugin-docs
May 6, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,122 @@ | ||
| # RUM Privacy Plugin <!-- #omit in toc --> | ||
|
|
||
| The RUM Privacy Plugin provides action name and session replay masking capabilities for Real User Monitoring (RUM). This plugin helps protect sensitive data while maintaining observability. See [Action Name Deobfuscation](https://docs.datadoghq.com/real_user_monitoring/application_monitoring/browser/build_plugins/action_name_deobfuscation/). | ||
|
|
||
| ## Use Cases | ||
|
|
||
| This plugin is particularly useful for: | ||
|
|
||
| - Masking sensitive data **before** sending them to Datadog | ||
| - Providing an out-of-the-box solution with minimal instrumentation overhead | ||
| - Maintaining observability while ensuring privacy compliance | ||
|
|
||
| ## Reserved Global Variables | ||
|
|
||
| The following global variable is used by this plugin: | ||
|
|
||
| - `$DD_ALLOW` - Contains raw static strings from source code | ||
| - `$DD_A_Q` - Manage the queue of adding to allowlist at runtime | ||
|
|
||
| ## File Inclusion/Exclusion for String Literal Extraction | ||
|
|
||
| ### Default Settings | ||
|
|
||
| Excludes: | ||
|
|
||
| - `node_modules` directories | ||
| - `.preval` files | ||
| - Files that start with special characters | ||
| Includes: | ||
| - files matching `/\.(?:c|m)?(?:j|t)sx?$/` | ||
|
|
||
| To instantiate the plugin with default settings: | ||
|
|
||
| ```javascript | ||
| const { datadogWebpackPlugin } = require('@datadog/webpack-plugin'); | ||
|
|
||
| module.exports = { | ||
| plugins: [ | ||
| datadogWebpackPlugin({ | ||
| rum: { | ||
| privacy: {}, | ||
| }, | ||
| }), | ||
| ], | ||
| }; | ||
| ``` | ||
|
|
||
| ### Overrides | ||
|
|
||
| You can override file inclusion/exclusion using regular expressions: | ||
|
|
||
| ```javascript | ||
| module.exports = { | ||
| plugins: [ | ||
| datadogWebpackPlugin({ | ||
| rum: { | ||
| privacy: { | ||
| include: [/packages\/apps\/.*\.(?:c|m)?(?:j|t)sx?$/], | ||
| exclude: [/\/node_modules\//, /\/test\//], | ||
| }, | ||
| }, | ||
| }), | ||
| ], | ||
| }; | ||
| ``` | ||
|
|
||
| > Note: if you are overriding the default setting, please make sure that you are aligned with the default setting. | ||
|
|
||
| ### Excluding Code Blocks with Comments | ||
|
|
||
| #### Single Line | ||
|
|
||
| ```javascript | ||
| "exclude line 1", // datadog-privacy-allowlist-exclude-line | ||
| "exclude line 2", /* datadog-privacy-allowlist-exclude-line */ | ||
|
|
||
| /* datadog-privacy-allowlist-exclude-line */ "exclude line 3", | ||
|
|
||
| /* | ||
| datadog-privacy-allowlist-exclude-line | ||
| */ "exclude line 4", | ||
| ``` | ||
|
|
||
| #### Next Line | ||
|
|
||
| ```javascript | ||
| // datadog-privacy-allowlist-exclude-next-line | ||
| "exclude next line 1", | ||
|
|
||
| /* datadog-privacy-allowlist-exclude-next-line */ | ||
| "exclude next line 2", | ||
|
|
||
| /* | ||
| datadog-privacy-allowlist-exclude-next-line | ||
| */ | ||
| `exclude next line 3`, | ||
| ``` | ||
|
|
||
| #### Multi-line/Blocks | ||
|
|
||
| ```javascript | ||
| // datadog-privacy-allowlist-exclude-begin | ||
| "exclude range 1", | ||
| 'exclude range 2', | ||
| `exclude range 3`, | ||
| // datadog-privacy-allowlist-exclude-end | ||
|
|
||
| /* datadog-privacy-allowlist-exclude-begin */ | ||
| "exclude range with block comment 1", | ||
| 'exclude range with block comment 2', | ||
| `exclude range with block comment 3`, | ||
| /* datadog-privacy-allowlist-exclude-end */ | ||
|
|
||
|
|
||
| // An unterminated 'exclude-begin' should cover the rest of the file. (And extra | ||
| // 'exclude-begins' after that point should be ignored.) | ||
| /* datadog-privacy-allowlist-exclude-begin */ | ||
| "exclude range with unterminated comment 1", | ||
| 'exclude range with unterminated comment 2', | ||
| /* datadog-privacy-allowlist-exclude-begin */ | ||
| `exclude range with unterminated comment 3`, | ||
| ``` | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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: it could be nice to add a bit more context about where to put those exclude/include properties: maybe add a minimal example of how to instantiate the plugin, or just mention that it should be provided in the plugin configuration.