@openreplay/tracker 15.1.2 → 15.1.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/entry.js CHANGED
@@ -4737,7 +4737,7 @@ class App {
4737
4737
  this.stopCallbacks = [];
4738
4738
  this.commitCallbacks = [];
4739
4739
  this.activityState = ActivityState.NotActive;
4740
- this.version = '15.1.2'; // TODO: version compatability check inside each plugin.
4740
+ this.version = '15.1.3'; // TODO: version compatability check inside each plugin.
4741
4741
  this.socketMode = false;
4742
4742
  this.compressionThreshold = 24 * 1000;
4743
4743
  this.bc = null;
@@ -5375,7 +5375,6 @@ class App {
5375
5375
  }
5376
5376
  }
5377
5377
  this.emptyBatchCounter = 0;
5378
- console.log('messages', this.messages.join(', '));
5379
5378
  try {
5380
5379
  requestIdleCb(() => {
5381
5380
  this.messages.unshift(Timestamp(this.timestamp()), TabData(this.session.getTabId()));
@@ -8010,136 +8009,6 @@ function isObject(thing) {
8010
8009
  return thing !== null && typeof thing === 'object';
8011
8010
  }
8012
8011
 
8013
- const sensitiveParams = new Set([
8014
- "password",
8015
- "pass",
8016
- "pwd",
8017
- "mdp",
8018
- "token",
8019
- "bearer",
8020
- "jwt",
8021
- "api_key",
8022
- "api-key",
8023
- "apiKey",
8024
- "secret",
8025
- "ssn",
8026
- "zip",
8027
- "zipcode",
8028
- "x-api-key",
8029
- "www-authenticate",
8030
- "x-csrf-token",
8031
- "x-requested-with",
8032
- "x-forwarded-for",
8033
- "x-real-ip",
8034
- "cookie",
8035
- "authorization",
8036
- "auth",
8037
- "proxy-authorization",
8038
- "set-cookie",
8039
- "account_key",
8040
- ]);
8041
- function numDigits(x) {
8042
- return (Math.log10((x ^ (x >> 31)) - (x >> 31)) | 0) + 1;
8043
- }
8044
- function obscure(value) {
8045
- if (typeof value === "number") {
8046
- const digits = numDigits(value);
8047
- return "9".repeat(digits);
8048
- }
8049
- return value.replace(/[^\f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff\s]/g, '*');
8050
- }
8051
- function filterHeaders(headers) {
8052
- const filteredHeaders = {};
8053
- if (Array.isArray(headers)) {
8054
- headers.forEach(({ name, value }) => {
8055
- if (sensitiveParams.has(name.toLowerCase())) {
8056
- filteredHeaders[name] = obscure(value);
8057
- }
8058
- else {
8059
- filteredHeaders[name] = value;
8060
- }
8061
- });
8062
- }
8063
- else {
8064
- for (const [key, value] of Object.entries(headers)) {
8065
- if (sensitiveParams.has(key.toLowerCase())) {
8066
- filteredHeaders[key] = obscure(value);
8067
- }
8068
- else {
8069
- filteredHeaders[key] = value;
8070
- }
8071
- }
8072
- }
8073
- return filteredHeaders;
8074
- }
8075
- function filterBody(body) {
8076
- if (!body) {
8077
- return body;
8078
- }
8079
- let parsedBody;
8080
- let isJSON = false;
8081
- try {
8082
- parsedBody = JSON.parse(body);
8083
- isJSON = true;
8084
- }
8085
- catch (e) {
8086
- // not json
8087
- }
8088
- if (isJSON) {
8089
- obscureSensitiveData(parsedBody);
8090
- return JSON.stringify(parsedBody);
8091
- }
8092
- else {
8093
- const params = new URLSearchParams(body);
8094
- for (const key of params.keys()) {
8095
- if (sensitiveParams.has(key.toLowerCase())) {
8096
- const value = obscure(params.get(key));
8097
- params.set(key, value);
8098
- }
8099
- }
8100
- return params.toString();
8101
- }
8102
- }
8103
- function sanitizeObject(obj) {
8104
- obscureSensitiveData(obj);
8105
- return obj;
8106
- }
8107
- function obscureSensitiveData(obj) {
8108
- if (Array.isArray(obj)) {
8109
- obj.forEach(obscureSensitiveData);
8110
- }
8111
- else if (obj && typeof obj === "object") {
8112
- for (const key in obj) {
8113
- if (Object.hasOwn(obj, key)) {
8114
- if (sensitiveParams.has(key.toLowerCase())) {
8115
- obj[key] = obscure(obj[key]);
8116
- }
8117
- else if (obj[key] !== null && typeof obj[key] === "object") {
8118
- obscureSensitiveData(obj[key]);
8119
- }
8120
- }
8121
- }
8122
- }
8123
- }
8124
- function tryFilterUrl(url) {
8125
- if (!url)
8126
- return "";
8127
- try {
8128
- const urlObj = new URL(url);
8129
- if (urlObj.searchParams) {
8130
- for (const key of urlObj.searchParams.keys()) {
8131
- if (sensitiveParams.has(key.toLowerCase())) {
8132
- urlObj.searchParams.set(key, "******");
8133
- }
8134
- }
8135
- }
8136
- return urlObj.toString();
8137
- }
8138
- catch (e) {
8139
- return url;
8140
- }
8141
- }
8142
-
8143
8012
  /**
8144
8013
  * I know we're not using most of the information from this class
8145
8014
  * but it can be useful in the future if we will decide to display more stuff in our ui
@@ -8171,18 +8040,13 @@ class NetworkMessage {
8171
8040
  }
8172
8041
  getMessage() {
8173
8042
  const { reqHs, resHs } = this.writeHeaders();
8174
- const reqBody = this.method === 'GET'
8175
- ? JSON.stringify(sanitizeObject(this.getData)) : filterBody(this.requestData);
8176
8043
  const request = {
8177
- headers: filterHeaders(reqHs),
8178
- body: reqBody,
8179
- };
8180
- const response = {
8181
- headers: filterHeaders(resHs),
8182
- body: filterBody(this.response)
8044
+ headers: reqHs,
8045
+ body: this.method === 'GET' ? JSON.stringify(this.getData) : this.requestData,
8183
8046
  };
8047
+ const response = { headers: resHs, body: this.response };
8184
8048
  const messageInfo = this.sanitize({
8185
- url: tryFilterUrl(this.url),
8049
+ url: this.url,
8186
8050
  method: this.method,
8187
8051
  status: this.status,
8188
8052
  request,
@@ -9341,7 +9205,7 @@ class API {
9341
9205
  this.signalStartIssue = (reason, missingApi) => {
9342
9206
  const doNotTrack = this.checkDoNotTrack();
9343
9207
  console.log("Tracker couldn't start due to:", JSON.stringify({
9344
- trackerVersion: '15.1.2',
9208
+ trackerVersion: '15.1.3',
9345
9209
  projectKey: this.options.projectKey,
9346
9210
  doNotTrack,
9347
9211
  reason: missingApi.length ? `missing api: ${missingApi.join(',')}` : reason,