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