@newrelic/browser-agent 1.316.0-rc.2 → 1.316.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/common/constants/env.cdn.js +1 -1
- package/dist/cjs/common/constants/env.npm.js +1 -1
- package/dist/cjs/common/constants/events.js +26 -0
- package/dist/cjs/common/harvest/harvester.js +12 -4
- package/dist/cjs/common/serialize/bel-serializer.js +2 -2
- package/dist/cjs/common/util/obfuscate.js +147 -3
- package/dist/cjs/common/wrap/wrap-websocket.js +2 -1
- package/dist/cjs/features/ajax/aggregate/index.js +6 -1
- package/dist/cjs/features/generic_events/aggregate/index.js +15 -10
- package/dist/cjs/features/generic_events/constants.js +3 -2
- package/dist/cjs/features/jserrors/aggregate/index.js +11 -2
- package/dist/cjs/features/logging/aggregate/index.js +7 -3
- package/dist/cjs/features/metrics/aggregate/index.js +5 -1
- package/dist/cjs/features/page_view_event/aggregate/index.js +7 -3
- package/dist/cjs/features/page_view_timing/aggregate/index.js +6 -1
- package/dist/cjs/features/session_replay/aggregate/index.js +7 -1
- package/dist/cjs/features/session_trace/aggregate/index.js +6 -2
- package/dist/cjs/features/soft_navigations/aggregate/ajax-node.js +2 -2
- package/dist/cjs/features/soft_navigations/aggregate/index.js +7 -1
- package/dist/cjs/features/soft_navigations/aggregate/interaction.js +6 -4
- package/dist/cjs/features/utils/aggregate-base.js +2 -3
- package/dist/esm/common/constants/env.cdn.js +1 -1
- package/dist/esm/common/constants/env.npm.js +1 -1
- package/dist/esm/common/constants/events.js +20 -0
- package/dist/esm/common/harvest/harvester.js +12 -4
- package/dist/esm/common/serialize/bel-serializer.js +2 -2
- package/dist/esm/common/util/obfuscate.js +147 -3
- package/dist/esm/common/wrap/wrap-websocket.js +2 -1
- package/dist/esm/features/ajax/aggregate/index.js +6 -1
- package/dist/esm/features/generic_events/aggregate/index.js +15 -10
- package/dist/esm/features/generic_events/constants.js +3 -2
- package/dist/esm/features/jserrors/aggregate/index.js +11 -2
- package/dist/esm/features/logging/aggregate/index.js +7 -3
- package/dist/esm/features/metrics/aggregate/index.js +5 -1
- package/dist/esm/features/page_view_event/aggregate/index.js +7 -3
- package/dist/esm/features/page_view_timing/aggregate/index.js +6 -1
- package/dist/esm/features/session_replay/aggregate/index.js +7 -1
- package/dist/esm/features/session_trace/aggregate/index.js +6 -2
- package/dist/esm/features/soft_navigations/aggregate/ajax-node.js +2 -2
- package/dist/esm/features/soft_navigations/aggregate/index.js +7 -1
- package/dist/esm/features/soft_navigations/aggregate/interaction.js +6 -4
- package/dist/esm/features/utils/aggregate-base.js +2 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/common/constants/events.d.ts +16 -0
- package/dist/types/common/constants/events.d.ts.map +1 -0
- package/dist/types/common/harvest/harvester.d.ts +4 -1
- package/dist/types/common/harvest/harvester.d.ts.map +1 -1
- package/dist/types/common/util/obfuscate.d.ts +23 -2
- package/dist/types/common/util/obfuscate.d.ts.map +1 -1
- package/dist/types/common/wrap/wrap-websocket.d.ts.map +1 -1
- package/dist/types/features/ajax/aggregate/index.d.ts +2 -0
- package/dist/types/features/ajax/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/generic_events/aggregate/index.d.ts +3 -1
- package/dist/types/features/generic_events/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/generic_events/constants.d.ts.map +1 -1
- package/dist/types/features/jserrors/aggregate/index.d.ts +8 -1
- package/dist/types/features/jserrors/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/logging/aggregate/index.d.ts +3 -1
- package/dist/types/features/logging/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/metrics/aggregate/index.d.ts +2 -0
- package/dist/types/features/metrics/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/page_view_event/aggregate/index.d.ts +2 -0
- package/dist/types/features/page_view_event/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/page_view_timing/aggregate/index.d.ts +2 -0
- package/dist/types/features/page_view_timing/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/session_replay/aggregate/index.d.ts +2 -0
- package/dist/types/features/session_replay/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/session_trace/aggregate/index.d.ts +2 -0
- package/dist/types/features/session_trace/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/soft_navigations/aggregate/ajax-node.d.ts +1 -1
- package/dist/types/features/soft_navigations/aggregate/ajax-node.d.ts.map +1 -1
- package/dist/types/features/soft_navigations/aggregate/index.d.ts +3 -0
- package/dist/types/features/soft_navigations/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/soft_navigations/aggregate/interaction.d.ts +3 -1
- package/dist/types/features/soft_navigations/aggregate/interaction.d.ts.map +1 -1
- package/dist/types/features/utils/aggregate-base.d.ts +0 -1
- package/dist/types/features/utils/aggregate-base.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/common/constants/events.js +20 -0
- package/src/common/harvest/harvester.js +11 -4
- package/src/common/serialize/bel-serializer.js +2 -2
- package/src/common/util/obfuscate.js +154 -3
- package/src/common/wrap/wrap-websocket.js +2 -1
- package/src/features/ajax/aggregate/index.js +6 -1
- package/src/features/generic_events/aggregate/index.js +14 -9
- package/src/features/generic_events/constants.js +3 -2
- package/src/features/jserrors/aggregate/index.js +11 -2
- package/src/features/logging/aggregate/index.js +7 -6
- package/src/features/metrics/aggregate/index.js +5 -1
- package/src/features/page_view_event/aggregate/index.js +6 -2
- package/src/features/page_view_timing/aggregate/index.js +6 -1
- package/src/features/session_replay/aggregate/index.js +7 -1
- package/src/features/session_trace/aggregate/index.js +6 -2
- package/src/features/soft_navigations/aggregate/ajax-node.js +2 -2
- package/src/features/soft_navigations/aggregate/index.js +7 -1
- package/src/features/soft_navigations/aggregate/interaction.js +6 -4
- package/src/features/utils/aggregate-base.js +1 -3
|
@@ -17,7 +17,7 @@ exports.VERSION = exports.RRWEB_VERSION = exports.RRWEB_PACKAGE_NAME = exports.D
|
|
|
17
17
|
/**
|
|
18
18
|
* Exposes the version of the agent
|
|
19
19
|
*/
|
|
20
|
-
const VERSION = exports.VERSION = "1.316.0-rc.
|
|
20
|
+
const VERSION = exports.VERSION = "1.316.0-rc.3";
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Exposes the build type of the agent
|
|
@@ -17,7 +17,7 @@ exports.VERSION = exports.RRWEB_VERSION = exports.RRWEB_PACKAGE_NAME = exports.D
|
|
|
17
17
|
/**
|
|
18
18
|
* Exposes the version of the agent
|
|
19
19
|
*/
|
|
20
|
-
const VERSION = exports.VERSION = "1.316.0-rc.
|
|
20
|
+
const VERSION = exports.VERSION = "1.316.0-rc.3";
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Exposes the build type of the agent
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.EVENT_TYPES = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Copyright 2020-2026 New Relic, Inc. All rights reserved.
|
|
9
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const EVENT_TYPES = exports.EVENT_TYPES = {
|
|
13
|
+
AJAX: 'AjaxRequest',
|
|
14
|
+
PA: 'PageAction',
|
|
15
|
+
UA: 'UserAction',
|
|
16
|
+
BP: 'BrowserPerformance',
|
|
17
|
+
WS: 'WebSocket',
|
|
18
|
+
SPV: 'SecurityPolicyViolation',
|
|
19
|
+
JSE: 'JavaScriptError',
|
|
20
|
+
LOG: 'Log',
|
|
21
|
+
PVE: 'PageView',
|
|
22
|
+
PVT: 'PageViewTiming',
|
|
23
|
+
SR: 'SessionReplay',
|
|
24
|
+
ST: 'SessionTrace',
|
|
25
|
+
BI: 'BrowserInteraction'
|
|
26
|
+
};
|
|
@@ -19,6 +19,7 @@ var _console = require("../util/console");
|
|
|
19
19
|
var _stringify = require("../util/stringify");
|
|
20
20
|
var _submitData = require("../util/submit-data");
|
|
21
21
|
var _globalEvent = require("../dispatch/global-event");
|
|
22
|
+
var _obfuscate = require("../util/obfuscate");
|
|
22
23
|
/**
|
|
23
24
|
* Copyright 2020-2026 New Relic, Inc. All rights reserved.
|
|
24
25
|
* SPDX-License-Identifier: Apache-2.0
|
|
@@ -33,6 +34,10 @@ class Harvester {
|
|
|
33
34
|
initializedAggregates = [];
|
|
34
35
|
constructor(agentRef) {
|
|
35
36
|
this.agentRef = agentRef;
|
|
37
|
+
|
|
38
|
+
// Create obfuscator for harvest metadata (referrer URL, etc.)
|
|
39
|
+
// No event type specified - applies to all harvests regardless of feature
|
|
40
|
+
this.obfuscator = new _obfuscate.Obfuscator(agentRef);
|
|
36
41
|
(0, _eol.subscribeToEOL)(() => {
|
|
37
42
|
// do one last harvest round or check
|
|
38
43
|
this.initializedAggregates.forEach(aggregateInst => {
|
|
@@ -79,6 +84,7 @@ class Harvester {
|
|
|
79
84
|
payload: output.payload,
|
|
80
85
|
localOpts,
|
|
81
86
|
submitMethod,
|
|
87
|
+
harvesterObfuscator: this.obfuscator,
|
|
82
88
|
cbFinished,
|
|
83
89
|
raw: aggregateInst.harvestOpts.raw,
|
|
84
90
|
featureName: aggregateInst.featureName,
|
|
@@ -127,7 +133,8 @@ function send(agentRef, {
|
|
|
127
133
|
cbFinished,
|
|
128
134
|
raw,
|
|
129
135
|
featureName,
|
|
130
|
-
endpointVersion = 1
|
|
136
|
+
endpointVersion = 1,
|
|
137
|
+
harvesterObfuscator
|
|
131
138
|
}) {
|
|
132
139
|
if (!agentRef.info.errorBeacon) return false;
|
|
133
140
|
let {
|
|
@@ -144,7 +151,7 @@ function send(agentRef, {
|
|
|
144
151
|
const protocol = agentRef.init.ssl === false ? 'http' : 'https';
|
|
145
152
|
const perceivedBeacon = agentRef.init.proxy.beacon || agentRef.info.errorBeacon;
|
|
146
153
|
const url = raw ? "".concat(protocol, "://").concat(perceivedBeacon, "/").concat(endpoint) : "".concat(protocol, "://").concat(perceivedBeacon).concat(endpoint !== _features.RUM ? '/' + endpoint : '', "/").concat(endpointVersion, "/").concat(agentRef.info.licenseKey);
|
|
147
|
-
const baseParams = !raw ? baseQueryString(agentRef, qs, endpoint) : '';
|
|
154
|
+
const baseParams = !raw ? baseQueryString(agentRef, qs, endpoint, harvesterObfuscator) : '';
|
|
148
155
|
let payloadParams = (0, _encode.obj)(qs, agentRef.runtime.maxBytes);
|
|
149
156
|
if (baseParams === '' && payloadParams.startsWith('&')) {
|
|
150
157
|
payloadParams = payloadParams.substring(1);
|
|
@@ -292,8 +299,9 @@ function cleanPayload(payload = {}) {
|
|
|
292
299
|
}
|
|
293
300
|
|
|
294
301
|
// The stuff that gets sent every time.
|
|
295
|
-
function baseQueryString(agentRef, qs, endpoint) {
|
|
296
|
-
const
|
|
302
|
+
function baseQueryString(agentRef, qs, endpoint, harvesterObfuscator) {
|
|
303
|
+
const cleanedURL = (0, _cleanUrl.cleanURL)('' + _runtime.globalScope.location);
|
|
304
|
+
const ref = harvesterObfuscator?.obfuscateString(cleanedURL) ?? cleanedURL;
|
|
297
305
|
const session = agentRef.runtime.session;
|
|
298
306
|
const hr = !!session?.state.sessionReplaySentFirstChunk && session?.state.sessionReplayMode === 1 && endpoint !== _features.JSERRORS;
|
|
299
307
|
const ht = !!session?.state.traceHarvestStarted && session?.state.sessionTraceMode === 1 && ![_features.LOGS, _features.BLOBS].includes(endpoint);
|
|
@@ -9,7 +9,7 @@ exports.nullable = nullable;
|
|
|
9
9
|
exports.numeric = numeric;
|
|
10
10
|
var _stringify = require("../util/stringify");
|
|
11
11
|
/**
|
|
12
|
-
* Copyright 2020-
|
|
12
|
+
* Copyright 2020-2026 New Relic, Inc. All rights reserved.
|
|
13
13
|
* SPDX-License-Identifier: Apache-2.0
|
|
14
14
|
*/
|
|
15
15
|
|
|
@@ -30,7 +30,7 @@ function getAddStringContext(obfuscator) {
|
|
|
30
30
|
return addString;
|
|
31
31
|
function addString(str) {
|
|
32
32
|
if (typeof str === 'undefined' || str === '') return '';
|
|
33
|
-
str = obfuscator
|
|
33
|
+
str = obfuscator?.obfuscateString(String(str)) ?? String(str);
|
|
34
34
|
if (hasOwnProp.call(stringTable, str)) {
|
|
35
35
|
return numeric(stringTable[str], true);
|
|
36
36
|
} else {
|
|
@@ -7,7 +7,7 @@ exports.Obfuscator = void 0;
|
|
|
7
7
|
var _protocol = require("../url/protocol");
|
|
8
8
|
var _console = require("./console");
|
|
9
9
|
/**
|
|
10
|
-
* Copyright 2020-
|
|
10
|
+
* Copyright 2020-2026 New Relic, Inc. All rights reserved.
|
|
11
11
|
* SPDX-License-Identifier: Apache-2.0
|
|
12
12
|
*/
|
|
13
13
|
|
|
@@ -16,6 +16,7 @@ var _console = require("./console");
|
|
|
16
16
|
* @typedef {object} ObfuscationRule
|
|
17
17
|
* @property {string|RegExp} regex The regular expression to match against in the payload
|
|
18
18
|
* @property {string} [replacement] The string to replace the matched regex with
|
|
19
|
+
* @property {string[]} [eventFilter] An optional list of event types to which this rule should be applied. If not provided, or an empty array, the rule will be applied to all events.
|
|
19
20
|
*/
|
|
20
21
|
|
|
21
22
|
/**
|
|
@@ -30,14 +31,33 @@ var _console = require("./console");
|
|
|
30
31
|
*/
|
|
31
32
|
|
|
32
33
|
class Obfuscator {
|
|
33
|
-
|
|
34
|
+
/**
|
|
35
|
+
* @param {Object} agentRef - Reference to the agent instance
|
|
36
|
+
* @param {string} [eventType] - Optional event type this obfuscator instance handles.
|
|
37
|
+
* If provided, only rules matching this event type (or rules with no eventFilter) will be applied.
|
|
38
|
+
*/
|
|
39
|
+
constructor(agentRef, eventType) {
|
|
34
40
|
this.agentRef = agentRef;
|
|
41
|
+
this.eventType = eventType;
|
|
35
42
|
this.warnedRegexMissing = false;
|
|
36
43
|
this.warnedInvalidRegex = false;
|
|
37
44
|
this.warnedInvalidReplacement = false;
|
|
38
45
|
}
|
|
39
46
|
get obfuscateConfigRules() {
|
|
40
|
-
|
|
47
|
+
const allRules = this.agentRef.init.obfuscate || [];
|
|
48
|
+
|
|
49
|
+
// If this instance has no specific event type, return all rules
|
|
50
|
+
if (!this.eventType) return allRules;
|
|
51
|
+
|
|
52
|
+
// Filter rules to only those that apply to this instance's event type
|
|
53
|
+
return allRules.filter(rule => {
|
|
54
|
+
// If rule has no eventFilter, it applies to all events
|
|
55
|
+
if (!this.#hasValidEventFilter(rule)) {
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
// Otherwise, check if this instance's event type matches the rule's filter
|
|
59
|
+
return rule.eventFilter.includes(this.eventType);
|
|
60
|
+
});
|
|
41
61
|
}
|
|
42
62
|
|
|
43
63
|
/**
|
|
@@ -63,6 +83,130 @@ class Obfuscator {
|
|
|
63
83
|
}, input);
|
|
64
84
|
}
|
|
65
85
|
|
|
86
|
+
/**
|
|
87
|
+
* Traverses an object and obfuscates all string properties.
|
|
88
|
+
* This instance will only apply rules that match its configured event type (if any).
|
|
89
|
+
* For features with mixed event types in their payloads (like generic_events), this will
|
|
90
|
+
* traverse the object and check each object's eventType property against the rules.
|
|
91
|
+
* @param {Object|Array} obj - The object or array to traverse
|
|
92
|
+
* @returns {Object|Array} The modified object
|
|
93
|
+
*/
|
|
94
|
+
traverseAndObfuscateEvents(obj) {
|
|
95
|
+
if (!obj || typeof obj !== 'object') return obj;
|
|
96
|
+
|
|
97
|
+
// If this instance was configured with a specific event type, obfuscate everything
|
|
98
|
+
// (rules are already filtered in obfuscateConfigRules getter)
|
|
99
|
+
if (this.eventType) {
|
|
100
|
+
this.#applyFnToAllStrings(obj, this.obfuscateString.bind(this));
|
|
101
|
+
return obj;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// For generic obfuscators (no specific event types), check individual eventType properties
|
|
105
|
+
// This path is for features like generic_events that handle multiple event types
|
|
106
|
+
const eventTypesToObfuscate = new Set();
|
|
107
|
+
const globalRules = [];
|
|
108
|
+
const eventSpecificRules = [];
|
|
109
|
+
this.obfuscateConfigRules.forEach(rule => {
|
|
110
|
+
if (this.#hasValidEventFilter(rule)) {
|
|
111
|
+
eventSpecificRules.push(rule);
|
|
112
|
+
rule.eventFilter.forEach(eventType => eventTypesToObfuscate.add(eventType));
|
|
113
|
+
} else {
|
|
114
|
+
globalRules.push(rule);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
// Optimization: if ALL rules are global (no event-specific rules exist),
|
|
119
|
+
// we can just apply all rules to everything without checking eventType properties
|
|
120
|
+
if (eventSpecificRules.length === 0) {
|
|
121
|
+
this.#applyFnToAllStrings(obj, this.obfuscateString.bind(this));
|
|
122
|
+
return obj;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// We have a mix of global and event-specific rules:
|
|
126
|
+
// - Apply event-specific rules only to matching eventTypes
|
|
127
|
+
// - Apply global rules to ALL event types
|
|
128
|
+
this.#applyFnWithEventTypeFilter(obj, this.obfuscateString.bind(this), Array.from(eventTypesToObfuscate), globalRules, null);
|
|
129
|
+
return obj;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Recursively applies a function to all string properties in an object.
|
|
134
|
+
* @param {Object|Array} obj - The object or array to traverse
|
|
135
|
+
* @param {Function} fn - The function to apply to string properties
|
|
136
|
+
* @private
|
|
137
|
+
*/
|
|
138
|
+
#applyFnToAllStrings(obj, fn) {
|
|
139
|
+
if (!obj || typeof obj !== 'object') return;
|
|
140
|
+
Object.keys(obj).forEach(property => {
|
|
141
|
+
const value = obj[property];
|
|
142
|
+
if (typeof value === 'object' && value !== null) {
|
|
143
|
+
this.#applyFnToAllStrings(value, fn);
|
|
144
|
+
} else if (typeof value === 'string') {
|
|
145
|
+
obj[property] = fn(value);
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Recursively applies a function to string properties based on eventType filtering.
|
|
152
|
+
* @param {Object|Array} obj - The object or array to traverse
|
|
153
|
+
* @param {Function} fn - The function to apply to string properties (applies all rules)
|
|
154
|
+
* @param {string[]} eventTypes - Array of event types to apply event-specific obfuscation
|
|
155
|
+
* @param {Array} globalRules - Rules without eventFilter that apply to all events
|
|
156
|
+
* @param {boolean|null} shouldObfuscate - Track obfuscation state: null = not determined yet, true = obfuscate with all rules, false = obfuscate with global rules only
|
|
157
|
+
* @private
|
|
158
|
+
*/
|
|
159
|
+
#applyFnWithEventTypeFilter(obj, fn, eventTypes, globalRules, shouldObfuscate) {
|
|
160
|
+
if (!obj || typeof obj !== 'object') return;
|
|
161
|
+
|
|
162
|
+
// Determine the obfuscation state for this object
|
|
163
|
+
let currentShouldObfuscate = shouldObfuscate;
|
|
164
|
+
|
|
165
|
+
// Check if this object has an eventType property
|
|
166
|
+
if ('eventType' in obj && typeof obj.eventType === 'string') {
|
|
167
|
+
currentShouldObfuscate = eventTypes.includes(obj.eventType);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// Process all properties
|
|
171
|
+
Object.keys(obj).forEach(property => {
|
|
172
|
+
const value = obj[property];
|
|
173
|
+
if (typeof value === 'object' && value !== null) {
|
|
174
|
+
// Recursively traverse objects/arrays, passing the current obfuscation state
|
|
175
|
+
this.#applyFnWithEventTypeFilter(value, fn, eventTypes, globalRules, currentShouldObfuscate);
|
|
176
|
+
} else if (typeof value === 'string') {
|
|
177
|
+
if (currentShouldObfuscate === true) {
|
|
178
|
+
// Apply all rules (both global and event-specific)
|
|
179
|
+
obj[property] = fn(value);
|
|
180
|
+
} else if (currentShouldObfuscate === false && globalRules.length > 0) {
|
|
181
|
+
// Apply only global rules
|
|
182
|
+
obj[property] = this.#applyRulesToString(value, globalRules);
|
|
183
|
+
}
|
|
184
|
+
// If currentShouldObfuscate is null, we haven't found an eventType yet, so don't obfuscate
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Applies specific obfuscation rules to a string.
|
|
191
|
+
* @param {string} input - The string to obfuscate
|
|
192
|
+
* @param {Array} rules - The rules to apply
|
|
193
|
+
* @returns {string} The obfuscated string
|
|
194
|
+
* @private
|
|
195
|
+
*/
|
|
196
|
+
#applyRulesToString(input, rules) {
|
|
197
|
+
if (typeof input !== 'string' || input.trim().length === 0) return input;
|
|
198
|
+
const validatedRules = rules.map(rule => this.validateObfuscationRule(rule));
|
|
199
|
+
return validatedRules.filter(ruleValidation => ruleValidation.isValid).reduce((input, ruleValidation) => {
|
|
200
|
+
const {
|
|
201
|
+
rule
|
|
202
|
+
} = ruleValidation;
|
|
203
|
+
return input.replace(rule.regex, rule.replacement || '*');
|
|
204
|
+
}, input);
|
|
205
|
+
}
|
|
206
|
+
#hasValidEventFilter(rule) {
|
|
207
|
+
return Array.isArray(rule?.eventFilter) && rule.eventFilter.length > 0;
|
|
208
|
+
}
|
|
209
|
+
|
|
66
210
|
/**
|
|
67
211
|
* Validates an obfuscation rule and provides errors if any are found.
|
|
68
212
|
* @param {ObfuscationRule} rule The rule to validate
|
|
@@ -10,6 +10,7 @@ var _now = require("../timing/now");
|
|
|
10
10
|
var _cleanUrl = require("../url/clean-url");
|
|
11
11
|
var _nreum = require("../window/nreum");
|
|
12
12
|
var _pageVisibility = require("../window/page-visibility");
|
|
13
|
+
var _events = require("../constants/events");
|
|
13
14
|
/**
|
|
14
15
|
* Copyright 2020-2026 New Relic, Inc. All rights reserved.
|
|
15
16
|
* SPDX-License-Identifier: Apache-2.0
|
|
@@ -40,7 +41,7 @@ function wrapWebSocket(sharedEE) {
|
|
|
40
41
|
});
|
|
41
42
|
});
|
|
42
43
|
class WrappedWebSocket extends WebSocket {
|
|
43
|
-
static name =
|
|
44
|
+
static name = _events.EVENT_TYPES.WS;
|
|
44
45
|
static toString() {
|
|
45
46
|
// fake native WebSocket when static class is stringified
|
|
46
47
|
return 'function WebSocket() { [native code] }';
|
|
@@ -14,7 +14,9 @@ var _aggregateBase = require("../../utils/aggregate-base");
|
|
|
14
14
|
var _gql = require("./gql");
|
|
15
15
|
var _belSerializer = require("../../../common/serialize/bel-serializer");
|
|
16
16
|
var _nreum = require("../../../common/window/nreum");
|
|
17
|
+
var _obfuscate = require("../../../common/util/obfuscate");
|
|
17
18
|
var _utils = require("../../../common/v2/utils");
|
|
19
|
+
var _events = require("../../../common/constants/events");
|
|
18
20
|
var _uniqueId = require("../../../common/ids/unique-id");
|
|
19
21
|
/**
|
|
20
22
|
* Copyright 2020-2026 New Relic, Inc. All rights reserved.
|
|
@@ -27,6 +29,9 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
27
29
|
super(agentRef, _constants.FEATURE_NAME);
|
|
28
30
|
(0, _denyList.setDenyList)(agentRef.runtime.denyList);
|
|
29
31
|
const classThis = this;
|
|
32
|
+
|
|
33
|
+
// Create obfuscator for AJAX requests
|
|
34
|
+
this.obfuscator = new _obfuscate.Obfuscator(agentRef, _events.EVENT_TYPES.AJAX);
|
|
30
35
|
if (!agentRef.init.ajax.block_internal) {
|
|
31
36
|
// if the agent is tracking ITSELF, it can spawn endless ajax requests early if they are large from custom attributes, so we just disable early harvest for ajax in this case.
|
|
32
37
|
super.canHarvestEarly = false;
|
|
@@ -129,7 +134,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
129
134
|
}
|
|
130
135
|
serializer(eventBuffer) {
|
|
131
136
|
if (!eventBuffer.length) return;
|
|
132
|
-
const addString = (0, _belSerializer.getAddStringContext)(this.
|
|
137
|
+
const addString = (0, _belSerializer.getAddStringContext)(this.obfuscator);
|
|
133
138
|
let payload = 'bel.7;';
|
|
134
139
|
let firstTimestamp = 0;
|
|
135
140
|
for (let i = 0; i < eventBuffer.length; i++) {
|
|
@@ -12,10 +12,11 @@ var _aggregateBase = require("../../utils/aggregate-base");
|
|
|
12
12
|
var _console = require("../../../common/util/console");
|
|
13
13
|
var _now = require("../../../common/timing/now");
|
|
14
14
|
var _registerHandler = require("../../../common/event-emitter/register-handler");
|
|
15
|
-
var
|
|
15
|
+
var _obfuscate = require("../../../common/util/obfuscate");
|
|
16
16
|
var _userActionsAggregator = require("./user-actions/user-actions-aggregator");
|
|
17
17
|
var _iframe = require("../../../common/dom/iframe");
|
|
18
18
|
var _typeCheck = require("../../../common/util/type-check");
|
|
19
|
+
var _events = require("../../../common/constants/events");
|
|
19
20
|
var _utils = require("../../../common/v2/utils");
|
|
20
21
|
/**
|
|
21
22
|
* Copyright 2020-2026 New Relic, Inc. All rights reserved.
|
|
@@ -28,6 +29,10 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
28
29
|
constructor(agentRef) {
|
|
29
30
|
super(agentRef, _constants.FEATURE_NAME);
|
|
30
31
|
this.referrerUrl = _runtime.isBrowserScope && document.referrer ? (0, _cleanUrl.cleanURL)(document.referrer) : undefined;
|
|
32
|
+
|
|
33
|
+
// Create generic obfuscator (no specific event types) since this feature handles multiple event types
|
|
34
|
+
// Will check each event's eventType property at runtime against obfuscation rules
|
|
35
|
+
this.obfuscator = new _obfuscate.Obfuscator(agentRef);
|
|
31
36
|
this.waitForFlags(['ins']).then(([ins]) => {
|
|
32
37
|
if (!ins) {
|
|
33
38
|
this.blocked = true;
|
|
@@ -47,7 +52,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
47
52
|
(0, _registerHandler.registerHandler)('api-addPageAction', (timestamp, name, attributes, target) => {
|
|
48
53
|
this.addEvent({
|
|
49
54
|
...attributes,
|
|
50
|
-
eventType:
|
|
55
|
+
eventType: _events.EVENT_TYPES.PA,
|
|
51
56
|
timestamp: this.#toEpoch(timestamp),
|
|
52
57
|
timeSinceLoad: timestamp / 1000,
|
|
53
58
|
actionName: name,
|
|
@@ -75,7 +80,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
75
80
|
} = aggregatedUserAction.event;
|
|
76
81
|
aggregatedUserAction.targets.forEach(mfeTarget => {
|
|
77
82
|
const userActionEvent = {
|
|
78
|
-
eventType:
|
|
83
|
+
eventType: _events.EVENT_TYPES.UA,
|
|
79
84
|
timestamp: this.#toEpoch(timeStamp),
|
|
80
85
|
action: type,
|
|
81
86
|
actionCount: aggregatedUserAction.count,
|
|
@@ -162,7 +167,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
162
167
|
const detailObj = agentRef.init.performance.capture_detail ? createDetailAttrs(entry.detail) : {};
|
|
163
168
|
this.addEvent({
|
|
164
169
|
...detailObj,
|
|
165
|
-
eventType:
|
|
170
|
+
eventType: _events.EVENT_TYPES.BP,
|
|
166
171
|
timestamp: this.#toEpoch(entry.startTime),
|
|
167
172
|
entryName: entry.name,
|
|
168
173
|
entryDuration: entry.duration,
|
|
@@ -228,7 +233,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
228
233
|
this.reportSupportabilityMetric('Generic/Performance/Resource/Seen');
|
|
229
234
|
const event = {
|
|
230
235
|
...entryObject,
|
|
231
|
-
eventType:
|
|
236
|
+
eventType: _events.EVENT_TYPES.BP,
|
|
232
237
|
timestamp: this.#toEpoch(entryObject.startTime),
|
|
233
238
|
entryName: (0, _cleanUrl.cleanURL)(name),
|
|
234
239
|
entryDuration: duration,
|
|
@@ -248,7 +253,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
248
253
|
} = args;
|
|
249
254
|
const event = {
|
|
250
255
|
...customAttributes,
|
|
251
|
-
eventType:
|
|
256
|
+
eventType: _events.EVENT_TYPES.BP,
|
|
252
257
|
timestamp: this.#toEpoch(start),
|
|
253
258
|
entryName: n,
|
|
254
259
|
entryDuration: duration,
|
|
@@ -260,7 +265,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
260
265
|
(0, _registerHandler.registerHandler)('ws-complete', nrData => {
|
|
261
266
|
const event = {
|
|
262
267
|
...nrData,
|
|
263
|
-
eventType:
|
|
268
|
+
eventType: _events.EVENT_TYPES.WS,
|
|
264
269
|
timestamp: this.#toEpoch(nrData.timestamp),
|
|
265
270
|
openedAt: this.#toEpoch(nrData.openedAt),
|
|
266
271
|
closedAt: this.#toEpoch(nrData.closedAt)
|
|
@@ -275,7 +280,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
275
280
|
if (!agentRef.init.feature_flags.includes('no_spv')) {
|
|
276
281
|
(0, _registerHandler.registerHandler)('spv', evt => {
|
|
277
282
|
this.addEvent({
|
|
278
|
-
eventType:
|
|
283
|
+
eventType: _events.EVENT_TYPES.SPV,
|
|
279
284
|
timestamp: this.#toEpoch(evt.timeStamp),
|
|
280
285
|
blockedUri: evt.blockedURI,
|
|
281
286
|
documentUri: evt.documentURI,
|
|
@@ -344,9 +349,9 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
344
349
|
});
|
|
345
350
|
}
|
|
346
351
|
serializer(eventBuffer) {
|
|
347
|
-
return
|
|
352
|
+
return this.obfuscator.traverseAndObfuscateEvents({
|
|
348
353
|
ins: eventBuffer
|
|
349
|
-
}
|
|
354
|
+
});
|
|
350
355
|
}
|
|
351
356
|
queryStringsBuilder() {
|
|
352
357
|
return {
|
|
@@ -4,9 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.RESERVED_EVENT_TYPES = exports.RAGE_CLICK_THRESHOLD_MS = exports.RAGE_CLICK_THRESHOLD_EVENTS = exports.OBSERVED_WINDOW_EVENTS = exports.OBSERVED_EVENTS = exports.FRUSTRATION_TIMEOUT_MS = exports.FEATURE_NAME = exports.FEATURE_FLAGS = void 0;
|
|
7
|
+
var _events = require("../../common/constants/events");
|
|
7
8
|
var _features = require("../../loaders/features/features");
|
|
8
9
|
/**
|
|
9
|
-
* Copyright 2020-
|
|
10
|
+
* Copyright 2020-2026 New Relic, Inc. All rights reserved.
|
|
10
11
|
* SPDX-License-Identifier: Apache-2.0
|
|
11
12
|
*/
|
|
12
13
|
|
|
@@ -16,7 +17,7 @@ const OBSERVED_WINDOW_EVENTS = exports.OBSERVED_WINDOW_EVENTS = ['focus', 'blur'
|
|
|
16
17
|
const RAGE_CLICK_THRESHOLD_EVENTS = exports.RAGE_CLICK_THRESHOLD_EVENTS = 4;
|
|
17
18
|
const RAGE_CLICK_THRESHOLD_MS = exports.RAGE_CLICK_THRESHOLD_MS = 1000;
|
|
18
19
|
const FRUSTRATION_TIMEOUT_MS = exports.FRUSTRATION_TIMEOUT_MS = 2000;
|
|
19
|
-
const RESERVED_EVENT_TYPES = exports.RESERVED_EVENT_TYPES = [
|
|
20
|
+
const RESERVED_EVENT_TYPES = exports.RESERVED_EVENT_TYPES = [_events.EVENT_TYPES.PA, _events.EVENT_TYPES.UA, _events.EVENT_TYPES.BP];
|
|
20
21
|
const FEATURE_FLAGS = exports.FEATURE_FLAGS = {
|
|
21
22
|
RESOURCES: 'experimental.resources',
|
|
22
23
|
REGISTER: 'register'
|
|
@@ -16,11 +16,12 @@ var _constants = require("../constants");
|
|
|
16
16
|
var _features = require("../../../loaders/features/features");
|
|
17
17
|
var _aggregateBase = require("../../utils/aggregate-base");
|
|
18
18
|
var _now = require("../../../common/timing/now");
|
|
19
|
-
var
|
|
19
|
+
var _obfuscate = require("../../../common/util/obfuscate");
|
|
20
20
|
var _internalErrors = require("./internal-errors");
|
|
21
21
|
var _utils = require("../../../common/v2/utils");
|
|
22
22
|
var _causeString = require("./cause-string");
|
|
23
23
|
var _shortCircuit = require("../../../common/util/short-circuit");
|
|
24
|
+
var _events = require("../../../common/constants/events");
|
|
24
25
|
/**
|
|
25
26
|
* Copyright 2020-2026 New Relic, Inc. All rights reserved.
|
|
26
27
|
* SPDX-License-Identifier: Apache-2.0
|
|
@@ -41,6 +42,10 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
41
42
|
this.observedAt = {};
|
|
42
43
|
this.pageviewReported = {};
|
|
43
44
|
this.errorOnPage = false;
|
|
45
|
+
|
|
46
|
+
// Create obfuscators for each event type this feature handles
|
|
47
|
+
this.errorObfuscator = new _obfuscate.Obfuscator(agentRef, _events.EVENT_TYPES.JSE);
|
|
48
|
+
this.xhrObfuscator = new _obfuscate.Obfuscator(agentRef, _events.EVENT_TYPES.AJAX);
|
|
44
49
|
(0, _registerHandler.registerHandler)('err', this.processError.bind(this), this.featureName, this.ee);
|
|
45
50
|
(0, _registerHandler.registerHandler)('ierr', this.processError.bind(this), this.featureName, this.ee);
|
|
46
51
|
(0, _registerHandler.registerHandler)('returnJserror', (jsErrorEvent, softNavAttrs) => this.#storeJserrorForHarvest(jsErrorEvent, softNavAttrs), this.featureName, this.ee);
|
|
@@ -56,7 +61,11 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
56
61
|
});
|
|
57
62
|
}
|
|
58
63
|
serializer(aggregatorTypeToBucketsMap) {
|
|
59
|
-
return
|
|
64
|
+
return {
|
|
65
|
+
err: this.errorObfuscator.traverseAndObfuscateEvents(aggregatorTypeToBucketsMap.err),
|
|
66
|
+
ierr: this.errorObfuscator.traverseAndObfuscateEvents(aggregatorTypeToBucketsMap.ierr),
|
|
67
|
+
xhr: this.xhrObfuscator.traverseAndObfuscateEvents(aggregatorTypeToBucketsMap.xhr)
|
|
68
|
+
};
|
|
60
69
|
}
|
|
61
70
|
queryStringsBuilder(aggregatorTakeReturnedData) {
|
|
62
71
|
const qs = {};
|
|
@@ -11,11 +11,12 @@ var _aggregateBase = require("../../utils/aggregate-base");
|
|
|
11
11
|
var _constants = require("../constants");
|
|
12
12
|
var _log = require("../shared/log");
|
|
13
13
|
var _utils = require("../shared/utils");
|
|
14
|
-
var
|
|
14
|
+
var _obfuscate = require("../../../common/util/obfuscate");
|
|
15
15
|
var _constants2 = require("../../../common/session/constants");
|
|
16
16
|
var _constants3 = require("../../session_replay/constants");
|
|
17
17
|
var _featureGates = require("../../utils/feature-gates");
|
|
18
18
|
var _utils2 = require("../../../common/v2/utils");
|
|
19
|
+
var _events = require("../../../common/constants/events");
|
|
19
20
|
/**
|
|
20
21
|
* Copyright 2020-2026 New Relic, Inc. All rights reserved.
|
|
21
22
|
* SPDX-License-Identifier: Apache-2.0
|
|
@@ -39,6 +40,9 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
39
40
|
this.harvestOpts.raw = true;
|
|
40
41
|
super.customAttributesAreSeparate = true;
|
|
41
42
|
|
|
43
|
+
// Create obfuscator for log entries
|
|
44
|
+
this.obfuscator = new _obfuscate.Obfuscator(agentRef, _events.EVENT_TYPES.LOG);
|
|
45
|
+
|
|
42
46
|
// The SessionEntity class can emit a message indicating the session was cleared and reset (expiry, inactivity). This feature must abort and never resume if that occurs.
|
|
43
47
|
this.ee.on(_constants2.SESSION_EVENTS.RESET, () => {
|
|
44
48
|
this.abort(_constants3.ABORT_REASONS.RESET);
|
|
@@ -119,7 +123,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
119
123
|
common: {
|
|
120
124
|
/** Attributes in the `common` section are added to `all` logs generated in the payload */
|
|
121
125
|
attributes: {
|
|
122
|
-
...
|
|
126
|
+
...this.obfuscator.traverseAndObfuscateEvents(this.agentRef.info.jsAttributes),
|
|
123
127
|
...(this.harvestEndpointVersion === 1 && {
|
|
124
128
|
'entity.guid': this.agentRef.runtime.appMetadata.agents[0].entityGuid,
|
|
125
129
|
appId: this.agentRef.info.applicationID
|
|
@@ -144,7 +148,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
144
148
|
}
|
|
145
149
|
},
|
|
146
150
|
/** logs section contains individual unique log entries */
|
|
147
|
-
logs:
|
|
151
|
+
logs: this.obfuscator.traverseAndObfuscateEvents(eventBuffer)
|
|
148
152
|
}];
|
|
149
153
|
}
|
|
150
154
|
queryStringsBuilder() {
|
|
@@ -14,8 +14,9 @@ var _runtime = require("../../../common/constants/runtime");
|
|
|
14
14
|
var _aggregateBase = require("../../utils/aggregate-base");
|
|
15
15
|
var _iframe = require("../../../common/dom/iframe");
|
|
16
16
|
var _harvestMetadata = require("./harvest-metadata");
|
|
17
|
+
var _obfuscate = require("../../../common/util/obfuscate");
|
|
17
18
|
/**
|
|
18
|
-
* Copyright 2020-
|
|
19
|
+
* Copyright 2020-2026 New Relic, Inc. All rights reserved.
|
|
19
20
|
* SPDX-License-Identifier: Apache-2.0
|
|
20
21
|
*/
|
|
21
22
|
|
|
@@ -28,6 +29,9 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
28
29
|
super(agentRef, _constants.FEATURE_NAME);
|
|
29
30
|
this.harvestOpts.aggregatorTypes = ['cm', 'sm']; // the types in EventAggregator this feature cares about
|
|
30
31
|
|
|
32
|
+
// Create a generic obfuscator for checking if rules are configured
|
|
33
|
+
this.obfuscator = new _obfuscate.Obfuscator(agentRef);
|
|
34
|
+
|
|
31
35
|
/** all the harvest metadata metrics need to be evaluated simulataneously at unload time so just temporarily buffer them and dont make SMs immediately from the data */
|
|
32
36
|
this.harvestMetadata = {};
|
|
33
37
|
this.harvestOpts.beforeUnload = () => {
|
|
@@ -17,11 +17,12 @@ var _firstPaint = require("../../../common/vitals/first-paint");
|
|
|
17
17
|
var _timeToFirstByte = require("../../../common/vitals/time-to-first-byte");
|
|
18
18
|
var _now = require("../../../common/timing/now");
|
|
19
19
|
var _timeKeeper = require("../../../common/timing/time-keeper");
|
|
20
|
-
var
|
|
20
|
+
var _obfuscate = require("../../../common/util/obfuscate");
|
|
21
21
|
var _harvester = require("../../../common/harvest/harvester");
|
|
22
22
|
var _features = require("../../../loaders/features/features");
|
|
23
23
|
var _submitData = require("../../../common/util/submit-data");
|
|
24
24
|
var _webdriverDetection = require("../../../common/util/webdriver-detection");
|
|
25
|
+
var _events = require("../../../common/constants/events");
|
|
25
26
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
26
27
|
/**
|
|
27
28
|
* Copyright 2020-2026 New Relic, Inc. All rights reserved.
|
|
@@ -38,6 +39,9 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
38
39
|
this.firstByteToWindowLoad = 0; // our "frontend" duration
|
|
39
40
|
this.firstByteToDomContent = 0; // our "dom processing" duration
|
|
40
41
|
this.retries = 0;
|
|
42
|
+
|
|
43
|
+
// Create obfuscator for page view events
|
|
44
|
+
this.obfuscator = new _obfuscate.Obfuscator(agentRef, _events.EVENT_TYPES.PVE);
|
|
41
45
|
agentRef.runtime.timeKeeper = new _timeKeeper.TimeKeeper(agentRef.runtime.session);
|
|
42
46
|
if (_runtime.isBrowserScope) {
|
|
43
47
|
_timeToFirstByte.timeToFirstByte.subscribe(({
|
|
@@ -86,12 +90,12 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
86
90
|
};
|
|
87
91
|
if (this.agentRef.runtime.session) queryParameters.fsh = Number(this.agentRef.runtime.session.isNew); // "first session harvest" aka RUM request or PageView event of a session
|
|
88
92
|
|
|
89
|
-
let body =
|
|
93
|
+
let body = this.obfuscator.traverseAndObfuscateEvents({
|
|
90
94
|
ja: {
|
|
91
95
|
...customAttributes,
|
|
92
96
|
webdriverDetected: _webdriverDetection.webdriverDetected
|
|
93
97
|
}
|
|
94
|
-
}
|
|
98
|
+
});
|
|
95
99
|
if (_runtime.globalScope.performance) {
|
|
96
100
|
const navTimingEntry = (0, _runtime.getNavigationEntry)();
|
|
97
101
|
if (navTimingEntry) {
|
|
@@ -10,6 +10,7 @@ var _handle = require("../../../common/event-emitter/handle");
|
|
|
10
10
|
var _constants = require("../constants");
|
|
11
11
|
var _features = require("../../../loaders/features/features");
|
|
12
12
|
var _aggregateBase = require("../../utils/aggregate-base");
|
|
13
|
+
var _obfuscate = require("../../../common/util/obfuscate");
|
|
13
14
|
var _cumulativeLayoutShift = require("../../../common/vitals/cumulative-layout-shift");
|
|
14
15
|
var _firstContentfulPaint = require("../../../common/vitals/first-contentful-paint");
|
|
15
16
|
var _firstPaint = require("../../../common/vitals/first-paint");
|
|
@@ -22,6 +23,7 @@ var _eventOrigin = require("../../../common/util/event-origin");
|
|
|
22
23
|
var _loadTime = require("../../../common/vitals/load-time");
|
|
23
24
|
var _webdriverDetection = require("../../../common/util/webdriver-detection");
|
|
24
25
|
var _cleanUrl = require("../../../common/url/clean-url");
|
|
26
|
+
var _events = require("../../../common/constants/events");
|
|
25
27
|
/**
|
|
26
28
|
* Copyright 2020-2026 New Relic, Inc. All rights reserved.
|
|
27
29
|
* SPDX-License-Identifier: Apache-2.0
|
|
@@ -41,6 +43,9 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
41
43
|
this.curSessEndRecorded = false;
|
|
42
44
|
this.firstIxnRecorded = false;
|
|
43
45
|
super.customAttributesAreSeparate = true;
|
|
46
|
+
|
|
47
|
+
// Create obfuscator for page view timing events
|
|
48
|
+
this.obfuscator = new _obfuscate.Obfuscator(agentRef, _events.EVENT_TYPES.PVT);
|
|
44
49
|
(0, _registerHandler.registerHandler)('docHidden', msTimestamp => this.endCurrentSession(msTimestamp), this.featureName, this.ee);
|
|
45
50
|
// Add the time of _window pagehide event_ firing to the next PVT harvest == NRDB windowUnload attr:
|
|
46
51
|
(0, _registerHandler.registerHandler)('winPagehide', msTimestamp => this.addTiming('unload', msTimestamp, null), this.featureName, this.ee);
|
|
@@ -146,7 +151,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
146
151
|
// serialize array of timing data
|
|
147
152
|
serializer(eventBuffer) {
|
|
148
153
|
if (!eventBuffer?.length) return '';
|
|
149
|
-
var addString = (0, _belSerializer.getAddStringContext)(this.
|
|
154
|
+
var addString = (0, _belSerializer.getAddStringContext)(this.obfuscator);
|
|
150
155
|
var payload = 'bel.6;';
|
|
151
156
|
for (var i = 0; i < eventBuffer.length; i++) {
|
|
152
157
|
var timing = eventBuffer[i];
|