@mnemonik/shared 7.131.1 → 7.133.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secretPatterns.d.ts","sourceRoot":"","sources":["../src/secretPatterns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,eAAO,MAAM,4BAA4B,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"secretPatterns.d.ts","sourceRoot":"","sources":["../src/secretPatterns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,eAAO,MAAM,4BAA4B,eAAe,CAAC;AASzD,eAAO,MAAM,eAAe,EAAE,aAAa,CAAC,MAAM,CAoDjD,CAAC;AA4HF;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAc5D;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAWjD"}
|
package/dist/secretPatterns.js
CHANGED
|
@@ -41,8 +41,14 @@
|
|
|
41
41
|
*/
|
|
42
42
|
export const SECRET_REDACTION_PLACEHOLDER = '[REDACTED]';
|
|
43
43
|
// Shared by the scanner daemon and server-side scrub paths.
|
|
44
|
+
//
|
|
45
|
+
// A value must hold a letter or a digit, in every pattern whose value is free
|
|
46
|
+
// text after a label (key=value, URL userinfo, Bearer): a run of punctuation is
|
|
47
|
+
// never a credential. Before this rule the key=value pattern ate prose about a
|
|
48
|
+
// flag: "--password=; repeated copies" in a stored checkpoint became
|
|
49
|
+
// "--[REDACTED] repeated copies" (2026-10-13), and so did "password: ***".
|
|
44
50
|
export const SECRET_PATTERNS = [
|
|
45
|
-
/(?:api[_-]?key|secret|token|password|credential|auth)\s*[:=]\s
|
|
51
|
+
/(?:api[_-]?key|secret|token|password|credential|auth)\s*[:=]\s*(?=\S*[A-Za-z0-9])\S+/gi,
|
|
46
52
|
// Stripe-shape: (sk|pk)_(live|test)_<24+ alphanumerics>. Catches modern
|
|
47
53
|
// Stripe keys whose body is split by an environment separator that
|
|
48
54
|
// breaks the contiguous-alphanum pattern below. Required `live|test`
|
|
@@ -78,12 +84,12 @@ export const SECRET_PATTERNS = [
|
|
|
78
84
|
// host and path survive for anyone reading the code. Userinfo may contain
|
|
79
85
|
// empty fields or additional `:` / `@` characters; greediness selects its
|
|
80
86
|
// final `@`, while `/`, `?`, and `#` keep paths and queries out of the match.
|
|
81
|
-
/\b[a-z][a-z0-9+.-]*:\/\/[^/\s?#]*@/gi,
|
|
87
|
+
/\b[a-z][a-z0-9+.-]*:\/\/(?=[^/\s?#]*[A-Za-z0-9][^/\s?#]*@)[^/\s?#]*@/gi,
|
|
82
88
|
// Authorization: Bearer <token>. The token class deliberately excludes
|
|
83
89
|
// `<` and `$`, so documentation placeholders (`Bearer <your-api-key>`,
|
|
84
90
|
// `Bearer $MNEMONIK_PROXY_TOKEN`) are left intact - redacting those would
|
|
85
91
|
// destroy the instruction without hiding a secret.
|
|
86
|
-
/Authorization\s*:\s*Bearer\s+[A-Za-z0-9._~+/-]+=*/gi,
|
|
92
|
+
/Authorization\s*:\s*Bearer\s+(?=[._~+/-]*[A-Za-z0-9])[A-Za-z0-9._~+/-]+=*/gi,
|
|
87
93
|
// sshpass -p <password> (also -p'<password>' and -p"<password>"): only the
|
|
88
94
|
// password word is consumed, so the command stays readable. A shell
|
|
89
95
|
// expansion (`$PASS`, `"$PASS"`), a `<placeholder>`, an earlier redaction
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secretPatterns.js","sourceRoot":"","sources":["../src/secretPatterns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,MAAM,CAAC,MAAM,4BAA4B,GAAG,YAAY,CAAC;AAEzD,4DAA4D;AAC5D,MAAM,CAAC,MAAM,eAAe,GAA0B;IACpD,
|
|
1
|
+
{"version":3,"file":"secretPatterns.js","sourceRoot":"","sources":["../src/secretPatterns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,MAAM,CAAC,MAAM,4BAA4B,GAAG,YAAY,CAAC;AAEzD,4DAA4D;AAC5D,EAAE;AACF,8EAA8E;AAC9E,gFAAgF;AAChF,+EAA+E;AAC/E,qEAAqE;AACrE,2EAA2E;AAC3E,MAAM,CAAC,MAAM,eAAe,GAA0B;IACpD,wFAAwF;IACxF,wEAAwE;IACxE,mEAAmE;IACnE,qEAAqE;IACrE,kEAAkE;IAClE,2CAA2C;IAC3C,2CAA2C;IAC3C,gCAAgC;IAChC,sBAAsB;IACtB,0BAA0B;IAC1B,wEAAwE;IACxE,wEAAwE;IACxE,oEAAoE;IACpE,oEAAoE;IACpE,sEAAsE;IACtE,qHAAqH;IACrH,yDAAyD;IACzD,0EAA0E;IAC1E,mEAAmE;IACnE,uBAAuB;IACvB,uBAAuB;IACvB,2EAA2E;IAC3E,2EAA2E;IAC3E,oDAAoD;IACpD,yDAAyD;IACzD,yEAAyE;IACzE,oCAAoC;IACpC,mEAAmE;IACnE,mCAAmC;IACnC,4BAA4B;IAC5B,gCAAgC;IAChC,qCAAqC;IACrC,sEAAsE;IACtE,0EAA0E;IAC1E,0EAA0E;IAC1E,8EAA8E;IAC9E,wEAAwE;IACxE,uEAAuE;IACvE,uEAAuE;IACvE,0EAA0E;IAC1E,mDAAmD;IACnD,6EAA6E;IAC7E,2EAA2E;IAC3E,oEAAoE;IACpE,0EAA0E;IAC1E,yFAAyF;IACzF,6EAA6E;IAC7E,uEAAuE;IACvE,6EAA6E;IAC7E,qBAAqB;IACrB,kTAAkT;CACnT,CAAC;AAEF;;;;;;GAMG;AACH;;;;;;GAMG;AACH,MAAM,iBAAiB,GAAG,gEAAgE,CAAC;AAE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,8 +43,14 @@
|
|
|
43
43
|
export const SECRET_REDACTION_PLACEHOLDER = '[REDACTED]';
|
|
44
44
|
|
|
45
45
|
// Shared by the scanner daemon and server-side scrub paths.
|
|
46
|
+
//
|
|
47
|
+
// A value must hold a letter or a digit, in every pattern whose value is free
|
|
48
|
+
// text after a label (key=value, URL userinfo, Bearer): a run of punctuation is
|
|
49
|
+
// never a credential. Before this rule the key=value pattern ate prose about a
|
|
50
|
+
// flag: "--password=; repeated copies" in a stored checkpoint became
|
|
51
|
+
// "--[REDACTED] repeated copies" (2026-10-13), and so did "password: ***".
|
|
46
52
|
export const SECRET_PATTERNS: ReadonlyArray<RegExp> = [
|
|
47
|
-
/(?:api[_-]?key|secret|token|password|credential|auth)\s*[:=]\s
|
|
53
|
+
/(?:api[_-]?key|secret|token|password|credential|auth)\s*[:=]\s*(?=\S*[A-Za-z0-9])\S+/gi,
|
|
48
54
|
// Stripe-shape: (sk|pk)_(live|test)_<24+ alphanumerics>. Catches modern
|
|
49
55
|
// Stripe keys whose body is split by an environment separator that
|
|
50
56
|
// breaks the contiguous-alphanum pattern below. Required `live|test`
|
|
@@ -80,12 +86,12 @@ export const SECRET_PATTERNS: ReadonlyArray<RegExp> = [
|
|
|
80
86
|
// host and path survive for anyone reading the code. Userinfo may contain
|
|
81
87
|
// empty fields or additional `:` / `@` characters; greediness selects its
|
|
82
88
|
// final `@`, while `/`, `?`, and `#` keep paths and queries out of the match.
|
|
83
|
-
/\b[a-z][a-z0-9+.-]*:\/\/[^/\s?#]*@/gi,
|
|
89
|
+
/\b[a-z][a-z0-9+.-]*:\/\/(?=[^/\s?#]*[A-Za-z0-9][^/\s?#]*@)[^/\s?#]*@/gi,
|
|
84
90
|
// Authorization: Bearer <token>. The token class deliberately excludes
|
|
85
91
|
// `<` and `$`, so documentation placeholders (`Bearer <your-api-key>`,
|
|
86
92
|
// `Bearer $MNEMONIK_PROXY_TOKEN`) are left intact - redacting those would
|
|
87
93
|
// destroy the instruction without hiding a secret.
|
|
88
|
-
/Authorization\s*:\s*Bearer\s+[A-Za-z0-9._~+/-]+=*/gi,
|
|
94
|
+
/Authorization\s*:\s*Bearer\s+(?=[._~+/-]*[A-Za-z0-9])[A-Za-z0-9._~+/-]+=*/gi,
|
|
89
95
|
// sshpass -p <password> (also -p'<password>' and -p"<password>"): only the
|
|
90
96
|
// password word is consumed, so the command stays readable. A shell
|
|
91
97
|
// expansion (`$PASS`, `"$PASS"`), a `<placeholder>`, an earlier redaction
|