@n8n/utils 1.34.0 → 1.35.0

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/index.cjs CHANGED
@@ -15,6 +15,8 @@ const require_jwt = require('./jwt2.cjs');
15
15
  const require_scrub_secrets = require('./scrub-secrets2.cjs');
16
16
 
17
17
  exports.DEFAULT_KEYS = require_sublimeSearch.DEFAULT_KEYS;
18
+ exports.SECRET_KEYS = require_scrub_secrets.SECRET_KEYS;
19
+ exports.SECRET_VALUE_PATTERNS = require_scrub_secrets.SECRET_VALUE_PATTERNS;
18
20
  exports.assert = require_assert.assert;
19
21
  exports.createEventBus = require_event_bus.createEventBus;
20
22
  exports.createEventQueue = require_event_queue.createEventQueue;
package/dist/index.d.cts CHANGED
@@ -12,6 +12,6 @@ import { t as sortByProperty } from "./sortByProperty.cjs";
12
12
  import { n as truncateBeforeLast, t as truncate } from "./truncate.cjs";
13
13
  import { a as hasPlaceholderDeep, i as formatPlaceholderPath, n as extractPlaceholderLabels, o as isPlaceholderString, r as findPlaceholderDetails, s as isPlaceholderValue, t as PlaceholderDetail } from "./placeholder2.cjs";
14
14
  import { t as getJwtExpiry } from "./jwt2.cjs";
15
- import { t as scrubSecretsInText } from "./scrub-secrets2.cjs";
15
+ import { n as SECRET_VALUE_PATTERNS, r as scrubSecretsInText, t as SECRET_KEYS } from "./scrub-secrets2.cjs";
16
16
  import { t as DistributiveOmit } from "./types2.cjs";
17
- export { CallbackFn, DEFAULT_KEYS, DistributiveOmit, EventBus, PlaceholderDetail, assert, createEventBus, createEventQueue, extractPlaceholderLabels, findPlaceholderDetails, formatPlaceholderPath, generateNanoId, getJwtExpiry, hasPlaceholderDeep, isPlaceholderString, isPlaceholderValue, isWindowsFilePath, reRankSearchResults, retry, sanitizeFilename, scrubSecretsInText, smartDecimal, sortByProperty, sublimeSearch, truncate, truncateBeforeLast };
17
+ export { CallbackFn, DEFAULT_KEYS, DistributiveOmit, EventBus, PlaceholderDetail, SECRET_KEYS, SECRET_VALUE_PATTERNS, assert, createEventBus, createEventQueue, extractPlaceholderLabels, findPlaceholderDetails, formatPlaceholderPath, generateNanoId, getJwtExpiry, hasPlaceholderDeep, isPlaceholderString, isPlaceholderValue, isWindowsFilePath, reRankSearchResults, retry, sanitizeFilename, scrubSecretsInText, smartDecimal, sortByProperty, sublimeSearch, truncate, truncateBeforeLast };
package/dist/index.d.mts CHANGED
@@ -12,6 +12,6 @@ import { t as sortByProperty } from "./sortByProperty.mjs";
12
12
  import { n as truncateBeforeLast, t as truncate } from "./truncate.mjs";
13
13
  import { a as hasPlaceholderDeep, i as formatPlaceholderPath, n as extractPlaceholderLabels, o as isPlaceholderString, r as findPlaceholderDetails, s as isPlaceholderValue, t as PlaceholderDetail } from "./placeholder2.mjs";
14
14
  import { t as getJwtExpiry } from "./jwt2.mjs";
15
- import { t as scrubSecretsInText } from "./scrub-secrets2.mjs";
15
+ import { n as SECRET_VALUE_PATTERNS, r as scrubSecretsInText, t as SECRET_KEYS } from "./scrub-secrets2.mjs";
16
16
  import { t as DistributiveOmit } from "./types2.mjs";
