@bli-cockpit/telemetry-core 0.1.110 → 0.1.111
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/log-digest/mask.js +9 -5
- package/package.json +1 -1
package/dist/log-digest/mask.js
CHANGED
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
* say the same thing become the same template and can be counted instead of read.
|
|
7
7
|
*
|
|
8
8
|
* Fixed masking order, so a memory address can never fake a status code
|
|
9
|
-
* (`0x7f...403...`): memory addresses, URLs, UUIDs, timestamps, IPs,
|
|
10
|
-
* long ids, build-chunk names and minified frame
|
|
11
|
-
* numeric quoted strings, `#<digits>` ids, long
|
|
12
|
-
* (`call_490779`), then every other number except a
|
|
13
|
-
* position (`HTTP 403`, `status=500`, `[Errno 28]`).
|
|
9
|
+
* (`0x7f...403...`): memory addresses, URLs, UUIDs, timestamps, IPs, provider
|
|
10
|
+
* deploy/build ids, long hex, long ids, build-chunk names and minified frame
|
|
11
|
+
* names, absolute paths, long or numeric quoted strings, `#<digits>` ids, long
|
|
12
|
+
* digit runs glued to a word (`call_490779`), then every other number except a
|
|
13
|
+
* status code in a status position (`HTTP 403`, `status=500`, `[Errno 28]`).
|
|
14
14
|
*
|
|
15
15
|
* BLI-17921: `Call #490779` used to keep its id (the number rule skips a digit
|
|
16
16
|
* run right after `#`), so every call id was its own template, its own incident
|
|
@@ -44,6 +44,9 @@ const URL_PATTERN = /\b[a-zA-Z][a-zA-Z0-9+.-]*:\/\/([^/\s"'<>?#:]+)[^\s"'<>]*/g;
|
|
|
44
44
|
const UUID = /\b[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}\b/g;
|
|
45
45
|
const TIMESTAMP = /\b\d{4}-\d{2}-\d{2}(?:[T ]\d{2}:\d{2}(?::\d{2}(?:[.,]\d+)?)?(?:Z|[+-]\d{2}:?\d{2})?)?\b|\b\d{2}:\d{2}:\d{2}(?:[.,]\d+)?\b/g;
|
|
46
46
|
const IP_ADDRESS = /\b\d{1,3}(?:\.\d{1,3}){3}(?::\d+)?\b/g;
|
|
47
|
+
// Provider deploy and build ids: Vercel (`dpl_8E81`, `dpl_EENt`, `dpl_HGuDxvZfLwLJoBjoqP6mmxJygwFt`, `bld_gcoie8z5g`)
|
|
48
|
+
// and Render/generic (`dep-c9abc123def4`, `dep_8e81`), including truncated or digit-poor ids `LONG_ID` misses (BLI-27247).
|
|
49
|
+
const PROVIDER_DEPLOY_ID = /(?<![\w-])(?:dpl_(?:[A-Za-z0-9]{4,}|[A-Za-z0-9]*\d[A-Za-z0-9]*)|bld_(?:[A-Za-z0-9]{8,}|(?=[A-Za-z0-9]*\d)[A-Za-z0-9]{4,})|dep[-_](?=[A-Za-z0-9]*\d)[A-Za-z0-9]{4,})(?![\w-])/g;
|
|
47
50
|
// 8+ hex characters that mix digits and letters, or any 32+ hex run (a md5, sha1, sha256 or a dashless uuid
|
|
48
51
|
// is never a word, even when luck left it without a digit).
|
|
49
52
|
const LONG_HEX = /\b(?=[0-9a-fA-F]*[0-9])(?=[0-9a-fA-F]*[a-fA-F])[0-9a-fA-F]{8,}\b|\b[0-9a-fA-F]{32,}\b/g;
|
|
@@ -110,6 +113,7 @@ export function mask(input) {
|
|
|
110
113
|
text = text.replace(UUID, "<uuid>");
|
|
111
114
|
text = text.replace(TIMESTAMP, "<ts>");
|
|
112
115
|
text = text.replace(IP_ADDRESS, "<ip>");
|
|
116
|
+
text = text.replace(PROVIDER_DEPLOY_ID, "<id>");
|
|
113
117
|
text = text.replace(LONG_HEX, "<hex>");
|
|
114
118
|
text = text.replace(LONG_ID, "<id>");
|
|
115
119
|
text = text.replace(BUILD_CHUNK, "$1__<hash>");
|