@sayknow-cli/utils 0.5.6 → 0.5.9
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/package.json +2 -2
- package/src/postmortem.ts +33 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@sayknow-cli/utils",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.9",
|
|
5
5
|
"description": "Shared utilities for pi packages",
|
|
6
6
|
"homepage": "https://sayknow-cli.com",
|
|
7
7
|
"author": "jaybeyond",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"fmt": "biome format --write ."
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@sayknow-cli/natives": "0.5.
|
|
34
|
+
"@sayknow-cli/natives": "0.5.9",
|
|
35
35
|
"beautiful-mermaid": "^1.1.3",
|
|
36
36
|
"handlebars": "^4.7.9",
|
|
37
37
|
"winston": "^3.19.0",
|
package/src/postmortem.ts
CHANGED
|
@@ -229,11 +229,42 @@ function redactCrashSecrets(text: string): string {
|
|
|
229
229
|
redacted = redacted.replace(/\b(?:Bearer|Basic|Token)\s+[A-Za-z0-9._~+/=-]{8,}/gi, "«redacted-auth»");
|
|
230
230
|
redacted = redacted.replace(/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, "«redacted-jwt»");
|
|
231
231
|
redacted = redacted.replace(/\bsk-[A-Za-z0-9_-]{8,}\b/g, "«redacted-api-key»");
|
|
232
|
+
// `gh[opsur]_` covers the classic PAT/OAuth/server/user/refresh prefixes;
|
|
233
|
+
// fine-grained PATs use an entirely different `github_pat_` prefix.
|
|
232
234
|
redacted = redacted.replace(/\bgh[opsur]_[A-Za-z0-9]{16,}\b/g, "«redacted-github-token»");
|
|
235
|
+
redacted = redacted.replace(/\bgithub_pat_[A-Za-z0-9_]{20,}\b/g, "«redacted-github-token»");
|
|
233
236
|
redacted = redacted.replace(/\bxox[baprs]-[A-Za-z0-9-]{8,}\b/g, "«redacted-slack-token»");
|
|
234
|
-
redacted = redacted.replace(/\
|
|
237
|
+
redacted = redacted.replace(/\bnpm_[A-Za-z0-9]{20,}\b/g, "«redacted-npm-token»");
|
|
238
|
+
redacted = redacted.replace(/\bglpat-[A-Za-z0-9_-]{20,}\b/g, "«redacted-gitlab-token»");
|
|
239
|
+
// Stripe separates with `_`, so the `sk-` rule above never matched one.
|
|
240
|
+
redacted = redacted.replace(/\b(?:sk|rk)_(?:live|test)_[A-Za-z0-9]{16,}\b/g, "«redacted-api-key»");
|
|
241
|
+
redacted = redacted.replace(/\bhf_[A-Za-z0-9]{20,}\b/g, "«redacted-api-key»");
|
|
242
|
+
// A PEM block carries the key material itself, so it is redacted whole rather
|
|
243
|
+
// than line by line, before narrower rules can chew on the base64 body.
|
|
235
244
|
redacted = redacted.replace(
|
|
236
|
-
|
|
245
|
+
/-----BEGIN [A-Z0-9 ]*PRIVATE KEY-----[\s\S]*?-----END [A-Z0-9 ]*PRIVATE KEY-----/g,
|
|
246
|
+
"«redacted-private-key»",
|
|
247
|
+
);
|
|
248
|
+
// Google API keys are a fixed 39-character shape with no label of their own.
|
|
249
|
+
redacted = redacted.replace(
|
|
250
|
+
/(?<![A-Za-z0-9_-])AIza[0-9A-Za-z_-]{35}(?![A-Za-z0-9_-])/g,
|
|
251
|
+
"«redacted-google-api-key»",
|
|
252
|
+
);
|
|
253
|
+
// Basic-auth credentials embedded in a URL. Scheme and host stay readable
|
|
254
|
+
// because they are the diagnostic value; only the userinfo is dropped. The
|
|
255
|
+
// scheme repetition is bounded so a long alphabetic run cannot go quadratic.
|
|
256
|
+
redacted = redacted.replace(
|
|
257
|
+
/(?<![A-Za-z0-9+.-])([a-z][a-z0-9+.-]{0,15}:\/\/)[^/\s:@]{1,256}:[^/\s@]{1,256}@/gi,
|
|
258
|
+
"$1«redacted-url-credential»@",
|
|
259
|
+
);
|
|
260
|
+
// AKIA is the long-term AWS access key id; ASIA the temporary/STS one, which
|
|
261
|
+
// is the shape that actually shows up in a crashed request. ABIA/ACCA
|
|
262
|
+
// complete the set. The id alone is not the credential: STS payloads carry
|
|
263
|
+
// `SecretAccessKey` and `SessionToken` alongside it, so the labeled-value
|
|
264
|
+
// rule below names both.
|
|
265
|
+
redacted = redacted.replace(/\b(?:AKIA|ASIA|ABIA|ACCA)[0-9A-Z]{16}\b/g, "«redacted-aws-key»");
|
|
266
|
+
redacted = redacted.replace(
|
|
267
|
+
/(?<![A-Za-z0-9_])(["']?(?:api[_-]?key|apikey|access[_-]?token|refresh[_-]?token|id[_-]?token|session[_-]?token|client[_-]?secret|secret[_-]?key|secret[_-]?access[_-]?key|password|passwd|authorization)["']?\s*[=:]\s*["']?)[^\s"',;}\]]{8,}/gi,
|
|
237
268
|
"$1«redacted»",
|
|
238
269
|
);
|
|
239
270
|
return redacted;
|