17
- export { CallbackFn, DEFAULT_KEYS, DistributiveOmit, EventBus, PlaceholderDetail, assert, createEventBus, createEventQueue, extractPlaceholderLabels, findPlaceholderDetails, formatPlaceholderPath, generateNanoId, getJwtExpiry, hasPlaceholderDeep, isPlaceholderString, isPlaceholderValue, isWindowsFilePath, reRankSearchResults, retry, sanitizeFilename, scrubSecretsInText, smartDecimal, sortByProperty, sublimeSearch, truncate, truncateBeforeLast };
17
+ export { CallbackFn, DEFAULT_KEYS, DistributiveOmit, EventBus, PlaceholderDetail, SECRET_KEYS, SECRET_VALUE_PATTERNS, assert, createEventBus, createEventQueue, extractPlaceholderLabels, findPlaceholderDetails, formatPlaceholderPath, generateNanoId, getJwtExpiry, hasPlaceholderDeep, isPlaceholderString, isPlaceholderValue, isWindowsFilePath, reRankSearchResults, retry, sanitizeFilename, scrubSecretsInText, smartDecimal, sortByProperty, sublimeSearch, truncate, truncateBeforeLast };
package/dist/index.mjs CHANGED
@@ -12,6 +12,6 @@ import { t as sanitizeFilename } from "./sanitize.mjs";
12
12
  import { t as isWindowsFilePath } from "./path.mjs";
13
13
  import { a as isPlaceholderString, i as hasPlaceholderDeep, n as findPlaceholderDetails, o as isPlaceholderValue, r as formatPlaceholderPath, t as extractPlaceholderLabels } from "./placeholder2.mjs";
14
14
  import { t as getJwtExpiry } from "./jwt2.mjs";
15
- import { t as scrubSecretsInText } from "./scrub-secrets2.mjs";
15
+ import { n as SECRET_VALUE_PATTERNS, r as scrubSecretsInText, t as SECRET_KEYS } from "./scrub-secrets2.mjs";
16
16
 
17
- export { DEFAULT_KEYS, assert, createEventBus, createEventQueue, extractPlaceholderLabels, findPlaceholderDetails, formatPlaceholderPath, generateNanoId, getJwtExpiry, hasPlaceholderDeep, isPlaceholderString, isPlaceholderValue, isWindowsFilePath, reRankSearchResults, retry, sanitizeFilename, scrubSecretsInText, smartDecimal, sortByProperty, sublimeSearch, truncate, truncateBeforeLast };
17
+ export { DEFAULT_KEYS, SECRET_KEYS, SECRET_VALUE_PATTERNS, assert, createEventBus, createEventQueue, extractPlaceholderLabels, findPlaceholderDetails, formatPlaceholderPath, generateNanoId, getJwtExpiry, hasPlaceholderDeep, isPlaceholderString, isPlaceholderValue, isWindowsFilePath, reRankSearchResults, retry, sanitizeFilename, scrubSecretsInText, smartDecimal, sortByProperty, sublimeSearch, truncate, truncateBeforeLast };
@@ -1,3 +1,5 @@
1
1
  const require_scrub_secrets = require('./scrub-secrets2.cjs');
2
2
 
3
+ exports.SECRET_KEYS = require_scrub_secrets.SECRET_KEYS;
4
+ exports.SECRET_VALUE_PATTERNS = require_scrub_secrets.SECRET_VALUE_PATTERNS;
3
5
  exports.scrubSecretsInText = require_scrub_secrets.scrubSecretsInText;
