@hanzo/event 0.3.41 → 0.3.42
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/core.d.ts.map +1 -1
- package/dist/events.d.ts +1 -1
- package/dist/index.cjs +10 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +10 -4
- package/dist/index.mjs.map +1 -1
- package/dist/react.cjs +10 -4
- package/dist/react.cjs.map +1 -1
- package/dist/react.mjs +10 -4
- package/dist/react.mjs.map +1 -1
- package/dist/scrub.d.ts +5 -0
- package/dist/scrub.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/core.test.ts +19 -0
- package/src/core.ts +7 -4
- package/src/events.ts +1 -1
- package/src/scrub.test.ts +34 -1
- package/src/scrub.ts +20 -0
package/dist/index.mjs
CHANGED
|
@@ -253,11 +253,17 @@ var RE_CREDENTIAL_PARAM = new RegExp(
|
|
|
253
253
|
function redactCredentialParams(s) {
|
|
254
254
|
return s.replace(RE_CREDENTIAL_PARAM, (_m, prefix) => prefix + REDACTED);
|
|
255
255
|
}
|
|
256
|
+
var RE_SECRET43 = /(^|[^A-Za-z0-9_-]|%[0-9A-Fa-f]{2})((?=[A-Za-z0-9_-]{0,42}[a-z])(?=[A-Za-z0-9_-]{0,42}[A-Z])[A-Za-z0-9_-]{43})(?![A-Za-z0-9_-])/g;
|
|
256
257
|
function redactSecrets(s) {
|
|
257
258
|
s = redactCredentialParams(s);
|
|
258
259
|
for (const re of SECRET_PATTERNS) s = s.replace(re, REDACTED);
|
|
260
|
+
s = s.replace(RE_SECRET43, (_m, lead) => lead + REDACTED);
|
|
259
261
|
return redactPAN(s);
|
|
260
262
|
}
|
|
263
|
+
function withoutFragment(url) {
|
|
264
|
+
const at = url.indexOf("#");
|
|
265
|
+
return at < 0 ? url : url.slice(0, at);
|
|
266
|
+
}
|
|
261
267
|
function scrubPII(s) {
|
|
262
268
|
s = s.replace(RE_EMAIL, EMAIL_MARK);
|
|
263
269
|
s = s.replace(RE_IPV6, IP_MARK);
|
|
@@ -391,7 +397,7 @@ function uuidv7Time(id) {
|
|
|
391
397
|
}
|
|
392
398
|
|
|
393
399
|
// package.json
|
|
394
|
-
var version = "0.3.
|
|
400
|
+
var version = "0.3.42";
|
|
395
401
|
|
|
396
402
|
// src/version.ts
|
|
397
403
|
var VERSION = version;
|
|
@@ -1113,9 +1119,9 @@ var Analytics = class {
|
|
|
1113
1119
|
...extra
|
|
1114
1120
|
};
|
|
1115
1121
|
const capturePII = this.cfg.capturePII ?? false;
|
|
1116
|
-
if (wire.url) wire.url = scrubText(wire.url, capturePII);
|
|
1117
|
-
if (wire.path) wire.path = scrubText(wire.path, capturePII);
|
|
1118
|
-
if (wire.referrer) wire.referrer = scrubText(wire.referrer, capturePII);
|
|
1122
|
+
if (wire.url) wire.url = scrubText(withoutFragment(wire.url), capturePII);
|
|
1123
|
+
if (wire.path) wire.path = scrubText(withoutFragment(wire.path), capturePII);
|
|
1124
|
+
if (wire.referrer) wire.referrer = scrubText(withoutFragment(wire.referrer), capturePII);
|
|
1119
1125
|
return wire;
|
|
1120
1126
|
}
|
|
1121
1127
|
schedule() {
|