hillclimb 0.9.10 → 0.9.11

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/main.js CHANGED
@@ -3537,6 +3537,7 @@ async function parseEnvFile(filePath) {
3537
3537
  const eqIndex = trimmed.indexOf("=");
3538
3538
  if (eqIndex === -1) continue;
3539
3539
  let value = trimmed.slice(eqIndex + 1).trim();
3540
+ let raw = null;
3540
3541
  if (value.startsWith('"') || value.startsWith("'")) {
3541
3542
  const quote = value[0];
3542
3543
  let end = -1;
@@ -3551,7 +3552,8 @@ async function parseEnvFile(filePath) {
3551
3552
  }
3552
3553
  }
3553
3554
  if (end !== -1) {
3554
- value = value.slice(1, end).replace(/\\(.)/g, "$1");
3555
+ raw = value.slice(1, end);
3556
+ value = raw.replace(/\\(.)/g, "$1");
3555
3557
  } else {
3556
3558
  value = value.slice(1);
3557
3559
  }
@@ -3564,6 +3566,7 @@ async function parseEnvFile(filePath) {
3564
3566
  }
3565
3567
  if (!value) continue;
3566
3568
  values.push(value);
3569
+ if (raw !== null && raw !== value) values.push(raw);
3567
3570
  }
3568
3571
  return values;
3569
3572
  }