@@ -1,2 +1,2 @@
1
- import { t as scrubSecretsInText } from "./scrub-secrets2.cjs";
2
- export { scrubSecretsInText };
1
+ import { n as SECRET_VALUE_PATTERNS, r as scrubSecretsInText, t as SECRET_KEYS } from "./scrub-secrets2.cjs";
2
+ export { SECRET_KEYS, SECRET_VALUE_PATTERNS, scrubSecretsInText };
@@ -1,2 +1,2 @@
1
- import { t as scrubSecretsInText } from "./scrub-secrets2.mjs";
2
- export { scrubSecretsInText };
1
+ import { n as SECRET_VALUE_PATTERNS, r as scrubSecretsInText, t as SECRET_KEYS } from "./scrub-secrets2.mjs";
2
+ export { SECRET_KEYS, SECRET_VALUE_PATTERNS, scrubSecretsInText };
@@ -1,3 +1,3 @@
1
- import { t as scrubSecretsInText } from "./scrub-secrets2.mjs";
1
+ import { n as SECRET_VALUE_PATTERNS, r as scrubSecretsInText, t as SECRET_KEYS } from "./scrub-secrets2.mjs";
2
2
 
3
- export { scrubSecretsInText };
3
+ export { SECRET_KEYS, SECRET_VALUE_PATTERNS, scrubSecretsInText };
@@ -32,6 +32,18 @@ function scrubSecretsInText(input) {
32
32
  }
33
33
 
34
34
  //#endregion
35
+ Object.defineProperty(exports, 'SECRET_KEYS', {
36
+ enumerable: true,
37
+ get: function () {
38
+ return SECRET_KEYS;
39
+ }
40
+ });
41
+ Object.defineProperty(exports, 'SECRET_VALUE_PATTERNS', {
42
+ enumerable: true,
43
+ get: function () {
44
+ return SECRET_VALUE_PATTERNS;
45
+ }
46
+ });
35
47
  Object.defineProperty(exports, 'scrubSecretsInText', {
36
48
  enumerable: true,
37
49
  get: function () {
@@ -1 +1 @@
1
- {"version":3,"file":"scrub-secrets2.cjs","names":["SECRET_VALUE_PATTERNS: readonly RegExp[]"],"sources":["../src/scrub-secrets.ts"],"sourcesContent":["/**\n * Replace common credential patterns in free-form text with `[REDACTED]`.\n *\n * Used before persisting or transmitting user-supplied text (telemetry\n * excerpts, eval report HTML, free-form feedback) where keys/tokens\n * accidentally pasted into prompts or command lines could otherwise leak\n * downstream.\n *\n * Conservative by design: matches well-known prefixed tokens, explicit\n * `key=value` pairs, and quoted JSON/JS-object fields with sensitive\n * names. We don't attempt to redact arbitrary long opaque strings — false\n * positives on file paths, IDs, or base64 payloads would make the output\n * unreadable.\n */\nconst SECRET_KEYS =\n\t'password|passwd|secret|credentials?|api[_-]?key|authorization|access[_-]?token|refresh[_-]?token|id[_-]?token|session[_-]?token|auth[_-]?token';\n\nconst SECRET_VALUE_PATTERNS: readonly RegExp[] = [\n\t// Authorization-header substrings: `Bearer <token>`, `Basic <token>`, `Token <token>`\n\t/\\b(?:Bearer|Basic|Token)\\s+[A-Za-z0-9._~+/=-]{12,}/gi,\n\t// OpenAI / Anthropic API keys\n\t/\\bsk-(?:ant-|proj-)?[A-Za-z0-9_-]{16,}/g,\n\t// Slack tokens (xoxb, xoxp, xoxa, xoxr, xoxs, xoxo)\n\t/\\bxox[abprso]-[A-Za-z0-9-]{10,}/g,\n\t// GitHub tokens (ghp, ghs, gho, ghr, ghu)\n\t/\\bgh[psoru]_[A-Za-z0-9]{20,}/g,\n\t// AWS access key id\n\t/\\bAKIA[0-9A-Z]{16}\\b/g,\n\t// JSON-shaped `\"key\": \"value\"` — matches the quoted field as a whole.\n\t// Run before the loose pattern so nested objects like\n\t// `{\"credentials\": {\"apiKey\": \"...\"}}` don't have the outer key consume\n\t// the inner key on its way to a non-quoted (object) value. The value\n\t// body uses the standard JSON-string idiom `(?:\\\\.|[^\"\\r\\n])*` so an\n\t// escaped quote inside the value (`\"abc\\\"def\"`) doesn't end the match\n\t// early and leak the rest of the secret. The negative lookahead skips\n\t// values that are already a `[redacted]` / `[REDACTED]` placeholder so\n\t// this stays idempotent when chained behind upstream object-walking\n\t// redaction (e.g. langsmith trace payloads).\n\tnew RegExp(\n\t\t`\"(?:${SECRET_KEYS})\"\\\\s*:\\\\s*\"(?!\\\\[(?:redacted|REDACTED)\\\\]\")(?:\\\\\\\\.|[^\"\\\\r\\\\n])*\"`,\n\t\t'gi',\n\t),\n\t// JS-object-shaped `'key': 'value'`\n\tnew RegExp(\n\t\t`'(?:${SECRET_KEYS})'\\\\s*:\\\\s*'(?!\\\\[(?:redacted|REDACTED)\\\\]')(?:\\\\\\\\.|[^'\\\\r\\\\n])*'`,\n\t\t'gi',\n\t),\n\t// Generic `password=...` / `api_key=...` / `secret=...` style assignments\n\tnew RegExp(`\\\\b(?:${SECRET_KEYS})\\\\s*[:=]\\\\s*\\\\S+`, 'gi'),\n];\n\nexport function scrubSecretsInText(input: string): string {\n\tlet out = input;\n\tfor (const pattern of SECRET_VALUE_PATTERNS) {\n\t\tout = out.replace(pattern, '[REDACTED]');\n\t}\n\treturn out;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAcA,MAAM,cACL;AAED,MAAMA,wBAA2C;CAEhD;CAEA;CAEA;CAEA;CAEA;CAWA,IAAI,OACH,OAAO,YAAY,qEACnB,KACA;CAED,IAAI,OACH,OAAO,YAAY,qEACnB,KACA;CAED,IAAI,OAAO,SAAS,YAAY,oBAAoB,KAAK;CACzD;AAED,SAAgB,mBAAmB,OAAuB;CACzD,IAAI,MAAM;AACV,MAAK,MAAM,WAAW,sBACrB,OAAM,IAAI,QAAQ,SAAS,aAAa;AAEzC,QAAO"}
1
+ {"version":3,"file":"scrub-secrets2.cjs","names":["SECRET_VALUE_PATTERNS: readonly RegExp[]"],"sources":["../src/scrub-secrets.ts"],"sourcesContent":["/**\n * Replace common credential patterns in free-form text with `[REDACTED]`.\n *\n * Used before persisting or transmitting user-supplied text (telemetry\n * excerpts, eval report HTML, free-form feedback) where keys/tokens\n * accidentally pasted into prompts or command lines could otherwise leak\n * downstream.\n *\n * Conservative by design: matches well-known prefixed tokens, explicit\n * `key=value` pairs, and quoted JSON/JS-object fields with sensitive\n * names. We don't attempt to redact arbitrary long opaque strings — false\n * positives on file paths, IDs, or base64 payloads would make the output\n * unreadable.\n */\nexport const SECRET_KEYS =\n\t'password|passwd|secret|credentials?|api[_-]?key|authorization|access[_-]?token|refresh[_-]?token|id[_-]?token|session[_-]?token|auth[_-]?token';\n\nexport const SECRET_VALUE_PATTERNS: readonly RegExp[] = [\n\t// Authorization-header substrings: `Bearer <token>`, `Basic <token>`, `Token <token>`\n\t/\\b(?:Bearer|Basic|Token)\\s+[A-Za-z0-9._~+/=-]{12,}/gi,\n\t// OpenAI / Anthropic API keys\n\t/\\bsk-(?:ant-|proj-)?[A-Za-z0-9_-]{16,}/g,\n\t// Slack tokens (xoxb, xoxp, xoxa, xoxr, xoxs, xoxo)\n\t/\\bxox[abprso]-[A-Za-z0-9-]{10,}/g,\n\t// GitHub tokens (ghp, ghs, gho, ghr, ghu)\n\t/\\bgh[psoru]_[A-Za-z0-9]{20,}/g,\n\t// AWS access key id\n\t/\\bAKIA[0-9A-Z]{16}\\b/g,\n\t// JSON-shaped `\"key\": \"value\"` — matches the quoted field as a whole.\n\t// Run before the loose pattern so nested objects like\n\t// `{\"credentials\": {\"apiKey\": \"...\"}}` don't have the outer key consume\n\t// the inner key on its way to a non-quoted (object) value. The value\n\t// body uses the standard JSON-string idiom `(?:\\\\.|[^\"\\r\\n])*` so an\n\t// escaped quote inside the value (`\"abc\\\"def\"`) doesn't end the match\n\t// early and leak the rest of the secret. The negative lookahead skips\n\t// values that are already a `[redacted]` / `[REDACTED]` placeholder so\n\t// this stays idempotent when chained behind upstream object-walking\n\t// redaction (e.g. langsmith trace payloads).\n\tnew RegExp(\n\t\t`\"(?:${SECRET_KEYS})\"\\\\s*:\\\\s*\"(?!\\\\[(?:redacted|REDACTED)\\\\]\")(?:\\\\\\\\.|[^\"\\\\r\\\\n])*\"`,\n\t\t'gi',\n\t),\n\t// JS-object-shaped `'key': 'value'`\n\tnew RegExp(\n\t\t`'(?:${SECRET_KEYS})'\\\\s*:\\\\s*'(?!\\\\[(?:redacted|REDACTED)\\\\]')(?:\\\\\\\\.|[^'\\\\r\\\\n])*'`,\n\t\t'gi',\n\t),\n\t// Generic `password=...` / `api_key=...` / `secret=...` style assignments\n\tnew RegExp(`\\\\b(?:${SECRET_KEYS})\\\\s*[:=]\\\\s*\\\\S+`, 'gi'),\n];\n\nexport function scrubSecretsInText(input: string): string {\n\tlet out = input;\n\tfor (const pattern of SECRET_VALUE_PATTERNS) {\n\t\tout = out.replace(pattern, '[REDACTED]');\n\t}\n\treturn out;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAcA,MAAa,cACZ;AAED,MAAaA,wBAA2C;CAEvD;CAEA;CAEA;CAEA;CAEA;CAWA,IAAI,OACH,OAAO,YAAY,qEACnB,KACA;CAED,IAAI,OACH,OAAO,YAAY,qEACnB,KACA;CAED,IAAI,OAAO,SAAS,YAAY,oBAAoB,KAAK;CACzD;AAED,SAAgB,mBAAmB,OAAuB;CACzD,IAAI,MAAM;AACV,MAAK,MAAM,WAAW,sBACrB,OAAM,IAAI,QAAQ,SAAS,aAAa;AAEzC,QAAO"}
@@ -1,5 +1,7 @@
1
1
  //#region src/scrub-secrets.d.ts
2
+ declare const SECRET_KEYS = "password|passwd|secret|credentials?|api[_-]?key|authorization|access[_-]?token|refresh[_-]?token|id[_-]?token|session[_-]?token|auth[_-]?token";
3
+ declare const SECRET_VALUE_PATTERNS: readonly RegExp[];
2
4
  declare function scrubSecretsInText(input: string): string;
3
5
  //#endregion
4
- export { scrubSecretsInText as t };
6
+ export { SECRET_VALUE_PATTERNS as n, scrubSecretsInText as r, SECRET_KEYS as t };
5
7
  //# sourceMappingURL=scrub-secrets2.d.cts.map
@@ -1,5 +1,7 @@
1
1
  //#region src/scrub-secrets.d.ts
2
+ declare const SECRET_KEYS = "password|passwd|secret|credentials?|api[_-]?key|authorization|access[_-]?token|refresh[_-]?token|id[_-]?token|session[_-]?token|auth[_-]?token";
3
+ declare const SECRET_VALUE_PATTERNS: readonly RegExp[];
2
4
  declare function scrubSecretsInText(input: string): string;
3
5
  //#endregion
4
- export { scrubSecretsInText as t };
6
+ export { SECRET_VALUE_PATTERNS as n, scrubSecretsInText as r, SECRET_KEYS as t };
5
7
  //# sourceMappingURL=scrub-secrets2.d.mts.map
@@ -31,5 +31,5 @@ function scrubSecretsInText(input) {
31
31
  }
32
32
 
33
33
  //#endregion
34
- export { scrubSecretsInText as t };
34
+ export { SECRET_VALUE_PATTERNS as n, scrubSecretsInText as r, SECRET_KEYS as t };
35
35
  //# sourceMappingURL=scrub-secrets2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"scrub-secrets2.mjs","names":["SECRET_VALUE_PATTERNS: readonly RegExp[]"],"sources":["../src/scrub-secrets.ts"],"sourcesContent":["/**\n * Replace common credential patterns in free-form text with `[REDACTED]`.\n *\n * Used before persisting or transmitting user-supplied text (telemetry\n * excerpts, eval report HTML, free-form feedback) where keys/tokens\n * accidentally pasted into prompts or command lines could otherwise leak\n * downstream.\n *\n * Conservative by design: matches well-known prefixed tokens, explicit\n * `key=value` pairs, and quoted JSON/JS-object fields with sensitive\n * names. We don't attempt to redact arbitrary long opaque strings — false\n * positives on file paths, IDs, or base64 payloads would make the output\n * unreadable.\n */\nconst SECRET_KEYS =\n\t'password|passwd|secret|credentials?|api[_-]?key|authorization|access[_-]?token|refresh[_-]?token|id[_-]?token|session[_-]?token|auth[_-]?token';\n\nconst SECRET_VALUE_PATTERNS: readonly RegExp[] = [\n\t// Authorization-header substrings: `Bearer <token>`, `Basic <token>`, `Token <token>`\n\t/\\b(?:Bearer|Basic|Token)\\s+[A-Za-z0-9._~+/=-]{12,}/gi,\n\t// OpenAI / Anthropic API keys\n\t/\\bsk-(?:ant-|proj-)?[A-Za-z0-9_-]{16,}/g,\n\t// Slack tokens (xoxb, xoxp, xoxa, xoxr, xoxs, xoxo)\n\t/\\bxox[abprso]-[A-Za-z0-9-]{10,}/g,\n\t// GitHub tokens (ghp, ghs, gho, ghr, ghu)\n\t/\\bgh[psoru]_[A-Za-z0-9]{20,}/g,\n\t// AWS access key id\n\t/\\bAKIA[0-9A-Z]{16}\\b/g,\n\t// JSON-shaped `\"key\": \"value\"` — matches the quoted field as a whole.\n\t// Run before the loose pattern so nested objects like\n\t// `{\"credentials\": {\"apiKey\": \"...\"}}` don't have the outer key consume\n\t// the inner key on its way to a non-quoted (object) value. The value\n\t// body uses the standard JSON-string idiom `(?:\\\\.|[^\"\\r\\n])*` so an\n\t// escaped quote inside the value (`\"abc\\\"def\"`) doesn't end the match\n\t// early and leak the rest of the secret. The negative lookahead skips\n\t// values that are already a `[redacted]` / `[REDACTED]` placeholder so\n\t// this stays idempotent when chained behind upstream object-walking\n\t// redaction (e.g. langsmith trace payloads).\n\tnew RegExp(\n\t\t`\"(?:${SECRET_KEYS})\"\\\\s*:\\\\s*\"(?!\\\\[(?:redacted|REDACTED)\\\\]\")(?:\\\\\\\\.|[^\"\\\\r\\\\n])*\"`,\n\t\t'gi',\n\t),\n\t// JS-object-shaped `'key': 'value'`\n\tnew RegExp(\n\t\t`'(?:${SECRET_KEYS})'\\\\s*:\\\\s*'(?!\\\\[(?:redacted|REDACTED)\\\\]')(?:\\\\\\\\.|[^'\\\\r\\\\n])*'`,\n\t\t'gi',\n\t),\n\t// Generic `password=...` / `api_key=...` / `secret=...` style assignments\n\tnew RegExp(`\\\\b(?:${SECRET_KEYS})\\\\s*[:=]\\\\s*\\\\S+`, 'gi'),\n];\n\nexport function scrubSecretsInText(input: string): string {\n\tlet out = input;\n\tfor (const pattern of SECRET_VALUE_PATTERNS) {\n\t\tout = out.replace(pattern, '[REDACTED]');\n\t}\n\treturn out;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAcA,MAAM,cACL;AAED,MAAMA,wBAA2C;CAEhD;CAEA;CAEA;CAEA;CAEA;CAWA,IAAI,OACH,OAAO,YAAY,qEACnB,KACA;CAED,IAAI,OACH,OAAO,YAAY,qEACnB,KACA;CAED,IAAI,OAAO,SAAS,YAAY,oBAAoB,KAAK;CACzD;AAED,SAAgB,mBAAmB,OAAuB;CACzD,IAAI,MAAM;AACV,MAAK,MAAM,WAAW,sBACrB,OAAM,IAAI,QAAQ,SAAS,aAAa;AAEzC,QAAO"}
1
+ {"version":3,"file":"scrub-secrets2.mjs","names":["SECRET_VALUE_PATTERNS: readonly RegExp[]"],"sources":["../src/scrub-secrets.ts"],"sourcesContent":["/**\n * Replace common credential patterns in free-form text with `[REDACTED]`.\n *\n * Used before persisting or transmitting user-supplied text (telemetry\n * excerpts, eval report HTML, free-form feedback) where keys/tokens\n * accidentally pasted into prompts or command lines could otherwise leak\n * downstream.\n *\n * Conservative by design: matches well-known prefixed tokens, explicit\n * `key=value` pairs, and quoted JSON/JS-object fields with sensitive\n * names. We don't attempt to redact arbitrary long opaque strings — false\n * positives on file paths, IDs, or base64 payloads would make the output\n * unreadable.\n */\nexport const SECRET_KEYS =\n\t'password|passwd|secret|credentials?|api[_-]?key|authorization|access[_-]?token|refresh[_-]?token|id[_-]?token|session[_-]?token|auth[_-]?token';\n\nexport const SECRET_VALUE_PATTERNS: readonly RegExp[] = [\n\t// Authorization-header substrings: `Bearer <token>`, `Basic <token>`, `Token <token>`\n\t/\\b(?:Bearer|Basic|Token)\\s+[A-Za-z0-9._~+/=-]{12,}/gi,\n\t// OpenAI / Anthropic API keys\n\t/\\bsk-(?:ant-|proj-)?[A-Za-z0-9_-]{16,}/g,\n\t// Slack tokens (xoxb, xoxp, xoxa, xoxr, xoxs, xoxo)\n\t/\\bxox[abprso]-[A-Za-z0-9-]{10,}/g,\n\t// GitHub tokens (ghp, ghs, gho, ghr, ghu)\n\t/\\bgh[psoru]_[A-Za-z0-9]{20,}/g,\n\t// AWS access key id\n\t/\\bAKIA[0-9A-Z]{16}\\b/g,\n\t// JSON-shaped `\"key\": \"value\"` — matches the quoted field as a whole.\n\t// Run before the loose pattern so nested objects like\n\t// `{\"credentials\": {\"apiKey\": \"...\"}}` don't have the outer key consume\n\t// the inner key on its way to a non-quoted (object) value. The value\n\t// body uses the standard JSON-string idiom `(?:\\\\.|[^\"\\r\\n])*` so an\n\t// escaped quote inside the value (`\"abc\\\"def\"`) doesn't end the match\n\t// early and leak the rest of the secret. The negative lookahead skips\n\t// values that are already a `[redacted]` / `[REDACTED]` placeholder so\n\t// this stays idempotent when chained behind upstream object-walking\n\t// redaction (e.g. langsmith trace payloads).\n\tnew RegExp(\n\t\t`\"(?:${SECRET_KEYS})\"\\\\s*:\\\\s*\"(?!\\\\[(?:redacted|REDACTED)\\\\]\")(?:\\\\\\\\.|[^\"\\\\r\\\\n])*\"`,\n\t\t'gi',\n\t),\n\t// JS-object-shaped `'key': 'value'`\n\tnew RegExp(\n\t\t`'(?:${SECRET_KEYS})'\\\\s*:\\\\s*'(?!\\\\[(?:redacted|REDACTED)\\\\]')(?:\\\\\\\\.|[^'\\\\r\\\\n])*'`,\n\t\t'gi',\n\t),\n\t// Generic `password=...` / `api_key=...` / `secret=...` style assignments\n\tnew RegExp(`\\\\b(?:${SECRET_KEYS})\\\\s*[:=]\\\\s*\\\\S+`, 'gi'),\n];\n\nexport function scrubSecretsInText(input: string): string {\n\tlet out = input;\n\tfor (const pattern of SECRET_VALUE_PATTERNS) {\n\t\tout = out.replace(pattern, '[REDACTED]');\n\t}\n\treturn out;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAcA,MAAa,cACZ;AAED,MAAaA,wBAA2C;CAEvD;CAEA;CAEA;CAEA;CAEA;CAWA,IAAI,OACH,OAAO,YAAY,qEACnB,KACA;CAED,IAAI,OACH,OAAO,YAAY,qEACnB,KACA;CAED,IAAI,OAAO,SAAS,YAAY,oBAAoB,KAAK;CACzD;AAED,SAAgB,mBAAmB,OAAuB;CACzD,IAAI,MAAM;AACV,MAAK,MAAM,WAAW,sBACrB,OAAM,IAAI,QAAQ,SAAS,aAAa;AAEzC,QAAO"}
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@n8n/utils",
3
3
  "type": "module",
4
- "version": "1.34.0",
4
+ "version": "1.35.0",
5
5
  "files": [
6
6
  "dist",
7
- "LICENSE_EE.md",
8
- "LICENSE.md"
7
+ "LICENSE.md",
8
+ "LICENSE_EE.md"
9
9
  ],
10
10
  "main": "./dist/index.cjs",
11
11
  "module": "./dist/index.mjs",
@@ -29,7 +29,7 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "nanoid": "3.3.8",
32
- "@n8n/constants": "0.26.0"
32
+ "@n8n/constants": "0.27.0"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@testing-library/jest-dom": "^6.6.3",
@@ -38,9 +38,9 @@
38
38
  "typescript": "6.0.2",
39
39
  "vite": "^8.0.2",
40
40
  "vitest": "^4.1.1",
41
+ "@n8n/typescript-config": "1.6.0",
41
42
  "@n8n/eslint-config": "0.0.1",
42
- "@n8n/typescript-config": "1.5.0",
43
- "@n8n/vitest-config": "1.14.0"
43
+ "@n8n/vitest-config": "1.15.0"
44
44
  },
45
45
  "license": "SEE LICENSE IN LICENSE.md",
46
46
  "homepage": "https://n8n.io",