@@ -3573,6 +3576,11 @@ function addWithVariants(set, value) {
3573
3576
  if (encoded !== value) {
3574
3577
  set.add(encoded);
3575
3578
  }
3579
+ const escaped = JSON.stringify(value).slice(1, -1);
3580
+ if (escaped !== value) {
3581
+ set.add(escaped);
3582
+ set.add(JSON.stringify(escaped).slice(1, -1));
3583
+ }
3576
3584
  if (value.includes("://")) {
3577
3585
  try {
3578
3586
  const url = new URL(value);
@@ -13240,69 +13248,115 @@ var patterns_default = {
13240
13248
  // src/middleware/patterns-local.json
13241
13249
  var patterns_local_default = {
13242
13250
  patterns: [
13251
+ {
13252
+ name: "Private Key Block (any line prefixes)",
13253
+ regex: "-{4,5}\\s{0,4}BEGIN[ A-Z0-9_-]{0,100}PRIVATE KEY(?: BLOCK)?\\s{0,4}-{4,5}[\\s\\S]{0,20000}?-{4,5}\\s{0,4}END[ A-Z0-9_-]{0,100}PRIVATE KEY(?: BLOCK)?\\s{0,4}-{4,5}",
13254
+ confidence: "high",
13255
+ validator: "pem-body",
13256
+ precheck: ["private key"]
13257
+ },
13258
+ {
13259
+ name: "Private Key Block (body required, END optional)",
13260
+ regex: `-{4,5} ?BEGIN[ A-Z0-9_-]{0,100}PRIVATE KEY(?: BLOCK)? ?-{4,5}(?:(?:\\s|\\\\{1,8}[nrt]|(?:(?<![A-Za-z0-9+/=])|(?<=\\\\[nrt]))\\d{1,6}(?:\\u2192|\\t|\\\\t)|[|>"',+-]){0,16}[A-Z][A-Za-z-]{1,30}:[^\\n\\\\]{0,200}(?=[\\n\\\\]|$)){0,8}(?:\\s|\\\\{1,8}[nrt]|(?:(?<![A-Za-z0-9+/=])|(?<=\\\\[nrt]))\\d{1,6}(?:\\u2192|\\t|\\\\t)|[|>"',+-]){0,16}(?=[A-Za-z0-9+/]{40})(?:[\\s\\S]{0,20000}?-{4,5} ?END[ A-Z0-9_-]{0,100}PRIVATE KEY(?: BLOCK)? ?-{4,5}|(?:[A-Za-z0-9+/=]|\\[REDACTED\\]){16,}(?:(?:\\s|\\\\{1,8}[nrt]|(?:(?<![A-Za-z0-9+/=])|(?<=\\\\[nrt]))\\d{1,6}(?:\\u2192|\\t|\\\\t)|[|>"',+-]){1,16}(?:[A-Za-z0-9+/=]|\\[REDACTED\\]){16,}){0,500}(?:(?:\\s|\\\\{1,8}[nrt]|(?:(?<![A-Za-z0-9+/=])|(?<=\\\\[nrt]))\\d{1,6}(?:\\u2192|\\t|\\\\t)|[|>"',+-]){1,16}[A-Za-z0-9+/=]{1,15}(?=(?:\\s|\\\\{1,8}[nrt]|(?:(?<![A-Za-z0-9+/=])|(?<=\\\\[nrt]))\\d{1,6}(?:\\u2192|\\t|\\\\t)|[|>"',+-]){0,16}-{4,5} ?END[ A-Z0-9_-]{0,100}PRIVATE KEY(?: BLOCK)? ?-{4,5}))?(?:(?:\\s|\\\\{1,8}[nrt]|(?:(?<![A-Za-z0-9+/=])|(?<=\\\\[nrt]))\\d{1,6}(?:\\u2192|\\t|\\\\t)|[|>"',+-]){0,16}-{4,5} ?END[ A-Z0-9_-]{0,100}PRIVATE KEY(?: BLOCK)? ?-{4,5})?)`,
13261
+ confidence: "high",
13262
+ precheck: ["private key"]
13263
+ },
13264
+ {
13265
+ name: "Private Key Body Before END (no BEGIN)",
13266
+ regex: "(?:(?<![A-Za-z0-9+/=\\\\])|(?<=\\\\[nrt]))(?<![A-Za-z0-9+/=]{16}(?:\\s|\\\\{1,8}[nrt]|(?:(?<![A-Za-z0-9+/=])|(?<=\\\\[nrt]))\\d{1,6}(?:\\u2192|\\t|\\\\t)|[|>-]){1,16})(?=(?:[A-Za-z0-9+/=]{16,}(?:\\s|\\\\{1,8}[nrt]|(?:(?<![A-Za-z0-9+/=])|(?<=\\\\[nrt]))\\d{1,6}(?:\\u2192|\\t|\\\\t)|[|>-]){1,16}){0,3}[A-Za-z0-9+/=]{40})(?:[A-Za-z0-9+/=]|\\[REDACTED\\]){16,}(?:(?:\\s|\\\\{1,8}[nrt]|(?:(?<![A-Za-z0-9+/=])|(?<=\\\\[nrt]))\\d{1,6}(?:\\u2192|\\t|\\\\t)|[|>-]){1,16}(?:[A-Za-z0-9+/=]|\\[REDACTED\\]){16,}){0,500}(?:(?:\\s|\\\\{1,8}[nrt]|(?:(?<![A-Za-z0-9+/=])|(?<=\\\\[nrt]))\\d{1,6}(?:\\u2192|\\t|\\\\t)|[|>-]){1,16}[A-Za-z0-9+/=]{1,15})?(?:\\s|\\\\{1,8}[nrt]|(?:(?<![A-Za-z0-9+/=])|(?<=\\\\[nrt]))\\d{1,6}(?:\\u2192|\\t|\\\\t)|[|>-]){0,16}-{4,5} ?END[ A-Z0-9_-]{0,100}PRIVATE KEY(?: BLOCK)? ?-{4,5}",
13267
+ confidence: "high",
13268
+ precheck: ["private key"]
13269
+ },
13270
+ {
13271
+ name: "Base64-Encoded PEM Private Key",
13272
+ regex: "(?:(?<![A-Za-z0-9+/])|(?<=\\\\[nrt]))LS0tLS1CRUdJTi[A-Za-z0-9+/]{40,}={0,2}(?:(?:\\r?\\n|\\\\{1,8}[nr])[ \\t]{0,32}(?:\\d{1,6}(?:\\u2192|\\t|\\\\t)[ \\t]{0,32})?[A-Za-z0-9+/]{16,}={0,2})*",
13273
+ confidence: "high",
13274
+ validator: "b64-private-key",
13275
+ precheck: ["ls0tls1crudjti"]
13276
+ },
13277
+ {
13278
+ name: "PuTTY Private Key Lines",
13279
+ regex: "Private-Lines: ?\\d{1,3}(?:\\s|\\\\{1,8}[nrt]|(?:(?<![A-Za-z0-9+/=])|(?<=\\\\[nrt]))\\d{1,6}(?:\\u2192|\\t|\\\\t)){1,16}([A-Za-z0-9+/=]{16,}(?:(?:\\s|\\\\{1,8}[nrt]|(?:(?<![A-Za-z0-9+/=])|(?<=\\\\[nrt]))\\d{1,6}(?:\\u2192|\\t|\\\\t)){1,16}[A-Za-z0-9+/=]{16,}){0,99}(?:(?:\\s|\\\\{1,8}[nrt]|(?:(?<![A-Za-z0-9+/=])|(?<=\\\\[nrt]))\\d{1,6}(?:\\u2192|\\t|\\\\t)){1,16}[A-Za-z0-9+/=]{1,15}(?=(?:\\s|\\\\{1,8}[nrt]|(?:(?<![A-Za-z0-9+/=])|(?<=\\\\[nrt]))\\d{1,6}(?:\\u2192|\\t|\\\\t)){1,16}Private-MAC))?)",
13280
+ confidence: "high",
13281
+ precheck: ["private-lines"]
13282
+ },
13243
13283
  {
13244
13284
  name: "Hugging Face User Access Token",
13245
- regex: "(?:(?<![A-Za-z0-9])|(?<=\\\\[nrt]))hf_[A-Za-z0-9]{34,40}",
13285
+ regex: "hf_(?:(?<![A-Za-z0-9]hf_)|(?<=\\\\[nrt]hf_))[A-Za-z0-9]{34,40}",
13246
13286
  confidence: "high",
13247
13287
  precheck: ["hf_"]
13248
13288
  },
13249
13289
  {
13250
13290
  name: "Hugging Face Organization API Token",
13251
- regex: "(?:(?<![A-Za-z0-9])|(?<=\\\\[nrt]))api_org_[A-Za-z0-9]{34,40}",
13291
+ regex: "api_org_(?:(?<![A-Za-z0-9]api_org_)|(?<=\\\\[nrt]api_org_))[A-Za-z0-9]{34,40}",
13252
13292
  confidence: "high",
13253
13293
  precheck: ["api_org_"]
13254
13294
  },
13255
13295
  {
13256
13296
  name: "OpenRouter API Key",
13257
- regex: "(?:(?<![A-Za-z0-9])|(?<=\\\\[nrt]))sk-or-v1-[a-fA-F0-9]{64}",
13297
+ regex: "sk-or-v1-(?:(?<![A-Za-z0-9]sk-or-v1-)|(?<=\\\\[nrt]sk-or-v1-))[a-fA-F0-9]{64}",
13258
13298
  confidence: "high",
13259
13299
  precheck: ["sk-or-"]
13260
13300
  },
13261
13301
  {
13262
13302
  name: "OpenRouter API Key (generic)",
13263
- regex: "(?:(?<![A-Za-z0-9])|(?<=\\\\[nrt]))sk-or-[A-Za-z0-9-]{32,128}",
13303
+ regex: "sk-or-(?:(?<![A-Za-z0-9]sk-or-)|(?<=\\\\[nrt]sk-or-))[A-Za-z0-9-]{32,128}",
13264
13304
  confidence: "high",
13265
13305
  precheck: ["sk-or-"]
13266
13306
  },
13267
13307
  {
13268
13308
  name: "Anthropic API Key",
13269
- regex: "(?:(?<![A-Za-z0-9])|(?<=\\\\[nrt]))sk-ant-[A-Za-z0-9_-]{32,256}",
13309
+ regex: "sk-ant-(?:(?<![A-Za-z0-9]sk-ant-)|(?<=\\\\[nrt]sk-ant-))[A-Za-z0-9_-]{32,256}",
13270
13310
  confidence: "high",
13271
13311
  precheck: ["sk-ant-"]
13272
13312
  },
13273
13313
  {
13274
13314
  name: "OpenAI Project API Key",
13275
- regex: "(?:(?<![A-Za-z0-9])|(?<=\\\\[nrt]))sk-proj-[A-Za-z0-9_-]{32,256}",
13315
+ regex: "sk-proj-(?:(?<![A-Za-z0-9]sk-proj-)|(?<=\\\\[nrt]sk-proj-))[A-Za-z0-9_-]{32,256}",
13276
13316
  confidence: "high",
13277
13317
  precheck: ["sk-proj-"]
13278
13318
  },
13279
13319
  {
13280
13320
  name: "OpenAI API Key (legacy)",
13281
- regex: "(?:(?<![A-Za-z0-9])|(?<=\\\\[nrt]))sk-[A-Za-z0-9]{20}T3BlbkFJ[A-Za-z0-9]{20}",
13321
+ regex: "sk-(?:(?<![A-Za-z0-9]sk-)|(?<=\\\\[nrt]sk-))[A-Za-z0-9]{20}T3BlbkFJ[A-Za-z0-9]{20}",
13282
13322
  confidence: "high",
13283
13323
  precheck: ["t3blbkfj"]
13284
13324
  },
13285
13325
  {
13286
13326
  name: "sshpass Command-Line Password",
13287
- regex: `sshpass\\s+-p\\s*(?:'[^']{1,128}'|"[^"]{1,128}"|[^\\s'"-][^\\s'"]{0,127})`,
13327
+ regex: `sshpass\\s+-p\\s*(?:'[^']{1,128}'|"(?:[^"\\\\]|\\\\.){1,128}"|\\\\{1,7}"(?:(?!\\\\{1,7}").){1,128}\\\\{1,7}"|[^\\s'"\\\\-](?:[^\\s'"\\\\]|\\\\.){0,127})`,
13288
13328
  confidence: "high",
13289
13329
  precheck: ["sshpass"]
13290
13330
  },
13291
13331
  {
13292
13332
  name: "URL Userinfo Credentials",
13293
- regex: ":\\/\\/([^\\s:@\\/]{1,64}:[^\\s@\\/]{1,128})@",
13333
+ regex: ":(?:\\/\\/|(?:\\\\{1,7}\\/){2})([^\\s:\\/]{0,64}:[^\\s\\/]{1,128})@",
13334
+ confidence: "high",
13335
+ precheck: ["://", ":\\"]
13336
+ },
13337
+ {
13338
+ name: "URL Token Userinfo",
13339
+ regex: ":(?:\\/\\/|(?:\\\\{1,7}\\/){2})([A-Za-z0-9_~.%+-]{16,256})@[A-Za-z0-9\\[]",
13340
+ confidence: "high",
13341
+ validator: "high-entropy",
13342
+ precheck: ["://", ":\\"]
13343
+ },
13344
+ {
13345
+ name: "DB URL Password With Slash",
13346
+ regex: `(?:postgres(?:ql)?|mysql|mariadb|mongodb(?:\\+srv)?|rediss?|amqps?|mssql|sqlserver|clickhouse)(?:\\+\\w+)?:(?:\\/\\/|(?:\\\\{1,7}\\/){2})([^\\s:\\/]{0,64}:(?!\\d{1,5}\\/)[^\\s"'\\\\<>]{1,128})@`,
13347
+ flags: "i",
13294
13348
  confidence: "high",
13295
- precheck: ["://"]
13349
+ precheck: ["://", ":\\"]
13296
13350
  },
13297
13351
  {
13298
13352
  name: "SSH Root Host (rented GPU node)",
13299
- regex: "(?:(?<![A-Za-z0-9@._-])|(?<=\\\\[nrt]))root@(?:\\d{1,3}\\.){3}\\d{1,3}",
13353
+ regex: "root(?:(?<![A-Za-z0-9@._-]root)|(?<=\\\\[nrt]root))@(?:\\d{1,3}\\.){3}\\d{1,3}",
13300
13354
  confidence: "high",
13301
13355
  precheck: ["root@"]
13302
13356
  },
13303
13357
  {
13304
13358
  name: "Tinker API Key",
13305
- regex: "(?:(?<![A-Za-z0-9])|(?<=\\\\[nrt]))tml-([A-Za-z0-9_-]{32,128})",
13359
+ regex: "tml-(?:(?<![A-Za-z0-9]tml-)|(?<=\\\\[nrt]tml-))([A-Za-z0-9_-]{32,128})",
13306
13360
  confidence: "high",
13307
13361
  validator: "credential-value",
13308
13362
  precheck: ["tml-"]
@@ -13316,32 +13370,523 @@ var patterns_local_default = {
13316
13370
  },
13317
13371
  {
13318
13372
  name: "Google API Key (mixed-case suffix)",
13319
- regex: "(?:(?<![A-Za-z0-9_-])|(?<=\\\\[nrt]))AIza[0-9A-Za-z_-]{35}",
13373
+ regex: "AIza(?:(?<![A-Za-z0-9_-]AIza)|(?<=\\\\[nrt]AIza))[0-9A-Za-z_-]{35}",
13320
13374
  confidence: "high",
13321
13375
  precheck: ["aiza"]
13322
13376
  },
13377
+ {
13378
+ name: "AWS Secret Access Key (context)",
13379
+ regex: `(?:aws[_.-]?)?secret[_.-]?(?:access[_.-]?)?key(?:\\\\{0,7}["'])?\\]?(?:\\s*[:=,]\\s*|\\s+)(?:\\\\{0,7}["'])?([A-Za-z0-9/+]{40})(?![A-Za-z0-9/+=])`,
13380
+ flags: "i",
13381
+ confidence: "high",
13382
+ validator: "credential-value",
13383
+ precheck: ["secret"]
13384
+ },
13385
+ {
13386
+ name: "AWS Session Token (context)",
13387
+ regex: `(?:aws_?session_?token|aws_?security_?token|sessiontoken|x-amz-security-token)(?:\\\\{0,7}["'])?\\]?(?:\\s*[:=,]\\s*|\\s+)(?:\\\\{0,7}["'])?([A-Za-z0-9%/+=]{100,4096})`,
13388
+ flags: "i",
13389
+ confidence: "high",
13390
+ validator: "aws-session-token",
13391
+ precheck: ["session", "security"]
13392
+ },
13393
+ {
13394
+ name: "AWS STS Session Token",
13395
+ regex: "(?:(?<![A-Za-z0-9+/])|(?<=\\\\[nrt]))(?:IQoJb3JpZ2luX2[A-Za-z0-9+/]|FwoGZXIvYXdz|FQoGZXIvYXdz)[A-Za-z0-9+/]{100,4096}={0,2}",
13396
+ confidence: "high",
13397
+ precheck: ["iqojb3jpz2lux2", "fwogzxivyxdz", "fqogzxivyxdz"]
13398
+ },
13399
+ {
13400
+ name: "AWS Bedrock API Key",
13401
+ regex: "ABSK(?:(?<![A-Za-z0-9+/]ABSK)|(?<=\\\\[nrt]ABSK))[A-Za-z0-9+/]{100,300}={0,2}|bedrock-api-key-YmVkcm9jay5hbWF6b25hd3MuY29t[A-Za-z0-9+/=%]{20,4096}",
13402
+ confidence: "high",
13403
+ precheck: ["absk", "bedrock-api-key-"]
13404
+ },
13405
+ {
13406
+ name: "GitHub Fine-Grained PAT",
13407
+ regex: "github_pat_(?:(?<![A-Za-z0-9+/_-]github_pat_)|(?<=\\\\[nrt]github_pat_))[A-Za-z0-9_]{50,255}",
13408
+ confidence: "high",
13409
+ precheck: ["github_pat_"]
13410
+ },
13411
+ {
13412
+ name: "RunPod API Key",
13413
+ regex: "rpa_(?:(?<![A-Za-z0-9+/_-]rpa_)|(?<=\\\\[nrt]rpa_))[A-Za-z0-9]{30,64}",
13414
+ confidence: "high",
13415
+ validator: "credential-value",
13416
+ precheck: ["rpa_"]
13417
+ },
13418
+ {
13419
+ name: "Weights & Biases v1 Key",
13420
+ regex: "wandb_v1_(?:(?<![A-Za-z0-9+/_-]wandb_v1_)|(?<=\\\\[nrt]wandb_v1_))[A-Za-z0-9_]{60,100}",
13421
+ confidence: "high",
13422
+ precheck: ["wandb_v1_"]
13423
+ },
13424
+ {
13425
+ name: "Weights & Biases Local Key",
13426
+ regex: "local-(?:(?<![A-Za-z0-9+/_-]local-)|(?<=\\\\[nrt]local-))[0-9a-f]{40}",
13427
+ confidence: "high",
13428
+ validator: "credential-value",
13429
+ precheck: ["local-"]
13430
+ },
13431
+ {
13432
+ name: "Resend API Key",
13433
+ regex: "re_(?:(?<![A-Za-z0-9+/_-]re_)|(?<=\\\\[nrt]re_))[A-Za-z0-9]{8}_[A-Za-z0-9]{24,32}(?![A-Za-z0-9_])",
13434
+ confidence: "high",
13435
+ validator: "high-entropy",
13436
+ precheck: ["re_"]
13437
+ },
13438
+ {
13439
+ name: "Overleaf Git Token",
13440
+ regex: "olp_(?:(?<![A-Za-z0-9+/_-]olp_)|(?<=\\\\[nrt]olp_))[A-Za-z0-9]{30,64}",
13441
+ confidence: "high",
13442
+ validator: "credential-value",
13443
+ precheck: ["olp_"]
13444
+ },
13445
+ {
13446
+ name: "GiveMeANode Token",
13447
+ regex: "gmn(?:(?<![A-Za-z0-9+/_-]gmn)|(?<=\\\\[nrt]gmn))t?_[A-Za-z0-9_-]{16,256}",
13448
+ confidence: "high",
13449
+ validator: "high-entropy",
13450
+ precheck: ["gmn"]
13451
+ },
13452
+ {
13453
+ name: "GiveMeANode Capability URL",
13454
+ regex: "(?:sbe|shr)-[a-z0-9]{5}-([a-z0-9]{16})(?![a-z0-9])",
13455
+ confidence: "high",
13456
+ precheck: ["sbe-", "shr-"]
13457
+ },
13458
+ {
13459
+ name: "Beta9 Signing Key",
13460
+ regex: "sk_(?:(?<![A-Za-z0-9+/_-]sk_)|(?<=\\\\[nrt]sk_))[A-Za-z0-9+/]{42}[AEIMQUYcgkosw048]=(?![A-Za-z0-9+/=])",
13461
+ confidence: "high",
13462
+ precheck: ["sk_"]
13463
+ },
13464
+ {
13465
+ name: "Beta9 Token (88-char base64url)",
13466
+ regex: "(?:(?<![A-Za-z0-9+/_-])|(?<=\\\\[nrt]))[A-Za-z0-9_-]{85}[AQgw]==(?![A-Za-z0-9+/=_-])",
13467
+ confidence: "high",
13468
+ validator: "high-entropy",
13469
+ precheck: ["a==", "q==", "g==", "w=="]
13470
+ },
13471
+ {
13472
+ name: "Generic sk- API Key",
13473
+ regex: "sk-(?:(?<![A-Za-z0-9+/_-]sk-)|(?<=\\\\[nrt]sk-))[A-Za-z0-9_-]{20,256}(?![A-Za-z0-9_-])",
13474
+ confidence: "high",
13475
+ validator: "high-entropy",
13476
+ precheck: ["sk-"]
13477
+ },
13478
+ {
13479
+ name: "Azure Key (JQQJ99 family)",
13480
+ regex: "(?:(?<![A-Za-z0-9+/_-])|(?<=\\\\[nrt]))[A-Za-z0-9]{52}JQQJ99[A-Za-z0-9][A-L][A-Za-z0-9]{24}(?:[A-Za-z0-9]{2}==)?",
13481
+ confidence: "high",
13482
+ precheck: ["jqqj99"]
13483
+ },
13484
+ {
13485
+ name: "Azure AI Search Key",
13486
+ regex: "(?:(?<![A-Za-z0-9+/_-])|(?<=\\\\[nrt]))[A-Za-z0-9]{42}AzSe[A-D][A-Za-z0-9]{5}(?![A-Za-z0-9])",
13487
+ confidence: "high",
13488
+ precheck: ["azse"]
13489
+ },
13490
+ {
13491
+ name: "Azure API Management Key",
13492
+ regex: "(?:(?<![A-Za-z0-9+/_-])|(?<=\\\\[nrt]))[A-Za-z0-9+/]{76}APIM[A-Za-z0-9+/]{5}[AQgw]==",
13493
+ confidence: "high",
13494
+ precheck: ["apim"]
13495
+ },
13496
+ {
13497
+ name: "Cloudflare Scannable Token",
13498
+ regex: "cf(?:(?<![A-Za-z0-9+/_-]cf)|(?<=\\\\[nrt]cf))(?:ut|at|k)_[A-Za-z0-9]{40}[a-f0-9]{8}(?![A-Za-z0-9])",
13499
+ confidence: "high",
13500
+ precheck: ["cfut_", "cfat_", "cfk_"]
13501
+ },
13502
+ {
13503
+ name: "Cloudflare Origin CA Key",
13504
+ regex: "v1(?:(?<![A-Za-z0-9+/_-]v1)|(?<=\\\\[nrt]v1))\\.0-[a-f0-9]{24}-[a-f0-9]{146}",
13505
+ confidence: "high",
13506
+ precheck: ["v1.0-"]
13507
+ },
13508
+ {
13509
+ name: "ElevenLabs API Key",
13510
+ regex: "sk_(?:(?<![A-Za-z0-9+/_-]sk_)|(?<=\\\\[nrt]sk_))[a-f0-9]{48}",
13511
+ confidence: "high",
13512
+ precheck: ["sk_"]
13513
+ },
13514
+ {
13515
+ name: "Groq API Key",
13516
+ regex: "gsk_(?:(?<![A-Za-z0-9+/_-]gsk_)|(?<=\\\\[nrt]gsk_))[A-Za-z0-9]{48,64}",
13517
+ confidence: "high",
13518
+ precheck: ["gsk_"]
13519
+ },
13520
+ {
13521
+ name: "Replicate API Token",
13522
+ regex: "r8_(?:(?<![A-Za-z0-9+/_-]r8_)|(?<=\\\\[nrt]r8_))[A-Za-z0-9_-]{37,40}",
13523
+ confidence: "high",
13524
+ validator: "credential-value",
13525
+ precheck: ["r8_"]
13526
+ },
13527
+ {
13528
+ name: "Together AI API Key",
13529
+ regex: "tgp_v1_(?:(?<![A-Za-z0-9+/_-]tgp_v1_)|(?<=\\\\[nrt]tgp_v1_))[A-Za-z0-9_-]{30,80}",
13530
+ confidence: "high",
13531
+ precheck: ["tgp_v1_"]
13532
+ },
13533
+ {
13534
+ name: "Fireworks API Key",
13535
+ regex: "fw_(?:(?<![A-Za-z0-9+/_-]fw_)|(?<=\\\\[nrt]fw_))[A-Za-z0-9]{20,48}",
13536
+ confidence: "high",
13537
+ validator: "high-entropy",
13538
+ precheck: ["fw_"]
13539
+ },
13540
+ {
13541
+ name: "xAI API Key",
13542
+ regex: "xai-(?:(?<![A-Za-z0-9+/_-]xai-)|(?<=\\\\[nrt]xai-))[A-Za-z0-9_]{60,100}",
13543
+ confidence: "high",
13544
+ precheck: ["xai-"]
13545
+ },
13546
+ {
13547
+ name: "Perplexity API Key",
13548
+ regex: "pplx-(?:(?<![A-Za-z0-9+/_-]pplx-)|(?<=\\\\[nrt]pplx-))[A-Za-z0-9]{40,64}",
13549
+ confidence: "high",
13550
+ precheck: ["pplx-"]
13551
+ },
13552
+ {
13553
+ name: "Pinecone API Key",
13554
+ regex: "pcsk_(?:(?<![A-Za-z0-9+/_-]pcsk_)|(?<=\\\\[nrt]pcsk_))[A-Za-z0-9]{4,8}_[A-Za-z0-9]{40,80}",
13555
+ confidence: "high",
13556
+ precheck: ["pcsk_"]
13557
+ },
13558
+ {
13559
+ name: "LangSmith API Key",
13560
+ regex: "lsv2_(?:(?<![A-Za-z0-9+/_-]lsv2_)|(?<=\\\\[nrt]lsv2_))(?:pt|sk)_[a-f0-9]{32}_[a-f0-9]{10}",
13561
+ confidence: "high",
13562
+ precheck: ["lsv2_"]
13563
+ },
13564
+ {
13565
+ name: "Langfuse Secret Key",
13566
+ regex: "sk-lf-(?:(?<![A-Za-z0-9+/_-]sk-lf-)|(?<=\\\\[nrt]sk-lf-))[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}",
13567
+ confidence: "high",
13568
+ precheck: ["sk-lf-"]
13569
+ },
13570
+ {
13571
+ name: "Cerebras API Key",
13572
+ regex: "csk-(?:(?<![A-Za-z0-9+/_-]csk-)|(?<=\\\\[nrt]csk-))[a-z0-9]{40,64}",
13573
+ confidence: "high",
13574
+ validator: "credential-value",
13575
+ precheck: ["csk-"]
13576
+ },
13577
+ {
13578
+ name: "NVIDIA API Key",
13579
+ regex: "nvapi-(?:(?<![A-Za-z0-9+/_-]nvapi-)|(?<=\\\\[nrt]nvapi-))[A-Za-z0-9_-]{60,70}",
13580
+ confidence: "high",
13581
+ precheck: ["nvapi-"]
13582
+ },
13583
+ {
13584
+ name: "Jina API Key",
13585
+ regex: "jina_(?:(?<![A-Za-z0-9+/_-]jina_)|(?<=\\\\[nrt]jina_))[A-Za-z0-9_-]{60,100}",
13586
+ confidence: "high",
13587
+ validator: "credential-value",
13588
+ precheck: ["jina_"]
13589
+ },
13590
+ {
13591
+ name: "Tavily API Key",
13592
+ regex: "tvly-(?:(?<![A-Za-z0-9+/_-]tvly-)|(?<=\\\\[nrt]tvly-))(?:dev-|prod-)?[A-Za-z0-9]{32}",
13593
+ confidence: "high",
13594
+ precheck: ["tvly-"]
13595
+ },
13596
+ {
13597
+ name: "E2B API Key",
13598
+ regex: "e2b_(?:(?<![A-Za-z0-9+/_-]e2b_)|(?<=\\\\[nrt]e2b_))[a-f0-9]{40}",
13599
+ confidence: "high",
13600
+ precheck: ["e2b_"]
13601
+ },
13602
+ {
13603
+ name: "Daytona API Key",
13604
+ regex: "dtn_(?:(?<![A-Za-z0-9+/_-]dtn_)|(?<=\\\\[nrt]dtn_))[a-f0-9]{64}",
13605
+ confidence: "high",
13606
+ precheck: ["dtn_"]
13607
+ },
13608
+ {
13609
+ name: "Browserbase API Key",
13610
+ regex: "bb_live_(?:(?<![A-Za-z0-9+/_-]bb_live_)|(?<=\\\\[nrt]bb_live_))[A-Za-z0-9_-]{20,64}",
13611
+ confidence: "high",
13612
+ precheck: ["bb_live_"]
13613
+ },
13614
+ {
13615
+ name: "GitLab Token Family",
13616
+ regex: "gl(?:(?<![A-Za-z0-9+/_-]gl)|(?<=\\\\[nrt]gl))(?:pat|dt|rt|ptt|cbt|ffct|ft|imt|agent|oas|soat)-[A-Za-z0-9_.=-]{20,300}",
13617
+ confidence: "high",
13618
+ validator: "credential-value",
13619
+ precheck: [
13620
+ "glpat-",
13621
+ "gldt-",
13622
+ "glrt-",
13623
+ "glptt-",
13624
+ "glcbt-",
13625
+ "glffct-",
13626
+ "glft-",
13627
+ "glimt-",
13628
+ "glagent-",
13629
+ "gloas-",
13630
+ "glsoat-"
13631
+ ]
13632
+ },
13633
+ {
13634
+ name: "GitLab Runner Registration Token",
13635
+ regex: "GR1348941(?:(?<![A-Za-z0-9+/_-]GR1348941)|(?<=\\\\[nrt]GR1348941))[A-Za-z0-9_-]{20,}",
13636
+ confidence: "high",
13637
+ precheck: ["gr1348941"]
13638
+ },
13639
+ {
13640
+ name: "npm Access Token",
13641
+ regex: "npm_(?:(?<![A-Za-z0-9+/_-]npm_)|(?<=\\\\[nrt]npm_))[A-Za-z0-9]{36}",
13642
+ confidence: "high",
13643
+ validator: "credential-value",
13644
+ precheck: ["npm_"]
13645
+ },
13646
+ {
13647
+ name: "Docker Hub Token",
13648
+ regex: "dckr_(?:(?<![A-Za-z0-9+/_-]dckr_)|(?<=\\\\[nrt]dckr_))(?:pat|oat)_[A-Za-z0-9_-]{20,64}",
13649
+ confidence: "high",
13650
+ precheck: ["dckr_"]
13651
+ },
13652
+ {
13653
+ name: "Netlify Token",
13654
+ regex: "nfp_(?:(?<![A-Za-z0-9+/_-]nfp_)|(?<=\\\\[nrt]nfp_))[A-Za-z0-9_]{30,64}",
13655
+ confidence: "high",
13656
+ precheck: ["nfp_"]
13657
+ },
13658
+ {
13659
+ name: "Supabase Token",
13660
+ regex: "(?:(?<![A-Za-z0-9+/_-])|(?<=\\\\[nrt]))(?:sbp_[a-f0-9]{40}|sb_secret_[A-Za-z0-9_-]{20,80})",
13661
+ confidence: "high",
13662
+ precheck: ["sbp_", "sb_secret_"]
13663
+ },
13664
+ {
13665
+ name: "Tailscale Key",
13666
+ regex: "tskey-(?:(?<![A-Za-z0-9+/_-]tskey-)|(?<=\\\\[nrt]tskey-))[a-z]+-[A-Za-z0-9]{6,}-[A-Za-z0-9]{16,}",
13667
+ confidence: "high",
13668
+ precheck: ["tskey-"]
13669
+ },
13670
+ {
13671
+ name: "PlanetScale Token",
13672
+ regex: "pscale_(?:(?<![A-Za-z0-9+/_-]pscale_)|(?<=\\\\[nrt]pscale_))(?:tkn|pw|oauth)_[A-Za-z0-9_.-]{32,}",
13673
+ confidence: "high",
13674
+ precheck: ["pscale_"]
13675
+ },
13676
+ {
13677
+ name: "Neon API Key",
13678
+ regex: "napi_(?:(?<![A-Za-z0-9+/_-]napi_)|(?<=\\\\[nrt]napi_))[a-z0-9]{64}",
13679
+ confidence: "high",
13680
+ precheck: ["napi_"]
13681
+ },
13682
+ {
13683
+ name: "Pulumi Access Token",
13684
+ regex: "pul-(?:(?<![A-Za-z0-9+/_-]pul-)|(?<=\\\\[nrt]pul-))[a-f0-9]{40}",
13685
+ confidence: "high",
13686
+ precheck: ["pul-"]
13687
+ },
13688
+ {
13689
+ name: "Terraform Cloud Token",
13690
+ regex: "(?:(?<![A-Za-z0-9+/_-])|(?<=\\\\[nrt]))[A-Za-z0-9]{14}\\.atlasv1\\.[A-Za-z0-9_=-]{60,}",
13691
+ confidence: "high",
13692
+ precheck: [".atlasv1."]
13693
+ },
13694
+ {
13695
+ name: "Atlassian API Token",
13696
+ regex: "ATATT3(?:(?<![A-Za-z0-9+/_-]ATATT3)|(?<=\\\\[nrt]ATATT3))[A-Za-z0-9_=-]{150,}",
13697
+ confidence: "high",
13698
+ precheck: ["atatt3"]
13699
+ },
13700
+ {
13701
+ name: "HashiCorp Vault Token",
13702
+ regex: "hv(?:(?<![A-Za-z0-9+/_-]hv)|(?<=\\\\[nrt]hv))[sbr]\\.[A-Za-z0-9_-]{24,300}",
13703
+ confidence: "high",
13704
+ precheck: ["hvs.", "hvb.", "hvr."]
13705
+ },
13706
+ {
13707
+ name: "Grafana Cloud/Service Account Token",
13708
+ regex: "(?:(?<![A-Za-z0-9+/_-])|(?<=\\\\[nrt]))(?:glc_[A-Za-z0-9+/]{32,400}={0,3}|glsa_[A-Za-z0-9]{32}_[A-Fa-f0-9]{8})",
13709
+ confidence: "high",
13710
+ precheck: ["glc_", "glsa_"]
13711
+ },
13712
+ {
13713
+ name: "DigitalOcean Token",
13714
+ regex: "do(?:(?<![A-Za-z0-9+/_-]do)|(?<=\\\\[nrt]do))[opr]_v1_[a-f0-9]{64}",
13715
+ confidence: "high",
13716
+ precheck: ["dop_v1_", "doo_v1_", "dor_v1_"]
13717
+ },
13718
+ {
13719
+ name: "Heroku API Key v2",
13720
+ regex: "HRKU-(?:(?<![A-Za-z0-9+/_-]HRKU-)|(?<=\\\\[nrt]HRKU-))[A-Za-z0-9_-]{30,80}",
13721
+ confidence: "high",
13722
+ precheck: ["hrku-"]
13723
+ },
13724
+ {
13725
+ name: "Doppler Token",
13726
+ regex: "dp(?:(?<![A-Za-z0-9+/_-]dp)|(?<=\\\\[nrt]dp))\\.(?:ct|pt|st(?:\\.[a-z0-9_-]{2,35})?|sa|scim|audit)\\.[A-Za-z0-9]{40,44}",
13727
+ confidence: "high",
13728
+ precheck: [
13729
+ "dp.ct.",
13730
+ "dp.pt.",
13731
+ "dp.st.",
13732
+ "dp.sa.",
13733
+ "dp.scim.",
13734
+ "dp.audit."
13735
+ ]
13736
+ },
13737
+ {
13738
+ name: "1Password Service Account Token",
13739
+ regex: "ops_eyJ(?:(?<![A-Za-z0-9+/_-]ops_eyJ)|(?<=\\\\[nrt]ops_eyJ))[A-Za-z0-9+/_=-]{100,}",
13740
+ confidence: "high",
13741
+ precheck: ["ops_eyj"]
13742
+ },
13743
+ {
13744
+ name: "1Password Secret Key",
13745
+ regex: "A3-(?:(?<![A-Za-z0-9_-]A3-)|(?<=\\\\[nrt]A3-))[A-Z0-9]{6}-(?:[A-Z0-9]{11}|[A-Z0-9]{6}-[A-Z0-9]{5})-[A-Z0-9]{5}-[A-Z0-9]{5}-[A-Z0-9]{5}\\b",
13746
+ confidence: "high",
13747
+ precheck: ["a3-"]
13748
+ },
13749
+ {
13750
+ name: "age Secret Key",
13751
+ regex: "AGE-SECRET-KEY-1[QPZRY9X8GF2TVDW0S3JN54KHCE6MUA7L]{58}",
13752
+ confidence: "high",
13753
+ precheck: ["age-secret-key-1"]
13754
+ },
13755
+ {
13756
+ name: "Sentry Org/User Token",
13757
+ regex: "sntry(?:(?<![A-Za-z0-9+/_-]sntry)|(?<=\\\\[nrt]sntry))[su]_[A-Za-z0-9+/=_-]{40,400}",
13758
+ confidence: "high",
13759
+ precheck: ["sntrys_", "sntryu_"]
13760
+ },
13761
+ {
13762
+ name: "PostHog Personal API Key",
13763
+ regex: "phx_(?:(?<![A-Za-z0-9+/_-]phx_)|(?<=\\\\[nrt]phx_))[A-Za-z0-9_]{40,50}",
13764
+ confidence: "high",
13765
+ precheck: ["phx_"]
13766
+ },
13767
+ {
13768
+ name: "Linear OAuth Token",
13769
+ regex: "lin_oauth_(?:(?<![A-Za-z0-9+/_-]lin_oauth_)|(?<=\\\\[nrt]lin_oauth_))[a-f0-9]{64}",
13770
+ confidence: "high",
13771
+ precheck: ["lin_oauth_"]
13772
+ },
13773
+ {
13774
+ name: "Notion Token (ntn_)",
13775
+ regex: "ntn_(?:(?<![A-Za-z0-9+/_-]ntn_)|(?<=\\\\[nrt]ntn_))[A-Za-z0-9]{40,50}",
13776
+ confidence: "high",
13777
+ precheck: ["ntn_"]
13778
+ },
13779
+ {
13780
+ name: "Figma Token",
13781
+ regex: "fig(?:(?<![A-Za-z0-9+/_-]fig)|(?<=\\\\[nrt]fig))[dpuo]_[A-Za-z0-9_=-]{38,60}",
13782
+ confidence: "high",
13783
+ validator: "high-entropy",
13784
+ precheck: ["figd_", "figp_", "figu_", "figo_"]
13785
+ },
13786
+ {
13787
+ name: "Slack App-Level Token",
13788
+ regex: "xapp-(?:(?<![A-Za-z0-9+/_-]xapp-)|(?<=\\\\[nrt]xapp-))\\d-[A-Za-z0-9-]{20,250}",
13789
+ confidence: "high",
13790
+ precheck: ["xapp-"]
13791
+ },
13792
+ {
13793
+ name: "Stripe/Svix Webhook Secret",
13794
+ regex: "whsec_(?:(?<![A-Za-z0-9+/_-]whsec_)|(?<=\\\\[nrt]whsec_))[A-Za-z0-9+/=]{24,}",
13795
+ confidence: "high",
13796
+ precheck: ["whsec_"]
13797
+ },
13798
+ {
13799
+ name: "Google OAuth Client Secret",
13800
+ regex: "GOCSPX-(?:(?<![A-Za-z0-9+/_-]GOCSPX-)|(?<=\\\\[nrt]GOCSPX-))[A-Za-z0-9_-]{24,40}",
13801
+ confidence: "high",
13802
+ validator: "credential-value",
13803
+ precheck: ["gocspx-"]
13804
+ },
13805
+ {
13806
+ name: "New Relic API Key",
13807
+ regex: "NR(?:(?<![A-Za-z0-9_-]NR)|(?<=\\\\[nrt]NR))(?:AK|AA|II|IQ|JS)-[A-Z0-9]{27}(?![A-Za-z0-9])",
13808
+ confidence: "high",
13809
+ precheck: ["nrak-", "nraa-", "nrii-", "nriq-", "nrjs-"]
13810
+ },
13811
+ {
13812
+ name: "Discord Webhook Token",
13813
+ regex: "discord(?:app)?\\.com/api/webhooks/\\d{17,20}/([A-Za-z0-9_-]{60,80})",
13814
+ confidence: "high",
13815
+ precheck: ["discord"]
13816
+ },
13817
+ {
13818
+ name: "Discord Bot Token (contextual)",
13819
+ regex: "(?:(?<![A-Za-z0-9+/_-])|(?<=\\\\[nrt]))[MNO][A-Za-z0-9_-]{23,27}\\.[A-Za-z0-9_-]{6}\\.[A-Za-z0-9_-]{27,40}",
13820
+ confidence: "high",
13821
+ validator: "high-entropy",
13822
+ context: "discord"
13823
+ },
13824
+ {
13825
+ name: "Azure Storage/Service Bus Key",
13826
+ regex: `(?:account|sharedaccess|access|primary|secondary|storage)[_-]?key(?:\\\\{0,7}["'])?\\s*[=:]\\s*(?:\\\\{0,7}["'])?([A-Za-z0-9+/]{40,88}={0,2})`,
13827
+ flags: "i",
13828
+ confidence: "high",
13829
+ validator: "high-entropy",
13830
+ precheck: [
13831
+ "accountkey",
13832
+ "account_key",
13833
+ "account-key",
13834
+ "accesskey",
13835
+ "access_key",
13836
+ "access-key",
13837
+ "primarykey",
13838
+ "primary_key",
13839
+ "primary-key",
13840
+ "secondarykey",
13841
+ "secondary_key",
13842
+ "secondary-key",
13843
+ "storagekey",
13844
+ "storage_key",
13845
+ "storage-key"
13846
+ ]
13847
+ },
13848
+ {
13849
+ name: "Azure Storage Account Keys List",
13850
+ regex: 'keyName\\\\{0,7}"\\s*:\\s*\\\\{0,7}"key[12]\\\\{0,7}"[\\s\\S]{0,200}?value\\\\{0,7}"\\s*:\\s*\\\\{0,7}"([A-Za-z0-9+/]{86}==)',
13851
+ confidence: "high",
13852
+ precheck: ["keyname"]
13853
+ },
13854
+ {
13855
+ name: "Azure Entra Client Secret",
13856
+ regex: "(?:(?<![A-Za-z0-9_~.-])|(?<=\\\\[nrt]))[A-Za-z0-9_~.]{3}\\dQ~[A-Za-z0-9_~.-]{31,34}(?![A-Za-z0-9_~.-])",
13857
+ confidence: "high",
13858
+ validator: "credential-value",
13859
+ precheck: ["q~"]
13860
+ },
13861
+ {
13862
+ name: "Claude Code atis Token (key context)",
13863
+ regex: "^(?:v\\d+\\.[A-Za-z0-9_.-]{40,}|[0-9a-f]{16})$",
13864
+ confidence: "high",
13865
+ context: "^atis$",
13866
+ contextScope: "key"
13867
+ },
13323
13868
  {
13324
13869
  name: "JSON Web Token",
13325
- regex: "(?:(?<![A-Za-z0-9_-])|(?<=\\\\[nrt]))eyJ[A-Za-z0-9_-]{12,}\\.[A-Za-z0-9_-]{12,}\\.[A-Za-z0-9_-]{16,}",
13870
+ regex: "eyJ(?:(?<![A-Za-z0-9_-]eyJ)|(?<=\\\\[nrt]eyJ))[A-Za-z0-9_-]{12,}\\.[A-Za-z0-9_-]{12,}\\.[A-Za-z0-9_-]{16,}",
13326
13871
  confidence: "high",
13327
13872
  validator: "jwt",
13328
13873
  precheck: ["eyj"]
13329
13874
  },
13330
13875
  {
13331
13876
  name: "GitHub Token (escaped-newline boundary)",
13332
- regex: "(?:(?<![A-Za-z0-9])|(?<=\\\\[nrt]))gh[oprsu]_[A-Za-z0-9]{36,255}",
13877
+ regex: "gh(?:(?<![A-Za-z0-9]gh)|(?<=\\\\[nrt]gh))[oprsu]_[A-Za-z0-9]{36,255}",
13333
13878
  confidence: "high",
13334
13879
  precheck: ["gho_", "ghp_", "ghr_", "ghs_", "ghu_"]
13335
13880
  },
13336
13881
  {
13337
13882
  name: "Sourcegraph Access Token",
13338
- regex: "(?:(?<![A-Za-z0-9])|(?<=\\\\[nrt]))sgp_(?:local_)?(?:[A-Fa-f0-9]{16}_)?[A-Fa-f0-9]{40}",
13883
+ regex: "sgp_(?:(?<![A-Za-z0-9]sgp_)|(?<=\\\\[nrt]sgp_))(?:local_)?(?:[A-Fa-f0-9]{16}_)?[A-Fa-f0-9]{40}",
13339
13884
  confidence: "high",
13340
13885
  precheck: ["sgp_"]
13341
13886
  },
13342
13887
  {
13343
13888
  name: "Sourcegraph Token Assignment",
13344
- regex: `(?:src[_-]?access[_-]?token|sourcegraph[a-z0-9_-]{0,24}token)["']?\\s*[:=]\\s*["']?([A-Fa-f0-9]{40,64})`,
13889
+ regex: "(?:src[_-]?access[_-]?token|sourcegraph[a-z0-9_-]{0,24}token)(?:(?:\\\\{0,7}[\"'])?\\]?\\s*[:=]\\s*(?:\\\\{0,7}[\"'`])?|`\\]?\\s*[:=]\\s*`)([A-Fa-f0-9]{40,64})",
13345
13890
  flags: "i",
13346
13891
  confidence: "high"
13347
13892
  },
@@ -13354,7 +13899,7 @@ var patterns_local_default = {
13354
13899
  },
13355
13900
  {
13356
13901
  name: "Algolia API Key Assignment",
13357
- regex: `algolia[a-z0-9_-]{0,24}(?:key|token)["']?\\s*[:=]\\s*["']?([A-Za-z0-9]{20,64})`,
13902
+ regex: "algolia[a-z0-9_-]{0,24}(?:key|token)(?:(?:\\\\{0,7}[\"'])?\\]?\\s*[:=]\\s*(?:\\\\{0,7}[\"'`])?|`\\]?\\s*[:=]\\s*`)([A-Za-z0-9]{20,64})",
13358
13903
  flags: "i",
13359
13904
  confidence: "high",
13360
13905
  validator: "credential-value"
@@ -13368,14 +13913,14 @@ var patterns_local_default = {
13368
13913
  },
13369
13914
  {
13370
13915
  name: "Slack Token (extended prefixes)",
13371
- regex: "(?:(?<![A-Za-z0-9])|(?<=\\\\[nrt]))xox[a-z]-[A-Za-z0-9-]{10,250}",
13916
+ regex: "xox(?:(?<![A-Za-z0-9]xox)|(?<=\\\\[nrt]xox))[a-z]-[A-Za-z0-9-]{10,250}",
13372
13917
  confidence: "high",
13373
13918
  validator: "credential-value",
13374
13919
  precheck: ["xox"]
13375
13920
  },
13376
13921
  {
13377
13922
  name: "Hugging Face Token (contextual)",
13378
- regex: "(?:(?<![A-Za-z0-9])|(?<=\\\\[nrt]))hf_[A-Za-z0-9]{20,33}",
13923
+ regex: "hf_(?:(?<![A-Za-z0-9]hf_)|(?<=\\\\[nrt]hf_))[A-Za-z0-9]{20,33}",
13379
13924
  context: "hugg|hf[_-]?(?:api[_-]?)?token|hf auth",
13380
13925
  confidence: "high",
13381
13926
  validator: "credential-value",
@@ -13383,7 +13928,7 @@ var patterns_local_default = {
13383
13928
  },
13384
13929
  {
13385
13930
  name: "Modal Token Pair",
13386
- regex: "(?:(?<![A-Za-z0-9])|(?<=\\\\[nrt]))ak-[A-Za-z0-9]{10,64}[\\s:,;]{1,4}as-[A-Za-z0-9]{10,64}",
13931
+ regex: "ak-(?:(?<![A-Za-z0-9]ak-)|(?<=\\\\[nrt]ak-))[A-Za-z0-9]{10,64}[\\s:,;]{1,4}as-[A-Za-z0-9]{10,64}",
13387
13932
  confidence: "high",
13388
13933
  precheck: ["ak-"]
13389
13934
  },
@@ -13397,7 +13942,7 @@ var patterns_local_default = {
13397
13942
  },
13398
13943
  {
13399
13944
  name: "Bearer Authorization Value",
13400
- regex: "(?:(?<![A-Za-z0-9])|(?<=\\\\[nrt]))bearer\\s+([A-Za-z0-9_~+/.=-]{16,512})",
13945
+ regex: "bearer(?:(?<![A-Za-z0-9]bearer)|(?<=\\\\[nrt]bearer))\\s+([A-Za-z0-9_~+/.=-]{16,4096})",
13401
13946
  flags: "i",
13402
13947
  confidence: "high",
13403
13948
  validator: "high-entropy",
@@ -13405,7 +13950,7 @@ var patterns_local_default = {
13405
13950
  },
13406
13951
  {
13407
13952
  name: "Basic Authorization Value",
13408
- regex: "(?:(?<![A-Za-z0-9])|(?<=\\\\[nrt]))basic\\s+([A-Za-z0-9+/=]{12,512})",
13953
+ regex: "basic(?:(?<![A-Za-z0-9]basic)|(?<=\\\\[nrt]basic))\\s+([A-Za-z0-9+/=]{12,512})",
13409
13954
  flags: "i",
13410
13955
  confidence: "high",
13411
13956
  validator: "basic-auth",
@@ -13413,35 +13958,116 @@ var patterns_local_default = {
13413
13958
  },
13414
13959
  {
13415
13960
  name: "Authorization Header Token Scheme",
13416
- regex: `authorization["']?\\s*[:=]\\s*["']?(?:token|apikey|api-key)\\s+([A-Za-z0-9_~+/.=-]{8,512})`,
13961
+ regex: "authorization(?:(?:\\\\{0,7}[\"'])?\\]?\\s*[:=]\\s*(?:\\\\{0,7}[\"'`])?|`\\]?\\s*[:=]\\s*`)(?:token|apikey|api-key)\\s+([A-Za-z0-9_~+/.=-]{8,512})",
13417
13962
  flags: "i",
13418
13963
  confidence: "high",
13419
13964
  validator: "credential-value"
13420
13965
  },
13966
+ {
13967
+ name: "Jupyter Server Token",
13968
+ regex: "[0-9a-f]{48}(?:(?<=^[0-9a-f]{48})|(?<=[^0-9A-Za-z_-][0-9a-f]{48})|(?<=\\\\[nrt][0-9a-f]{48}))(?![0-9A-Za-z])",
13969
+ confidence: "high",
13970
+ validator: "high-entropy",
13971
+ context: "jupyter|tkn|:8888"
13972
+ },
13973
+ {
13974
+ name: "Weights & Biases Key Near Mention",
13975
+ regex: `(?:wandb(?:[_-][a-z]{1,16}){0,3}|w&b|weights\\s*(?:&|and)\\s*biases)(?![A-Za-z0-9])(?:[^\\n\\\\]|\\\\{1,7}["']){0,80}?(?<![0-9A-Za-z])([0-9a-f]{40})(?![0-9A-Za-z])`,
13976
+ flags: "i",
13977
+ confidence: "high",
13978
+ validator: "wandb-hex",
13979
+ precheck: ["wandb", "w&b", "weights"]
13980
+ },
13981
+ {
13982
+ name: "Provider CLI Login Key",
13983
+ regex: `(?:wandb[ \\t]+login(?:[ \\t]+--?[a-z-]+(?:=[^\\s\\\\]+)?)*|vastai[ \\t]+set[ \\t]+api-key|aws[ \\t]+configure[ \\t]+set[ \\t]+[^\\s\\\\]*(?:secret|token)[^\\s\\\\]*|ngrok[ \\t]+(?:config[ \\t]+add-)?authtoken)[ \\t]+\\\\?["']?([^\\s"'\\\\]{8,4096})`,
13984
+ flags: "i",
13985
+ confidence: "high",
13986
+ validator: "credential-value",
13987
+ precheck: ["wandb", "vastai", "configure", "authtoken"]
13988
+ },
13989
+ {
13990
+ name: "Netrc Password",
13991
+ regex: `machine(?:(?<![A-Za-z0-9_]machine)|(?<=\\\\[nrt]machine))(?:\\s|\\\\[nrt])+[^\\s\\\\]{1,253}(?:\\s|\\\\[nrt])+(?:login(?:\\s|\\\\[nrt])+[^\\s\\\\]{1,253}(?:\\s|\\\\[nrt])+)?password(?:\\s|\\\\[nrt])+([^\\s"'\\\\]{6,256})`,
13992
+ confidence: "high",
13993
+ validator: "netrc-password",
13994
+ precheck: ["machine"]
13995
+ },
13996
+ {
13997
+ name: "Key Keyword Argument",
13998
+ regex: `(?:^|[^A-Za-z0-9_.]|\\\\[nrt])key\\s*=\\s*\\\\{0,7}["']([A-Za-z0-9_-]{32,128})\\\\{0,7}["']`,
13999
+ confidence: "high",
14000
+ validator: "opaque-token",
14001
+ precheck: ["key"]
14002
+ },
14003
+ {
14004
+ name: "VS Code Connection Token",
14005
+ regex: `(?:connection[-_]token|vscode-tkn|[?&]tkn)(?:=|[ \\t]+)(?!-)\\\\?["']?([0-9A-Za-z_-]{16,128})`,
14006
+ flags: "i",
14007
+ confidence: "high",
14008
+ validator: "credential-value",
14009
+ precheck: ["connection", "tkn"]
14010
+ },
14011
+ {
14012
+ name: "Jupyter Kernel HMAC Key",
14013
+ regex: "(?<![0-9a-f-])[0-9a-f]{8}-[0-9a-f]{24}(?![0-9a-f-])",
14014
+ confidence: "high",
14015
+ validator: "high-entropy",
14016
+ context: "hmac|signature_scheme|^key$"
14017
+ },
14018
+ {
14019
+ name: "CLI Credential Flag",
14020
+ regex: `(?:^|[^A-Za-z0-9_-]|\\\\[nrt])--?(?:[a-z0-9]{1,24}[-_]){0,4}(?:api[-_]?key|token|secret|passw(?:or)?d|access[-_]?key|secret[-_]?key|auth[-_]?token|access[-_]?token|client[-_]?secret|connection[-_]?token|account[-_]?key|storage[-_]?key)(?:=|[ \\t]+)(?!-)\\\\{0,7}["']?([^\\s"'\\\\;|&]{8,512})`,
14021
+ flags: "i",
14022
+ confidence: "high",
14023
+ validator: "cli-credential",
14024
+ precheck: ["key", "token", "secret", "passw"]
14025
+ },
14026
+ {
14027
+ name: "Netrc Password (numbered view)",
14028
+ regex: `(?:^|\\n|\\\\n)[ \\t+]*(?:\\d{1,7}(?:\u2192|\\t|\\\\t))?[ \\t]*password(?:[ \\t]|\\\\t)+([^\\s"'\\\\]{6,256})`,
14029
+ confidence: "high",
14030
+ validator: "netrc-password",
14031
+ context: "(?:^|[^a-z]|\\\\[nrt])machine(?:\\s|\\\\[nrt])",
14032
+ precheck: ["password"]
14033
+ },
14034
+ {
14035
+ name: "PGP Private Key Block",
14036
+ regex: "-----BEGIN PGP PRIVATE KEY BLOCK-----(?:(?:\\s|\\\\[nrt]){1,16}[A-Za-z0-9-]+: [^\\n\\\\]*)*(?:(?:\\s|\\\\[nrt]){1,16}[A-Za-z0-9+/=]{16,})+(?:(?:\\s|\\\\[nrt]){1,16}=[A-Za-z0-9+/]{4})?(?:(?:\\s|\\\\[nrt]){1,16}-----END PGP PRIVATE KEY BLOCK-----)?",
14037
+ confidence: "high",
14038
+ precheck: ["pgp private key block"]
14039
+ },
14040
+ {
14041
+ name: "curl User Password",
14042
+ regex: `curl\\b[^\\n|;&]{0,300}?\\s(?:-u|--user|--proxy-user)(?:[ \\t]+|=)\\\\?["']?[^\\s:'"\\\\]{0,64}:([^\\s'"\\\\]{6,256})`,
14043
+ confidence: "high",
14044
+ validator: "password-value",
14045
+ precheck: ["curl"]
14046
+ },
13421
14047
  {
13422
14048
  name: "Credential Header Value",
13423
- regex: `(?:x-api-key|api[-_]?key|x-auth-token|auth[-_]?token|x-access-token|private-token|x-goog-api-key|x-gitlab-token|x-amz-security-token|x-figma-token|x-vault-token|proxy-authorization|authorization)["']?\\s*[:=]\\s*["']?([A-Za-z0-9_~+/.=-]{8,512})`,
14049
+ regex: "(?:x-api-key|api[-_]?key|x-auth-token|auth[-_]?token|x-access-token|private-token|x-goog-api-key|x-gitlab-token|x-amz-security-token|x-figma-token|x-vault-token|ocp-apim-subscription-key|x-auth-key|x-auth-user-service-key|proxy-authorization|authorization)(?:(?:\\\\{0,7}[\"'])?\\]?\\s*[:=]\\s*(?:\\\\{0,7}[\"'`])?|`\\]?\\s*[:=]\\s*`)([A-Za-z0-9_~%+/.=-]{8,4096})",
13424
14050
  flags: "i",
13425
14051
  confidence: "high",
13426
14052
  validator: "credential-value"
13427
14053
  },
13428
14054
  {
13429
14055
  name: "Credential Query Parameter",
13430
- regex: `[?&](?:access_token|refresh_token|id_token|api_key|apikey|auth_token|session_token|client_secret|private_token|signature|sig|x-amz-signature|x-amz-credential|x-amz-security-token|x-goog-signature|x-goog-credential)=([^&\\s"'\\\\]{8,512})`,
14056
+ regex: `[?&](?:access_token|refresh_token|id_token|api_key|apikey|auth_token|session_token|client_secret|private_token|signature|sig|x-amz-signature|x-amz-credential|x-amz-security-token|x-goog-signature|x-goog-credential)=([^&\\s"'\\\\]{8,4096})`,
13431
14057
  flags: "i",
13432
14058
  confidence: "high",
13433
14059
  validator: "credential-value"
13434
14060
  },
13435
14061
  {
13436
14062
  name: "High-Entropy Query Parameter",
13437
- regex: `[?&](?:token|key|auth|session|sid|secret|password|passwd)=([^&\\s"'\\\\]{16,512})`,
14063
+ regex: `[?&](?:token|key|auth|session|sid|secret|password|passwd)=([^&\\s"'\\\\]{16,4096})`,
13438
14064
  flags: "i",
13439
14065
  confidence: "high",
13440
14066
  validator: "session-value"
13441
14067
  },
13442
14068
  {
13443
14069
  name: "Auth Cookie or Token Assignment",
13444
- regex: `(?:session|sess_?(?:id|key|token)|auth(?!or)|token|jwt|csrf|xsrf|secret)[a-z0-9_-]{0,32}["']?\\s*[:=]\\s*["']?([A-Za-z0-9_%+/=.~-]{16,512})`,
14070
+ regex: "(?:session|sess_?(?:id|key|token)|auth(?!or)|token|jwt|csrf|xsrf|secret)[a-z0-9_-]{0,32}(?:(?:\\\\{0,7}[\"'])?\\]?\\s*[:=]\\s*(?:\\\\{0,7}[\"'`])?|`\\]?\\s*[:=]\\s*`)([A-Za-z0-9_%+/=.~-]{16,4096})",
13445
14071
  flags: "i",
13446
14072
  confidence: "high",
13447
14073
  validator: "session-value",
@@ -13449,11 +14075,11 @@ var patterns_local_default = {
13449
14075
  },
13450
14076
  {
13451
14077
  name: "Password Assignment",
13452
- regex: `(?:password|passwd|passphrase)[a-z0-9_-]{0,32}["']?\\s*[:=]\\s*["']?([^\\s"'\\\\]{8,256})`,
14078
+ regex: "(?:password|passwd|passphrase|sshpass(?![a-z0-9_-]))[a-z0-9_-]{0,32}(?:(?:\\\\{0,7}[\"'])?\\]?\\s*[:=]\\s*(?:\\\\{0,7}[\"'`])?|`\\]?\\s*[:=]\\s*`)([^\\s\"'\\\\]{8,256})",
13453
14079
  flags: "i",
13454
14080
  confidence: "high",
13455
- validator: "credential-value",
13456
- precheck: ["passw", "passphrase"]
14081
+ validator: "password-value",
14082
+ precheck: ["passw", "passphrase", "sshpass"]
13457
14083
  },
13458
14084
  {
13459
14085
  name: "Password Value (key context)",
@@ -13461,12 +14087,12 @@ var patterns_local_default = {
13461
14087
  context: "^[a-z0-9_-]{0,32}(?:password|passwd|passphrase)[a-z0-9_-]{0,32}$",
13462
14088
  contextScope: "key",
13463
14089
  confidence: "high",
13464
- validator: "credential-value"
14090
+ validator: "password-value"
13465
14091
  },
13466
14092
  {
13467
14093
  name: "Credential Value (key context)",
13468
14094
  regex: "^[A-Za-z0-9_~%+/.=-]{8,1024}$",
13469
- context: "^[a-z0-9_-]{0,32}(?:api[_-]?key|apikey|auth[_-]?token|access[_-]?token|refresh[_-]?token|client[_-]?secret|secret[_-]?key|private[_-]?token|bearer[_-]?token|session[_-]?token|credential)s?[a-z0-9_-]{0,32}$|^(?:proxy[_-])?authorization$",
14095
+ context: "^[a-z0-9_-]{0,32}(?:api[_-]?key|apikey|auth[_-]?token|access[_-]?token|refresh[_-]?token|client[_-]?secret|secret[_-]?key|secret[_-]?access[_-]?key|access[_-]?key[_-]?secret|private[_-]?token|bearer[_-]?token|session[_-]?token|security[_-]?token|account[_-]?key|shared[_-]?access[_-]?key|signing[_-]?(?:key|secret)|encryption[_-]?key|(?:webhook|consumer|app|shared|hmac|oauth)[_-]?secret|credential)s?[a-z0-9_-]{0,32}$|^(?:proxy[_-])?authorization$",
13470
14096
  contextScope: "key",
13471
14097
  confidence: "high",
13472
14098
  validator: "credential-value"
@@ -13484,9 +14110,13 @@ var PREFIX_RUNS = {
13484
14110
  "[\\w\\-]*sq0c[a-z]{2}-[0-9A-Za-z\\-_]{40,50}": "[\\w-]+",
13485
14111
  "[0-9]+:AA[0-9A-Za-z\\-_]{33}": "[0-9]+"
13486
14112
  };
14113
+ var DROPPED_UPSTREAM = /* @__PURE__ */ new Set(["Password in URL", "Privatekey"]);
14114
+ var BOUNDED_UPSTREAM = {
14115
+ "key-[0-9a-zA-Z]{32}": "key-(?:(?<![A-Za-z0-9-]key-)|(?<=\\\\[nrt]key-))[0-9a-zA-Z]{32}"
14116
+ };
13487
14117
  var PLACEHOLDER_VALUE = /your[-_ ]|xxxxx|example|sample|dummy|placeholder|change[-_]?me|redacted|insert[-_ ]|fixme|1234567890|abcdefgh/i;
13488
14118
  var LEADING_TEMPLATE = /^[$%{<*#]/;
13489
- var FILLER_RUN = /^(?:x+|\*+|-+|\.+)$/i;
14119
+ var FILLER_RUN = /^(?:x+|\*+|-+|\.+|=+)$/i;
13490
14120
  var DOTTED_IDENTIFIER = /^[A-Za-z_$][A-Za-z0-9_$]{0,24}(?:\.[A-Za-z_$][A-Za-z0-9_$]{0,24}){1,6}$/;
13491
14121
  var TYPE_OR_LITERAL = /^(?:Optional|List|Dict|Union|Tuple|Set|Sequence|Mapping|Callable|Iterable|Any|str|string|int|integer|float|bool|boolean|bytes|None|True|False|null|true|false|undefined|nil|object|number)\b/;
13492
14122
  var URL_VALUE = /^[a-z][a-z0-9+.-]*:\/\//i;
@@ -13516,10 +14146,88 @@ function isCredentialShaped(secret) {
13516
14146
  var UUID_VALUE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
13517
14147
  var LONG_HEX_VALUE = /^[0-9a-f]{32,}$/i;
13518
14148
  var IDENTIFIER_NAME = /^[^:=]*(?:file|path|dir|sha\d*|hash|digest|checksum|hex|uuid|guid|rate|estimate|speed|bytes|count)[^:=]*[:=]/i;
13519
- function isSessionSecret(secret, fullMatch) {
13520
- return isCredentialShaped(secret) && shannonEntropy(secret) >= 3.2 && !UUID_VALUE.test(secret) && !LONG_HEX_VALUE.test(secret) && !secret.includes("/") && // "=..." values come from ==version pins (tokenspeed-triton==0.1.2+cu121).
14149
+ function nameWords(secret, fullMatch, before) {
14150
+ const lead = before.match(/[A-Za-z0-9_-]*$/)?.[0] ?? "";
14151
+ const name = lead + fullMatch.slice(0, fullMatch.lastIndexOf(secret));
14152
+ return name.split(/[^A-Za-z0-9]+|(?<=[a-z0-9])(?=[A-Z])/).filter(Boolean);
14153
+ }
14154
+ var CREDENTIAL_WORD = /^(?:secret|key|apikey|password|passwd|passphrase|credentials?|token|auth|jwt|bearer)$/i;
14155
+ var ID_WORD = /^(?:sess|session|sid|request|trace|span|nonce|cursor|page|next|continuation|idempotency|correlation|id|ids)$/i;
14156
+ var PAGINATION_WORD = /^(?:request|next|continuation|page|cursor|pagination|starting|idempotency|cancellation|change|trace|span|correlation)$/i;
14157
+ function isIdShapeAllowed(words, secret) {
14158
+ if (!UUID_VALUE.test(secret) && !LONG_HEX_VALUE.test(secret)) return true;
14159
+ const last = words.at(-1) ?? "";
14160
+ if (!CREDENTIAL_WORD.test(last)) return false;
14161
+ return !/^token$/i.test(last) || !words.slice(0, -1).some((word) => ID_WORD.test(word));
14162
+ }
14163
+ function charKind(ch) {
14164
+ if (/[a-z]/.test(ch)) return "l";
14165
+ if (/[A-Z]/.test(ch)) return "u";
14166
+ if (/[0-9]/.test(ch)) return "d";
14167
+ return "o";
14168
+ }
14169
+ function isIdentifierLike(s) {
14170
+ if (!/^[A-Za-z_$][\w$]*$/.test(s)) return false;
14171
+ if ((s.match(/[0-9]/g) ?? []).length > 2) return false;
14172
+ const words = s.match(/[A-Z]?[a-z]{3,}|[A-Z]{3,}(?![a-z])/g) ?? [];
14173
+ const covered = words.reduce((n, w) => n + w.length, 0);
14174
+ let transitions = 0;
14175
+ for (let i = 1; i < s.length; i++) {
14176
+ const a = charKind(s[i - 1]);
14177
+ const b = charKind(s[i]);
14178
+ if (a !== b && !(a === "u" && b === "l") && a !== "o" && b !== "o") {
14179
+ transitions++;
14180
+ }
14181
+ }
14182
+ return covered / s.replace(/[_$]/g, "").length >= 0.6 && transitions / s.length <= 0.25;
14183
+ }
14184
+ function isSlashValueSecret(secret) {
14185
+ if (!secret.includes("/")) return true;
14186
+ if (!/^[A-Za-z0-9+/]+={0,2}$/.test(secret)) return false;
14187
+ if (secret.length < 16) return false;
14188
+ if (charClassCount(secret) < 3) return false;
14189
+ return !secret.split("/").filter(Boolean).every(
14190
+ (seg) => seg.length < 6 || isIdentifierLike(seg) || /^\d+$/.test(seg)
14191
+ );
14192
+ }
14193
+ function isMarkdownIdentifier(secret, fullMatch) {
14194
+ return fullMatch.includes("`") && isIdentifierLike(secret);
14195
+ }
14196
+ function isSessionSecret(secret, fullMatch, before = "") {
14197
+ const words = nameWords(secret, fullMatch, before);
14198
+ const last = words.at(-1) ?? "";
14199
+ if (/^token$/i.test(last) && words.slice(0, -1).some((word) => PAGINATION_WORD.test(word))) {
14200
+ return false;
14201
+ }
14202
+ return isCredentialShaped(secret) && !isIdentifierLike(secret) && shannonEntropy(secret) >= 3.2 && isIdShapeAllowed(words, secret) && isSlashValueSecret(secret) && // "=..." values come from ==version pins (tokenspeed-triton==0.1.2+cu121).
13521
14203
  !secret.startsWith("=") && !IDENTIFIER_NAME.test(fullMatch);
13522
14204
  }
14205
+ var PASSWORD_STOP_WORD = /^(?:none|null|nil|true|false|undefined|required|optional|hidden|masked|prompt|empty|unknown|anonymous|string|str|secret|password|passwd|passphrase|default|value|input|changeme|notset|redacted|disabled|enabled|credentials|creds|hashed|encrypted|decrypted|plaintext|generated|provided|supplied|random|getpass|environ|settings|config|incorrect|invalid|wrong|expired|missing|protected|mismatch|reset)$/i;
14206
+ var PASSWORD_SETTING_NAME = /(?:file|path|dir|policy|length|min|max|reset|hash|field|input|label|hint|prompt|manager|strategy|rules?)$/i;
14207
+ function isPasswordValue(secret, fullMatch) {
14208
+ if (isCredentialShaped(secret)) return true;
14209
+ const value = secret.replace(/[;,)\]}]+$/, "");
14210
+ if (value.length < 8 || isPlaceholder(value) || PASSWORD_STOP_WORD.test(value) || TYPE_OR_LITERAL.test(value) || URL_VALUE.test(value) || DOTTED_IDENTIFIER.test(value)) {
14211
+ return false;
14212
+ }
14213
+ if (/^\d+$/.test(value) || /^[A-Z][A-Z0-9_]*$/.test(value)) return false;
14214
+ if (/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)+(?:\(|$)/.test(value)) {
14215
+ return false;
14216
+ }
14217
+ if (/^[A-Za-z_]\w*\(/.test(value)) return false;
14218
+ if (/^\[|\(\?|\\[dwsb]/.test(value)) return false;
14219
+ if (/[[(){}?,<>|=:/]/.test(value)) return false;
14220
+ const name = fullMatch.slice(0, fullMatch.length - secret.length);
14221
+ if (name.includes("\n")) return false;
14222
+ if (PASSWORD_SETTING_NAME.test(name.replace(/[^A-Za-z0-9]+$/, ""))) {
14223
+ return false;
14224
+ }
14225
+ const snake = /^[a-z][a-z0-9]*(?:_[a-z0-9]+)+$/.test(value);
14226
+ if (snake && /^[A-Z0-9_]+\s+=\s/.test(name)) return false;
14227
+ const codeContext = !/^[A-Z0-9_]+=$/.test(name) && (value !== secret || /\s=\s/.test(name));
14228
+ return !(codeContext && snake && !/[:=]\s*\\{0,7}["'`]/.test(fullMatch));
14229
+ }
14230
+ var NON_CREDENTIAL_FLAG = /[-_](?:client|next|starting|continuation|pagination|page|idempotency|max|min|cancel|resume|sync|num)[-_]token\b|--(?:no|with|without|use|skip|show|print|ask|prompt|save|store|read|from)[-_]/i;
13523
14231
  function isValidJwt(secret) {
13524
14232
  const parts = secret.split(".");
13525
14233
  if (parts.length !== 3) return false;
@@ -13537,12 +14245,41 @@ function isValidJwt(secret) {
13537
14245
  }
13538
14246
  function isBasicCredentials(secret) {
13539
14247
  const decoded = Buffer.from(secret, "base64").toString("utf8");
13540
- return /^[\x20-\x7e]{2,}:[\x20-\x7e]*$/.test(decoded);
14248
+ return /^(?:[\x20-\x7e]{2,}:[\x20-\x7e]*|[\x20-\x7e]?:[\x20-\x7e]{6,})$/.test(
14249
+ decoded
14250
+ );
13541
14251
  }
13542
14252
  var VALIDATORS = {
13543
- "credential-value": isCredentialShaped,
14253
+ "credential-value": (secret, fullMatch) => isCredentialShaped(secret) && !isMarkdownIdentifier(secret, fullMatch),
13544
14254
  "high-entropy": (secret) => isCredentialShaped(secret) && shannonEntropy(secret) >= 3.2,
13545
14255
  "session-value": isSessionSecret,
14256
+ "password-value": isPasswordValue,
14257
+ "aws-session-token": (secret) => charClassCount(secret) === 3 && shannonEntropy(secret) >= 4.5,
14258
+ // A 40-hex value right after a W&B mention is an API key unless the text
14259
+ // between them names it a commit, hash, or run id.
14260
+ "wandb-hex": (secret, fullMatch) => shannonEntropy(secret) >= 3.3 && !/\b(?:sha\d*|commit|revision|rev|hash|digest|git|run[_ -]?id|artifact)\b/i.test(
14261
+ fullMatch.slice(0, fullMatch.length - secret.length)
14262
+ ),
14263
+ // .netrc passwords: credential-shaped, or long and random. Prose like
14264
+ // "machine learning password recommendations" is not.
14265
+ "netrc-password": (secret) => isCredentialShaped(secret) || secret.length >= 16 && shannonEntropy(secret) >= 3.5 && !isPlaceholder(secret),
14266
+ // --token X / --api-key=X: an opaque value, not a path, identifier, env
14267
+ // name, or a pagination/boolean flag (--next-token, --no-password).
14268
+ // Password flags take human passwords, as Password Assignment does.
14269
+ "cli-credential": (secret, fullMatch) => !NON_CREDENTIAL_FLAG.test(fullMatch) && (/pass/i.test(fullMatch.slice(0, fullMatch.length - secret.length)) ? isPasswordValue(secret, fullMatch) : isCredentialShaped(secret) && shannonEntropy(secret) >= 3.2 && !isIdentifierLike(secret) && !/^[.~/]/.test(secret) && !/^[A-Z][A-Z0-9_]*$/.test(secret) && isSlashValueSecret(secret)),
14270
+ // key="..." kwargs: an opaque token, not a snake/kebab-case cache key name.
14271
+ "opaque-token": (secret) => isCredentialShaped(secret) && shannonEntropy(secret) >= 3.5 && !/^[a-z]+(?:[_-][a-z0-9]+)+$/i.test(secret),
14272
+ // A base64-encoded PEM (kubeconfig client-key-data, k8s tls.key, a
14273
+ // cert+key bundle) that decodes to a private key anywhere in it.
14274
+ "b64-private-key": (secret) => /PRIVATE KEY/.test(
14275
+ Buffer.from(
14276
+ secret.replace(/\d{1,6}(?:\u2192|\t|\\t)|\\+[nrt]|\s/g, ""),
14277
+ "base64"
14278
+ ).toString("latin1")
14279
+ ),
14280
+ // A BEGIN..END private-key span with a body: at least two base64 runs of
14281
+ // 40+ characters, so code that only names the markers is left alone.
14282
+ "pem-body": (secret) => (secret.match(/[A-Za-z0-9+/=]{40,}/g) ?? []).length >= 2,
13546
14283
  jwt: isValidJwt,
13547
14284
  "basic-auth": isBasicCredentials
13548
14285
  };
@@ -13583,15 +14320,17 @@ function compilePatterns() {
13583
14320
  ];
13584
14321
  for (const p7 of allPatterns) {
13585
14322
  if (p7.confidence !== "high") continue;
14323
+ if (DROPPED_UPSTREAM.has(p7.name)) continue;
13586
14324
  if (DELIMITER_SUFFIX.test(p7.regex)) continue;
13587
14325
  if (!HAS_VALUE_MATCHER.test(p7.regex)) continue;
13588
14326
  if (GREEDY_TAIL.test(p7.regex)) continue;
13589
14327
  if (p7.validator && !(p7.validator in VALIDATORS)) continue;
13590
14328
  try {
13591
14329
  const prefixRun = PREFIX_RUNS[p7.regex];
14330
+ const source = BOUNDED_UPSTREAM[p7.regex] ?? p7.regex;
13592
14331
  patterns.push({
13593
14332
  name: p7.name,
13594
- regex: new RegExp(p7.regex, `g${prefixRun ? "y" : ""}${p7.flags ?? ""}`),
14333
+ regex: new RegExp(source, `g${prefixRun ? "y" : ""}${p7.flags ?? ""}`),
13595
14334
  prefixRun: prefixRun ? new RegExp(prefixRun, `g${p7.flags ?? ""}`) : void 0,
13596
14335
  groupCount: countCaptureGroups(p7.regex),
13597
14336
  validate: p7.validator ? VALIDATORS[p7.validator] : void 0,
@@ -13604,6 +14343,8 @@ function compilePatterns() {
13604
14343
  }
13605
14344
  return patterns;
13606
14345
  }
14346
+ var TOKEN_CHAR = /[A-Za-z0-9_-]/;
14347
+ var MAX_TOKEN_EXTENSION = 4096;
13607
14348
  function applyPattern(content, regex, groupCount, validate, prefixRun) {
13608
14349
  let count = 0;
13609
14350
  let result = "";
@@ -13636,7 +14377,11 @@ function applyPattern(content, regex, groupCount, validate, prefixRun) {
13636
14377
  }
13637
14378
  }
13638
14379
  }
13639
- if (validate && !validate(longest.length > 0 ? longest : fullMatch, fullMatch)) {
14380
+ if (validate && !validate(
14381
+ longest.length > 0 ? longest : fullMatch,
14382
+ fullMatch,
14383
+ content.slice(Math.max(0, match.index - 48), match.index)
14384
+ )) {
13640
14385
  result += content.slice(lastIndex, match.index) + fullMatch;
13641
14386
  lastIndex = match.index + fullMatch.length;
13642
14387
  if (fullMatch.length === 0) {
@@ -13647,14 +14392,23 @@ function applyPattern(content, regex, groupCount, validate, prefixRun) {
13647
14392
  }
13648
14393
  count++;
13649
14394
  let replacement = "[REDACTED]";
14395
+ let redactsToEnd = true;
13650
14396
  if (longest.length > 0 && longest.length < fullMatch.length) {
13651
14397
  const pos = fullMatch.indexOf(longest);
13652
14398
  if (pos > 0) {
13653
14399
  replacement = fullMatch.slice(0, pos) + "[REDACTED]" + fullMatch.slice(pos + longest.length);
14400
+ redactsToEnd = pos + longest.length === fullMatch.length;
13654
14401
  }
13655
14402
  }
13656
14403
  result += content.slice(lastIndex, match.index) + replacement;
13657
14404
  lastIndex = match.index + fullMatch.length;
14405
+ if (redactsToEnd && fullMatch.length > 0 && TOKEN_CHAR.test(content[lastIndex - 1])) {
14406
+ const cap = Math.min(content.length, lastIndex + MAX_TOKEN_EXTENSION);
14407
+ let end = lastIndex;
14408
+ while (end < cap && TOKEN_CHAR.test(content[end])) end++;
14409
+ lastIndex = end;
14410
+ if (regex.lastIndex < end) regex.lastIndex = end;
14411
+ }
13658
14412
  if (fullMatch.length === 0) {
13659
14413
  regex.lastIndex++;
13660
14414
  }
@@ -13794,8 +14548,28 @@ function memoizedRedact(value, patterns, memo, owningKey) {
13794
14548
  }
13795
14549
  return result;
13796
14550
  }
13797
- function walkAndRedactAll(value, patterns, memo, owningKey = null) {
14551
+ var BASE64_VALUE = /^[A-Za-z0-9+/]+={0,2}$/;
14552
+ var BASE64URL_VALUE = /^[A-Za-z0-9_-]+={0,2}$/;
14553
+ var BINARY_BASE64_PREFIX = /^(?:iVBORw0KGgoAAAANSUhEUg|\/9j\/|R0lGOD[dl]h|UklGR|JVBERi0)/;
14554
+ var BINARY_MEDIA_TYPE = /^(?:image|audio|video)\/|^application\/(?:pdf|octet-stream|zip)/;
14555
+ var DATA_IMAGE_URL = /^data:image\/[\w.+-]+;base64,[A-Za-z0-9+/]+={0,2}$/;
14556
+ function isOpaqueBlob(value, owningKey, parent) {
14557
+ if (value.length < 256 || owningKey === null) return false;
14558
+ if (DATA_IMAGE_URL.test(value)) return true;
14559
+ if (BINARY_BASE64_PREFIX.test(value)) return BASE64_VALUE.test(value);
14560
+ const type = typeof parent?.type === "string" ? parent.type : "";
14561
+ const media = typeof parent?.media_type === "string" ? parent.media_type : typeof parent?.mimeType === "string" ? parent.mimeType : "";
14562
+ if ((owningKey === "data" || owningKey === "base64" || owningKey === "blob") && (type === "base64" || type === "pdf" || BINARY_MEDIA_TYPE.test(type) || BINARY_MEDIA_TYPE.test(media))) {
14563
+ return BASE64_VALUE.test(value);
14564
+ }
14565
+ if (owningKey === "signature" && type === "thinking" || owningKey === "data" && type === "redacted_thinking" || owningKey === "encrypted_content") {
14566
+ return BASE64_VALUE.test(value) || BASE64URL_VALUE.test(value);
14567
+ }
14568
+ return false;
14569
+ }
14570
+ function walkAndRedactAll(value, patterns, memo, owningKey = null, parent = null) {
13798
14571
  if (typeof value === "string") {
14572
+ if (isOpaqueBlob(value, owningKey, parent)) return { value, count: 0 };
13799
14573
  if (memo) {
13800
14574
  return memoizedRedact(value, patterns, memo, owningKey);
13801
14575
  }
@@ -13804,7 +14578,7 @@ function walkAndRedactAll(value, patterns, memo, owningKey = null) {
13804
14578
  if (Array.isArray(value)) {
13805
14579
  let total = 0;
13806
14580
  const arr = value.map((item) => {
13807
- const r = walkAndRedactAll(item, patterns, memo, owningKey);
14581
+ const r = walkAndRedactAll(item, patterns, memo, owningKey, parent);
13808
14582
  total += r.count;
13809
14583
  return r.value;
13810
14584
  });
@@ -13815,7 +14589,13 @@ function walkAndRedactAll(value, patterns, memo, owningKey = null) {
13815
14589
  const obj = {};
13816
14590
  for (const [k, v] of Object.entries(value)) {
13817
14591
  const keyScan = memo ? memoizedRedact(k, patterns, memo, null) : redactString(k, patterns, null);
13818
- const r = walkAndRedactAll(v, patterns, memo, k);
14592
+ const r = walkAndRedactAll(
14593
+ v,
14594
+ patterns,
14595
+ memo,
14596
+ k,
14597
+ value
14598
+ );
13819
14599
  obj[keyScan.value] = r.value;
13820
14600
  total += r.count + keyScan.count;
13821
14601
  }
@@ -14160,19 +14940,25 @@ var PatternRedactMiddleware = class {
14160
14940
  function escapeRegExp(str) {
14161
14941
  return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
14162
14942
  }
14163
- function walkAndRedact(value, regex) {
14943
+ var PLACEHOLDER = "[REDACTED]";
14944
+ function replaceSecrets(text2, regex) {
14945
+ let count = 0;
14946
+ const value = text2.replace(regex, (match) => {
14947
+ if (match === PLACEHOLDER) return match;
14948
+ count++;
14949
+ return PLACEHOLDER;
14950
+ });
14951
+ return { value, count };
14952
+ }
14953
+ function walkAndRedact(value, regex, owningKey = null, parent = null) {
14164
14954
  if (typeof value === "string") {
14165
- let count = 0;
14166
- const replaced = value.replace(regex, () => {
14167
- count++;
14168
- return "[REDACTED]";
14169
- });
14170
- return { value: replaced, count };
14955
+ if (isOpaqueBlob(value, owningKey, parent)) return { value, count: 0 };
14956
+ return replaceSecrets(value, regex);
14171
14957
  }
14172
14958
  if (Array.isArray(value)) {
14173
14959
  let total = 0;
14174
14960
  const arr = value.map((item) => {
14175
- const r = walkAndRedact(item, regex);
14961
+ const r = walkAndRedact(item, regex, owningKey, parent);
14176
14962
  total += r.count;
14177
14963
  return r.value;
14178
14964
  });
@@ -14182,14 +14968,10 @@ function walkAndRedact(value, regex) {
14182
14968
  let total = 0;
14183
14969
  const result = {};
14184
14970
  for (const [k, v] of Object.entries(value)) {
14185
- let keyCount = 0;
14186
- const newKey = k.replace(regex, () => {
14187
- keyCount++;
14188
- return "[REDACTED]";
14189
- });
14190
- const r = walkAndRedact(v, regex);
14191
- result[newKey] = r.value;
14192
- total += r.count + keyCount;
14971
+ const keyScan = replaceSecrets(k, regex);
14972
+ const r = walkAndRedact(v, regex, k, value);
14973
+ result[keyScan.value] = r.value;
14974
+ total += r.count + keyScan.count;
14193
14975
  }
14194
14976
  return { value: result, count: total };
14195
14977
  }
@@ -14211,7 +14993,7 @@ var RedactMiddleware = class {
14211
14993
  async process(group) {
14212
14994
  if (this.secrets.size === 0) return group;
14213
14995
  const sorted = [...this.secrets].sort((a, b) => b.length - a.length);
14214
- const pattern = sorted.map(escapeRegExp).join("|");
14996
+ const pattern = [PLACEHOLDER, ...sorted].map(escapeRegExp).join("|");
14215
14997
  const regex = new RegExp(pattern, "g");
14216
14998
  const newFiles = [];
14217
14999
  for (const file of group.files) {
@@ -14295,17 +15077,28 @@ var RedactMiddleware = class {
14295
15077
  return { value: result, count };
14296
15078
  }
14297
15079
  redactString(content, regex) {
14298
- let count = 0;
14299
- const result = content.replace(regex, () => {
14300
- count++;
14301
- return "[REDACTED]";
14302
- });
14303
- return { result, count };
15080
+ const { value, count } = replaceSecrets(content, regex);
15081
+ return { result: value, count };
14304
15082
  }
14305
15083
  };
14306
15084
 
14307
15085
  // src/middleware/index.ts
14308
15086
  var middleware = [];
15087
+ function isUnambiguousSecret(value) {
15088
+ if (/^-{3,}/.test(value)) return false;
15089
+ if (/^[a-z][a-z0-9+.-]*:\/\//i.test(value) && !/^[a-z][a-z0-9+.-]*:\/\/[^/\s@]*@/i.test(value)) {
15090
+ return false;
15091
+ }
15092
+ return value.length >= 32 || value.length >= 8 && /[^A-Za-z0-9_-]/.test(value);
15093
+ }
15094
+ function redactionChain(secrets) {
15095
+ const chain = [];
15096
+ const early = new Set([...secrets].filter(isUnambiguousSecret));
15097
+ if (early.size > 0) chain.push(new RedactMiddleware(early));
15098
+ chain.push(new PatternRedactMiddleware());
15099
+ if (secrets.size > 0) chain.push(new RedactMiddleware(secrets));
15100
+ return chain;
15101
+ }
14309
15102
 
14310
15103
  // src/outputs/platform.ts
14311
15104
  import fs14 from "fs";
@@ -15085,12 +15878,7 @@ async function buildMiddleware(repoRoot) {
15085
15878
  const envFileNames = await discoverEnvFiles(repoRoot);
15086
15879
  const envFilePaths = envFileNames.map((n) => path15.join(repoRoot, n));
15087
15880
  const secretResult = await collectSecrets(repoRoot, envFilePaths, []);
15088
- const middleware2 = [];
15089
- if (secretResult.values.size > 0) {
15090
- middleware2.push(new RedactMiddleware(secretResult.values));
15091
- }
15092
- middleware2.push(new PatternRedactMiddleware());
15093
- return middleware2;
15881
+ return redactionChain(secretResult.values);
15094
15882
  }
15095
15883
  async function uploadDebugLog(ctx, state, sessionState, onContributionCreated) {
15096
15884
  const logPath = todayLogPath();
@@ -17975,7 +18763,7 @@ async function uploadArtifact(client, contributionId, filename, mimeType, buffer
17975
18763
  }
17976
18764
 
17977
18765
  // package.json
17978
- var version = "0.9.10";
18766
+ var version = "0.9.11";
17979
18767
 
17980
18768
  // src/version.ts
17981
18769
  var CLI_VERSION = version;
@@ -18544,13 +19332,8 @@ async function buildRedactChain(repoRoot, capturedSecrets = []) {
18544
19332
  "secret-collection",
18545
19333
  () => collectSecrets(repoRoot, envFilePaths, [])
18546
19334
  );
18547
- const chain = [];
18548
19335
  for (const secret of capturedSecrets) secretResult.values.add(secret);
18549
- if (secretResult.values.size > 0) {
18550
- chain.push(new RedactMiddleware(secretResult.values));
18551
- }
18552
- chain.push(new PatternRedactMiddleware());
18553
- return chain;
19336
+ return redactionChain(secretResult.values);
18554
19337
  }
18555
19338
  async function redactTail(tail, repoRoot, sourceTool, transcriptPath, redactChain) {
18556
19339
  let group = makeTranscriptGroup(repoRoot, sourceTool, transcriptPath, tail);
@@ -23296,14 +24079,8 @@ async function runInteractive() {
23296
24079
  envFilePaths,
23297
24080
  additionalFiles
23298
24081
  );
23299
- const mwChain = [...middleware];
23300
- let redactMw = null;
23301
- if (secretResult.values.size > 0) {
23302
- redactMw = new RedactMiddleware(secretResult.values);
23303
- mwChain.push(redactMw);
23304
- }
23305
- const patternMw = new PatternRedactMiddleware();
23306
- mwChain.push(patternMw);
24082
+ const redactChain = redactionChain(secretResult.values);
24083
+ const mwChain = [...middleware, ...redactChain];
23307
24084
  const output = await selectOutput(outputs);
23308
24085
  const confirmed = await confirmExport(filtered, output);
23309
24086
  if (!confirmed) {
@@ -23320,8 +24097,23 @@ async function runInteractive() {
23320
24097
  (stage) => s.message(stage)
23321
24098
  );
23322
24099
  s.stop(`Exported ${fileCount} files.`);
23323
- if (redactMw) reportRedactionStats("Redaction", redactMw.stats);
23324
- reportRedactionStats("Pattern redaction", patternMw.stats);
24100
+ const exactPasses = redactChain.filter(
24101
+ (mw) => mw instanceof RedactMiddleware
24102
+ );
24103
+ if (exactPasses.length > 0) {
24104
+ const stat = (key) => exactPasses.map((mw) => mw.stats[key]);
24105
+ reportRedactionStats("Redaction", {
24106
+ filesRedacted: Math.max(...stat("filesRedacted")),
24107
+ totalRedactions: stat("totalRedactions").reduce((a, b) => a + b, 0),
24108
+ filesSkipped: Math.max(...stat("filesSkipped")),
24109
+ binaryFiles: Math.max(...stat("binaryFiles"))
24110
+ });
24111
+ }
24112
+ for (const mw of redactChain) {
24113
+ if (mw instanceof PatternRedactMiddleware) {
24114
+ reportRedactionStats("Pattern redaction", mw.stats);
24115
+ }
24116
+ }
23325
24117
  if (secretResult.skippedCount > 0) {
23326
24118
  p6.log.info(
23327
24119
  `${secretResult.skippedCount} secret value(s) skipped (too short or common).`