tenjin-cli 0.1.0-alpha.2 → 0.1.0-alpha.21

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.
Files changed (219) hide show
  1. package/NOTICE.md +54 -7
  2. package/README.md +175 -256
  3. package/dist/{_esm-FEASBWRP.js → _esm-CE7KNONL.js} +9 -10
  4. package/dist/{ccip-NQXCEK2U.js → ccip-7RMRLAGV.js} +4 -4
  5. package/dist/{ccip-XR5NE5QK.js → ccip-NLCSCHKI.js} +5 -5
  6. package/dist/chunk-2AQO4YDI.js +291 -0
  7. package/dist/chunk-2AQO4YDI.js.map +1 -0
  8. package/dist/chunk-2QYORQBF.js +55 -0
  9. package/dist/chunk-2QYORQBF.js.map +1 -0
  10. package/dist/chunk-3EUTWC2B.js +194 -0
  11. package/dist/chunk-3EUTWC2B.js.map +1 -0
  12. package/dist/{chunk-ZMHYXMO6.js → chunk-5IEP5EGE.js} +3 -3
  13. package/dist/chunk-7QKHZQKW.js +1680 -0
  14. package/dist/chunk-7QKHZQKW.js.map +1 -0
  15. package/dist/chunk-A36LQPHV.js +29 -0
  16. package/dist/chunk-A36LQPHV.js.map +1 -0
  17. package/dist/{chunk-XJIW7USF.js → chunk-AQRUD5GQ.js} +115 -11
  18. package/dist/chunk-AQRUD5GQ.js.map +1 -0
  19. package/dist/{chunk-UGX7YPX2.js → chunk-AWQPGIR6.js} +7 -9
  20. package/dist/{chunk-UGX7YPX2.js.map → chunk-AWQPGIR6.js.map} +1 -1
  21. package/dist/{chunk-5CLSD5YN.js → chunk-BPMWXTFX.js} +2 -2
  22. package/dist/chunk-C363JZN2.js +127 -0
  23. package/dist/chunk-C363JZN2.js.map +1 -0
  24. package/dist/{chunk-YALGASEU.js → chunk-EGELTSPU.js} +2 -2
  25. package/dist/chunk-ETW2ASBP.js +10562 -0
  26. package/dist/chunk-ETW2ASBP.js.map +1 -0
  27. package/dist/chunk-GHTPYKDT.js +112 -0
  28. package/dist/chunk-GHTPYKDT.js.map +1 -0
  29. package/dist/{chunk-CYOF7ROH.js → chunk-HPWO4O6S.js} +3 -3
  30. package/dist/chunk-IOB7URFH.js +242 -0
  31. package/dist/chunk-IOB7URFH.js.map +1 -0
  32. package/dist/chunk-IOIHYOU4.js +1784 -0
  33. package/dist/chunk-IOIHYOU4.js.map +1 -0
  34. package/dist/chunk-JLEF5WHM.js +132 -0
  35. package/dist/chunk-JLEF5WHM.js.map +1 -0
  36. package/dist/chunk-JN7TMXVF.js +172 -0
  37. package/dist/chunk-JN7TMXVF.js.map +1 -0
  38. package/dist/{chunk-QVX5MWJZ.js → chunk-JRGFKVAZ.js} +2 -2
  39. package/dist/chunk-K6AXXYCG.js +109 -0
  40. package/dist/chunk-K6AXXYCG.js.map +1 -0
  41. package/dist/{chunk-HIVZG55D.js → chunk-KG3D7FIF.js} +2 -2
  42. package/dist/chunk-LAIZ2AQA.js +107 -0
  43. package/dist/chunk-LAIZ2AQA.js.map +1 -0
  44. package/dist/chunk-LHHMV4GU.js +27 -0
  45. package/dist/chunk-LHHMV4GU.js.map +1 -0
  46. package/dist/{chunk-YBMMV4Y4.js → chunk-MEFB5KHA.js} +13 -5
  47. package/dist/chunk-MEFB5KHA.js.map +1 -0
  48. package/dist/{chunk-NCE5NSN6.js → chunk-N35E6CM2.js} +140 -10
  49. package/dist/chunk-N35E6CM2.js.map +1 -0
  50. package/dist/chunk-N4DJEQAF.js +190 -0
  51. package/dist/chunk-N4DJEQAF.js.map +1 -0
  52. package/dist/chunk-O2JYBOUO.js +47 -0
  53. package/dist/chunk-O2JYBOUO.js.map +1 -0
  54. package/dist/chunk-OSUD6YZZ.js +451 -0
  55. package/dist/chunk-OSUD6YZZ.js.map +1 -0
  56. package/dist/chunk-OTPEH3AH.js +926 -0
  57. package/dist/chunk-OTPEH3AH.js.map +1 -0
  58. package/dist/chunk-PJEG2JIJ.js +242 -0
  59. package/dist/chunk-PJEG2JIJ.js.map +1 -0
  60. package/dist/{chunk-ZABPQJ3M.js → chunk-POUWHWID.js} +2 -2
  61. package/dist/chunk-QF4SSCQV.js +377 -0
  62. package/dist/chunk-QF4SSCQV.js.map +1 -0
  63. package/dist/chunk-QHILSA6G.js +82 -0
  64. package/dist/chunk-QHILSA6G.js.map +1 -0
  65. package/dist/chunk-QRFONFRW.js +231 -0
  66. package/dist/chunk-QRFONFRW.js.map +1 -0
  67. package/dist/{chunk-N62ROTMC.js → chunk-RCJQARZF.js} +14 -10
  68. package/dist/chunk-RCJQARZF.js.map +1 -0
  69. package/dist/{chunk-S3IGX57D.js → chunk-RGVOODF4.js} +7703 -7475
  70. package/dist/chunk-RGVOODF4.js.map +1 -0
  71. package/dist/chunk-S2NRVRPF.js +171 -0
  72. package/dist/chunk-S2NRVRPF.js.map +1 -0
  73. package/dist/chunk-SRVDXR6B.js +337 -0
  74. package/dist/chunk-SRVDXR6B.js.map +1 -0
  75. package/dist/chunk-TGLKKLQG.js +11 -0
  76. package/dist/chunk-TGLKKLQG.js.map +1 -0
  77. package/dist/{chunk-RRN3YTK7.js → chunk-TTNESUPQ.js} +3 -3
  78. package/dist/chunk-U2ATFMKZ.js +164 -0
  79. package/dist/chunk-U2ATFMKZ.js.map +1 -0
  80. package/dist/chunk-UY2TOI3B.js +208 -0
  81. package/dist/chunk-UY2TOI3B.js.map +1 -0
  82. package/dist/{chunk-OYMYCW7J.js → chunk-W3LVZ2EN.js} +605 -97
  83. package/dist/chunk-W3LVZ2EN.js.map +1 -0
  84. package/dist/{chunk-HSDCI7OV.js → chunk-XZKD7DIF.js} +3 -3
  85. package/dist/{chunk-Z6MFJV5Z.js → chunk-YVODPFTL.js} +851 -500
  86. package/dist/chunk-YVODPFTL.js.map +1 -0
  87. package/dist/{cli-4NNBEQYH.js → cli-7KJ4QLUU.js} +367 -216
  88. package/dist/cli-7KJ4QLUU.js.map +1 -0
  89. package/dist/config-MSN6H4MD.js +41 -0
  90. package/dist/dist-3LOO6M4U.js +2842 -0
  91. package/dist/dist-3LOO6M4U.js.map +1 -0
  92. package/dist/doctor-ITUCKN6C.js +453 -0
  93. package/dist/doctor-ITUCKN6C.js.map +1 -0
  94. package/dist/{ethersCompat-Df4a6QIZ-3YZIAXDK.js → ethersCompat-Df4a6QIZ-THAVUGIJ.js} +5 -5
  95. package/dist/fund-XPB4IIG5.js +298 -0
  96. package/dist/fund-XPB4IIG5.js.map +1 -0
  97. package/dist/hook-command-VVV2Q23L.js +1265 -0
  98. package/dist/hook-command-VVV2Q23L.js.map +1 -0
  99. package/dist/index.js +11 -3
  100. package/dist/index.js.map +1 -1
  101. package/dist/install-OSJRM2ME.js +63 -0
  102. package/dist/install-identity-YIWKQOUD.js +27 -0
  103. package/dist/install-wallet-BWJO2SUC.js +107 -0
  104. package/dist/install-wallet-BWJO2SUC.js.map +1 -0
  105. package/dist/mcp-KE5YKPS2.js +10174 -0
  106. package/dist/mcp-KE5YKPS2.js.map +1 -0
  107. package/dist/paths-MUXHUOCM.js +57 -0
  108. package/dist/pay-MUV2U232.js +46 -0
  109. package/dist/payments-4D27K4L2.js +48 -0
  110. package/dist/payments-4D27K4L2.js.map +1 -0
  111. package/dist/redact-6W23GGJC.js +15 -0
  112. package/dist/{secp256k1-N3ZHU7LB.js → secp256k1-ZZZT2CAX.js} +3 -3
  113. package/dist/secp256k1-ZZZT2CAX.js.map +1 -0
  114. package/dist/send-BXHFKDBF.js +225 -0
  115. package/dist/send-BXHFKDBF.js.map +1 -0
  116. package/dist/status-3Z3YPRSE.js +71 -0
  117. package/dist/status-3Z3YPRSE.js.map +1 -0
  118. package/dist/status-line-CKRMGZ3Q.js +87 -0
  119. package/dist/status-line-CKRMGZ3Q.js.map +1 -0
  120. package/dist/status-line-wiring-GECLIIBT.js +29 -0
  121. package/dist/status-line-wiring-GECLIIBT.js.map +1 -0
  122. package/dist/tenjin-daemon.mjs +20598 -0
  123. package/dist/tenjin-shim.mjs +251 -0
  124. package/dist/tenjin-vitest-reporter.mjs +49 -0
  125. package/dist/uninstall-BZTVWJ7W.js +165 -0
  126. package/dist/uninstall-BZTVWJ7W.js.map +1 -0
  127. package/dist/update-IQQTEOI5.js +433 -0
  128. package/dist/update-IQQTEOI5.js.map +1 -0
  129. package/dist/{viemAdapter-By13KInL-ZZE6UV4Y.js → viemAdapter-By13KInL-X2VY6CY3.js} +5 -5
  130. package/dist/viemAdapter-By13KInL-X2VY6CY3.js.map +1 -0
  131. package/dist/wallet-UFXQ57TZ.js +33 -0
  132. package/dist/wallet-UFXQ57TZ.js.map +1 -0
  133. package/dist/wallet-kdf-worker.mjs +980 -0
  134. package/docs/agent-permissions.md +141 -0
  135. package/docs/safety-model.md +70 -0
  136. package/package.json +14 -9
  137. package/LICENSE +0 -21
  138. package/dist/buy-U35DQ6XM.js +0 -1598
  139. package/dist/buy-U35DQ6XM.js.map +0 -1
  140. package/dist/candidate-RLYCQMF5.js +0 -127
  141. package/dist/candidate-RLYCQMF5.js.map +0 -1
  142. package/dist/chunk-27ONARHV.js +0 -171
  143. package/dist/chunk-27ONARHV.js.map +0 -1
  144. package/dist/chunk-3OV7E5G5.js +0 -18
  145. package/dist/chunk-3OV7E5G5.js.map +0 -1
  146. package/dist/chunk-7KUW4MJD.js +0 -59
  147. package/dist/chunk-7KUW4MJD.js.map +0 -1
  148. package/dist/chunk-7PHSZKQS.js +0 -333
  149. package/dist/chunk-7PHSZKQS.js.map +0 -1
  150. package/dist/chunk-IYLHQMT5.js +0 -211
  151. package/dist/chunk-IYLHQMT5.js.map +0 -1
  152. package/dist/chunk-JPHG2JW3.js +0 -96
  153. package/dist/chunk-JPHG2JW3.js.map +0 -1
  154. package/dist/chunk-MUBUQVC3.js +0 -67
  155. package/dist/chunk-MUBUQVC3.js.map +0 -1
  156. package/dist/chunk-N62ROTMC.js.map +0 -1
  157. package/dist/chunk-NCE5NSN6.js.map +0 -1
  158. package/dist/chunk-OYMYCW7J.js.map +0 -1
  159. package/dist/chunk-QNP7H47L.js +0 -152
  160. package/dist/chunk-QNP7H47L.js.map +0 -1
  161. package/dist/chunk-RY4XKNV3.js +0 -140
  162. package/dist/chunk-RY4XKNV3.js.map +0 -1
  163. package/dist/chunk-S3IGX57D.js.map +0 -1
  164. package/dist/chunk-TFGSOPWR.js +0 -261
  165. package/dist/chunk-TFGSOPWR.js.map +0 -1
  166. package/dist/chunk-TLCMMYLY.js +0 -126
  167. package/dist/chunk-TLCMMYLY.js.map +0 -1
  168. package/dist/chunk-UO22YNY4.js +0 -69
  169. package/dist/chunk-UO22YNY4.js.map +0 -1
  170. package/dist/chunk-UPIEAMGH.js +0 -160
  171. package/dist/chunk-UPIEAMGH.js.map +0 -1
  172. package/dist/chunk-XJIW7USF.js.map +0 -1
  173. package/dist/chunk-YBMMV4Y4.js.map +0 -1
  174. package/dist/chunk-YIYQ2ZNT.js +0 -286
  175. package/dist/chunk-YIYQ2ZNT.js.map +0 -1
  176. package/dist/chunk-YN5SHIXQ.js +0 -126
  177. package/dist/chunk-YN5SHIXQ.js.map +0 -1
  178. package/dist/chunk-Z52RA3NC.js +0 -137
  179. package/dist/chunk-Z52RA3NC.js.map +0 -1
  180. package/dist/chunk-Z6MFJV5Z.js.map +0 -1
  181. package/dist/cli-4NNBEQYH.js.map +0 -1
  182. package/dist/config-2VSXWWHK.js +0 -21
  183. package/dist/doctor-JJPNIBYH.js +0 -20
  184. package/dist/inspect-JGYJWFDP.js +0 -96
  185. package/dist/inspect-JGYJWFDP.js.map +0 -1
  186. package/dist/install-ZQRMSRGW.js +0 -378
  187. package/dist/install-ZQRMSRGW.js.map +0 -1
  188. package/dist/lookup-WYVTOMVY.js +0 -113
  189. package/dist/lookup-WYVTOMVY.js.map +0 -1
  190. package/dist/outcome-HKKT6QIA.js +0 -66
  191. package/dist/outcome-HKKT6QIA.js.map +0 -1
  192. package/dist/publish-D76B3MBK.js +0 -1480
  193. package/dist/publish-D76B3MBK.js.map +0 -1
  194. package/dist/usdc-JIAJW4SV.js +0 -22
  195. package/dist/wallet-6QKS6UHW.js +0 -179
  196. package/dist/wallet-6QKS6UHW.js.map +0 -1
  197. package/dist/wallet-PA54CRBL.js +0 -30
  198. package/skills/tenjin/SKILL.md +0 -199
  199. package/skills/tenjin-publish/SKILL.md +0 -96
  200. package/skills/tenjin-search/SKILL.md +0 -122
  201. /package/dist/{_esm-FEASBWRP.js.map → _esm-CE7KNONL.js.map} +0 -0
  202. /package/dist/{ccip-NQXCEK2U.js.map → ccip-7RMRLAGV.js.map} +0 -0
  203. /package/dist/{ccip-XR5NE5QK.js.map → ccip-NLCSCHKI.js.map} +0 -0
  204. /package/dist/{chunk-ZMHYXMO6.js.map → chunk-5IEP5EGE.js.map} +0 -0
  205. /package/dist/{chunk-5CLSD5YN.js.map → chunk-BPMWXTFX.js.map} +0 -0
  206. /package/dist/{chunk-YALGASEU.js.map → chunk-EGELTSPU.js.map} +0 -0
  207. /package/dist/{chunk-CYOF7ROH.js.map → chunk-HPWO4O6S.js.map} +0 -0
  208. /package/dist/{chunk-QVX5MWJZ.js.map → chunk-JRGFKVAZ.js.map} +0 -0
  209. /package/dist/{chunk-HIVZG55D.js.map → chunk-KG3D7FIF.js.map} +0 -0
  210. /package/dist/{chunk-ZABPQJ3M.js.map → chunk-POUWHWID.js.map} +0 -0
  211. /package/dist/{chunk-RRN3YTK7.js.map → chunk-TTNESUPQ.js.map} +0 -0
  212. /package/dist/{chunk-HSDCI7OV.js.map → chunk-XZKD7DIF.js.map} +0 -0
  213. /package/dist/{config-2VSXWWHK.js.map → config-MSN6H4MD.js.map} +0 -0
  214. /package/dist/{doctor-JJPNIBYH.js.map → ethersCompat-Df4a6QIZ-THAVUGIJ.js.map} +0 -0
  215. /package/dist/{ethersCompat-Df4a6QIZ-3YZIAXDK.js.map → install-OSJRM2ME.js.map} +0 -0
  216. /package/dist/{secp256k1-N3ZHU7LB.js.map → install-identity-YIWKQOUD.js.map} +0 -0
  217. /package/dist/{usdc-JIAJW4SV.js.map → paths-MUXHUOCM.js.map} +0 -0
  218. /package/dist/{viemAdapter-By13KInL-ZZE6UV4Y.js.map → pay-MUV2U232.js.map} +0 -0
  219. /package/dist/{wallet-PA54CRBL.js.map → redact-6W23GGJC.js.map} +0 -0
@@ -0,0 +1,1680 @@
1
+ import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
+
3
+ // src/lib/redact.ts
4
+ import { createHash } from "node:crypto";
5
+
6
+ // src/lib/redact-rules.json
7
+ var redact_rules_default = {
8
+ schemaVersion: 1,
9
+ note: "One rule table for every redaction surface in the CLI (src/lib/redact.ts), kept as data so the tenjin server-side ingest gate can vendor it verbatim. Every row is one detector: `id` is the stable finding `check`, `tier` is the finding severity, `match` is a JS regex or the name of an algorithmic detector a consumer must implement, `excerpt` is the masked-excerpt policy (never the secret), `skip` names a suppression predicate. `scopes` says where the row applies: `publish` (reported on the public marketplace), `team` (reported on a team shelf), `query` (its matches are replaced by the excerpt in hook queries and router packets by `mask()`; regex rows, plus the `hex64`, `pemBlock` and `bip39` algorithm rows). Precision first, as gitleaks and GitHub push protection do: a block row fires on a vendor prefix or an unambiguous shape, the generic `secret-assignment` row needs a secret-named word plus `=` or `:`, and entropy is never a trigger for a query. Table order is mask() order (the assignment row runs first, see its description). Several entries may share an `id`; they are one detector expressed as more than one pattern. Patterns adapted from gitleaks are MIT and attributed in NOTICE.md.",
10
+ publicHexConstants: [
11
+ {
12
+ value: "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
13
+ name: "topic0 ERC-20 / ERC-721 Transfer"
14
+ },
15
+ {
16
+ value: "0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925",
17
+ name: "topic0 ERC-20 / ERC-721 Approval"
18
+ },
19
+ {
20
+ value: "0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31",
21
+ name: "topic0 ERC-721 / ERC-1155 ApprovalForAll"
22
+ },
23
+ {
24
+ value: "0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62",
25
+ name: "topic0 ERC-1155 TransferSingle"
26
+ },
27
+ {
28
+ value: "0x4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb",
29
+ name: "topic0 ERC-1155 TransferBatch"
30
+ },
31
+ {
32
+ value: "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0",
33
+ name: "topic0 Ownable OwnershipTransferred"
34
+ },
35
+ {
36
+ value: "0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c",
37
+ name: "topic0 WETH Deposit"
38
+ },
39
+ {
40
+ value: "0x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65",
41
+ name: "topic0 WETH Withdrawal"
42
+ },
43
+ {
44
+ value: "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc",
45
+ name: "EIP-1967 implementation storage slot"
46
+ },
47
+ {
48
+ value: "0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103",
49
+ name: "EIP-1967 admin storage slot"
50
+ },
51
+ {
52
+ value: "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
53
+ name: "keccak256 of the empty string"
54
+ },
55
+ {
56
+ value: "0x0000000000000000000000000000000000000000000000000000000000000000",
57
+ name: "the zero hash"
58
+ }
59
+ ],
60
+ excerptPolicies: {
61
+ mask: "Keep the first `keep` characters (a public type marker) and replace the rest with a redaction count.",
62
+ verbatim: "Echo the match, truncated to `max` characters when set. Only for non-secret matches.",
63
+ abbreviate: "Keep `head` leading and `tail` trailing characters joined by an ellipsis.",
64
+ custom: "Consumer-implemented builder named by `handler`."
65
+ },
66
+ rules: [
67
+ {
68
+ id: "secret-assignment",
69
+ tier: "warn",
70
+ scopes: ["query", "publish", "team"],
71
+ description: 'Secret-named assignment (API_KEY=, password:, token=) with a literal value. The JSON-quoted form ("password": "...") is the third row, not a quote read here: reading a quote after this name turned ordinary config keys into findings ({"credentials": "include"}, {"max_tokens": 128000}, {"tokenizer": "cl100k_base"}, review round 6). The separator class is [ \\t] rather than \\s so a heading line (`## Token:`) never swallows the next line when mask() runs over whole text. FIRST IN THE TABLE ON PURPOSE: mask() applies rows in table order, and a value that is itself a vendor token (`OPENAI_API_KEY=sk-...`) must be taken whole by this row, name kept, before a vendor row could leave a stub for this row to re-match.',
72
+ source: "tenjin",
73
+ match: {
74
+ kind: "regex",
75
+ pattern: `\\b([A-Za-z0-9_]*(?:API[_-]?KEY|SECRET|ACCESS[_-]?KEY|SUBSCRIPTION[_-]?KEY|PRIVATE[_-]?KEY|PASSW(?:OR)?D|TOKEN|CREDENTIALS?|AUTH[_-]?TOKEN)[A-Za-z0-9_]*)[ \\t]*[:=][ \\t]*("[^"]{6,}"|'[^']{6,}'|[^\\s"']{6,})`,
76
+ flags: "gi"
77
+ },
78
+ excerpt: {
79
+ kind: "custom",
80
+ handler: "labeledValue"
81
+ },
82
+ skip: {
83
+ handler: "nonLiteralValue"
84
+ }
85
+ },
86
+ {
87
+ id: "secret-assignment",
88
+ tier: "warn",
89
+ scopes: ["query", "publish", "team"],
90
+ description: "Secret-named command-line flag with a SPACE-separated literal value (--api-key <v>, --token <v>): the one credential position the assignment form above cannot see, since it needs `=` or `:` after the name. `X-Api-Key: <v>` and `--api-key=<v>` already match above (Api-Key, api-key) and are deliberately not repeated here, so one value yields one finding. For the shapes a recorded command line takes (tenjin-agent#281): a hex-only key has no vendor prefix, and bare hex is deliberately never reported so a commit SHA still syncs, so the credential POSITION is the signal.",
91
+ source: "tenjin (closes tenjin-agent#281)",
92
+ match: {
93
+ kind: "regex",
94
+ pattern: `(--(?:[a-z0-9]+-)*(?:api[_-]?key|api[_-]?token|access[_-]?key|access[_-]?token|auth[_-]?token|secret[_-]?key|private[_-]?key|subscription[_-]?key|credentials?|secret|token|password|passwd))[ \\t]+("[^"]{6,}"|'[^']{6,}'|[^\\s"']{6,})`,
95
+ flags: "gi"
96
+ },
97
+ excerpt: {
98
+ kind: "custom",
99
+ handler: "labeledValue"
100
+ },
101
+ skip: {
102
+ handler: "nonLiteralValue"
103
+ }
104
+ },
105
+ {
106
+ id: "secret-assignment",
107
+ tier: "warn",
108
+ scopes: ["query", "publish", "team"],
109
+ description: 'Quoted secret name before `:` or `=` with a quoted value ("password": "...", \'api_key\' = \'...\'), the JSON and YAML form of the first row (tenjin-agent#296). Narrower than the first row on purpose, so the review-round-6 config keys stay clean: the name must END in the secret word (no `max_tokens`, `tokenizer`, `passwordHash`), and the value must be quoted and carry a letter and a digit (no `128000`, no `"include"`). A letters-only quoted password is an accepted miss.',
110
+ source: "tenjin (tenjin-agent#296)",
111
+ match: {
112
+ kind: "regex",
113
+ pattern: `(?<=["'])([A-Za-z0-9_-]*(?:API[_-]?KEY|SECRET|ACCESS[_-]?KEY|SUBSCRIPTION[_-]?KEY|PRIVATE[_-]?KEY|PASSW(?:OR)?D|TOKEN|CREDENTIALS?|AUTH[_-]?TOKEN))["'][ \\t]*[:=][ \\t]*("(?=[^"]*\\d)(?=[^"]*[A-Za-z])[^"]{6,}"|'(?=[^']*\\d)(?=[^']*[A-Za-z])[^']{6,}')`,
114
+ flags: "gi"
115
+ },
116
+ excerpt: {
117
+ kind: "custom",
118
+ handler: "labeledValue"
119
+ },
120
+ skip: {
121
+ handler: "nonLiteralValue"
122
+ }
123
+ },
124
+ {
125
+ id: "aws-access-key",
126
+ tier: "block",
127
+ scopes: ["query", "publish", "team"],
128
+ description: "AWS access key id (AKIA/ASIA/ABIA/ACCA/A3T prefixes).",
129
+ source: "gitleaks:aws-access-token",
130
+ match: {
131
+ kind: "regex",
132
+ pattern: "\\b(?:A3T[A-Z0-9]|AKIA|ASIA|ABIA|ACCA)[0-9A-Z]{16}\\b",
133
+ flags: "g"
134
+ },
135
+ excerpt: {
136
+ kind: "mask",
137
+ keep: 4
138
+ }
139
+ },
140
+ {
141
+ id: "jwt",
142
+ tier: "block",
143
+ scopes: ["query", "publish", "team"],
144
+ description: "JSON Web Token: three base64url segments whose header starts eyJ.",
145
+ source: "gitleaks:jwt",
146
+ match: {
147
+ kind: "regex",
148
+ pattern: "\\beyJ[A-Za-z0-9_-]{5,}\\.eyJ[A-Za-z0-9_-]{5,}\\.[A-Za-z0-9_-]{5,}\\b",
149
+ flags: "g"
150
+ },
151
+ excerpt: {
152
+ kind: "mask",
153
+ keep: 3
154
+ }
155
+ },
156
+ {
157
+ id: "github-token",
158
+ tier: "block",
159
+ scopes: ["query", "publish", "team"],
160
+ description: "GitHub classic PAT/OAuth/app/refresh token or fine-grained PAT (github_pat_).",
161
+ source: "gitleaks:github-pat + github-fine-grained-pat",
162
+ match: {
163
+ kind: "regex",
164
+ pattern: "\\b(?:gh[posru]_[0-9A-Za-z]{36}|github_pat_[0-9A-Za-z_]{82})\\b",
165
+ flags: "g"
166
+ },
167
+ excerpt: {
168
+ kind: "mask",
169
+ keep: 4
170
+ }
171
+ },
172
+ {
173
+ id: "slack-token",
174
+ tier: "block",
175
+ scopes: ["query", "publish", "team"],
176
+ description: "Slack bot/user/app/refresh/legacy token.",
177
+ source: "gitleaks:slack-*-token",
178
+ match: {
179
+ kind: "regex",
180
+ pattern: "\\bxox[baprs]-[0-9A-Za-z-]{10,}\\b",
181
+ flags: "g"
182
+ },
183
+ excerpt: {
184
+ kind: "mask",
185
+ keep: 5
186
+ }
187
+ },
188
+ {
189
+ id: "stripe-token",
190
+ tier: "block",
191
+ scopes: ["query", "publish", "team"],
192
+ description: "Stripe live or test secret/restricted key.",
193
+ source: "gitleaks:stripe-access-token",
194
+ match: {
195
+ kind: "regex",
196
+ pattern: "\\b[sr]k_(?:live|test)_[0-9A-Za-z]{10,99}\\b",
197
+ flags: "g"
198
+ },
199
+ excerpt: {
200
+ kind: "mask",
201
+ keep: 8
202
+ }
203
+ },
204
+ {
205
+ id: "anthropic-key",
206
+ tier: "block",
207
+ scopes: ["query", "publish", "team"],
208
+ description: "Anthropic API key (sk-ant-).",
209
+ source: "gitleaks:anthropic-api-key",
210
+ match: {
211
+ kind: "regex",
212
+ pattern: "\\bsk-ant-[0-9A-Za-z_-]{20,}\\b",
213
+ flags: "g"
214
+ },
215
+ excerpt: {
216
+ kind: "mask",
217
+ keep: 7
218
+ }
219
+ },
220
+ {
221
+ id: "openai-key",
222
+ tier: "block",
223
+ scopes: ["query", "publish", "team"],
224
+ description: "OpenAI key: classic sk- plus sk-proj-/sk-svcacct-/sk-admin-. The body must carry a digit so sk- kebab identifiers do not hard-block. Project, service-account and admin keys carry `_` and `-` throughout the body, so the prefixed branch takes the wider class and its own trailing guard; the bare branch keeps the digit requirement and its own guard. The guards live INSIDE each branch: a shared guard outside the alternation made a classic key followed by `-old` fail outright (review round 6).",
225
+ source: "gitleaks:openai-api-key",
226
+ match: {
227
+ kind: "regex",
228
+ pattern: "\\bsk-(?!ant-)(?:(?:proj|svcacct|admin)-[0-9A-Za-z_-]{20,}(?![0-9A-Za-z_-])|(?=[0-9A-Za-z]*[0-9])[0-9A-Za-z]{20,}(?![0-9A-Za-z]))",
229
+ flags: "g"
230
+ },
231
+ excerpt: {
232
+ kind: "mask",
233
+ keep: 3
234
+ }
235
+ },
236
+ {
237
+ id: "google-key",
238
+ tier: "block",
239
+ scopes: ["query", "publish", "team"],
240
+ description: "Google API key (AIza) or OAuth client secret (GOCSPX-).",
241
+ source: "gitleaks:gcp-api-key + gcp-oauth-client-secret",
242
+ match: {
243
+ kind: "regex",
244
+ pattern: "\\b(?:AIza[0-9A-Za-z_-]{35}|GOCSPX-[0-9A-Za-z_-]{20,})\\b",
245
+ flags: "g"
246
+ },
247
+ excerpt: {
248
+ kind: "custom",
249
+ handler: "googleKey"
250
+ }
251
+ },
252
+ {
253
+ id: "npm-token",
254
+ tier: "block",
255
+ scopes: ["query", "publish", "team"],
256
+ description: "npm access token.",
257
+ source: "gitleaks:npm-access-token",
258
+ match: {
259
+ kind: "regex",
260
+ pattern: "\\bnpm_[0-9A-Za-z]{36}\\b",
261
+ flags: "g"
262
+ },
263
+ excerpt: {
264
+ kind: "mask",
265
+ keep: 4
266
+ }
267
+ },
268
+ {
269
+ id: "supabase-token",
270
+ tier: "block",
271
+ scopes: ["query", "publish", "team"],
272
+ description: "Supabase personal access token (sbp_) or secret/publishable API key (sb_*_).",
273
+ source: "gitleaks:supabase-access-token",
274
+ match: {
275
+ kind: "regex",
276
+ pattern: "\\bsbp_[0-9a-f]{40}\\b|\\bsb_(?:secret|publishable)_[0-9A-Za-z_-]{20,}\\b",
277
+ flags: "g"
278
+ },
279
+ excerpt: {
280
+ kind: "mask",
281
+ keep: 4
282
+ }
283
+ },
284
+ {
285
+ id: "twilio-key",
286
+ tier: "block",
287
+ scopes: ["query", "publish", "team"],
288
+ description: "Twilio API key SID (SK + 32 lowercase hex).",
289
+ source: "gitleaks:twilio-api-key",
290
+ match: {
291
+ kind: "regex",
292
+ pattern: "\\bSK[0-9a-f]{32}\\b",
293
+ flags: "g"
294
+ },
295
+ excerpt: {
296
+ kind: "mask",
297
+ keep: 2
298
+ }
299
+ },
300
+ {
301
+ id: "sendgrid-token",
302
+ tier: "block",
303
+ scopes: ["query", "publish", "team"],
304
+ description: "SendGrid API key (SG.<id>.<secret>).",
305
+ source: "gitleaks:sendgrid-api-token",
306
+ match: {
307
+ kind: "regex",
308
+ pattern: "\\bSG\\.[0-9A-Za-z_-]{16,32}\\.[0-9A-Za-z_-]{16,64}\\b",
309
+ flags: "g"
310
+ },
311
+ excerpt: {
312
+ kind: "mask",
313
+ keep: 3
314
+ }
315
+ },
316
+ {
317
+ id: "huggingface-token",
318
+ tier: "block",
319
+ scopes: ["query", "publish", "team"],
320
+ description: "Hugging Face user access token (hf_).",
321
+ source: "gitleaks:huggingface-access-token",
322
+ match: {
323
+ kind: "regex",
324
+ pattern: "\\bhf_[0-9A-Za-z]{30,}\\b",
325
+ flags: "g"
326
+ },
327
+ excerpt: {
328
+ kind: "mask",
329
+ keep: 3
330
+ }
331
+ },
332
+ {
333
+ id: "vercel-token",
334
+ tier: "block",
335
+ scopes: ["query", "publish", "team"],
336
+ description: "Vercel Blob read/write store token.",
337
+ source: "tenjin (shape from the Vercel Blob docs)",
338
+ match: {
339
+ kind: "regex",
340
+ pattern: "\\bvercel_blob_[a-z]{2}_[0-9A-Za-z_]{24,}\\b",
341
+ flags: "g"
342
+ },
343
+ excerpt: {
344
+ kind: "mask",
345
+ keep: 12
346
+ }
347
+ },
348
+ {
349
+ id: "vercel-token",
350
+ tier: "block",
351
+ scopes: ["query", "publish", "team"],
352
+ description: "Vercel platform token (vcp_/vci_/vca_/vcr_/vck_ prefixes).",
353
+ source: "secretlint:@secretlint/secretlint-rule-vercel",
354
+ match: {
355
+ kind: "regex",
356
+ pattern: "\\b(?:vcp|vci|vca|vcr|vck)_[0-9A-Za-z]{20,60}(?![0-9A-Za-z])",
357
+ flags: "g"
358
+ },
359
+ excerpt: {
360
+ kind: "mask",
361
+ keep: 4
362
+ }
363
+ },
364
+ {
365
+ id: "notion-token",
366
+ tier: "block",
367
+ scopes: ["query", "publish", "team"],
368
+ description: "Notion integration token (ntn_).",
369
+ source: "secretlint:@secretlint/secretlint-rule-notion",
370
+ match: {
371
+ kind: "regex",
372
+ pattern: "\\bntn_[0-9]{11}[0-9A-Za-z]{35}(?![0-9A-Za-z])",
373
+ flags: "g"
374
+ },
375
+ excerpt: {
376
+ kind: "mask",
377
+ keep: 4
378
+ }
379
+ },
380
+ {
381
+ id: "linear-token",
382
+ tier: "block",
383
+ scopes: ["query", "publish", "team"],
384
+ description: "Linear API key (lin_api_).",
385
+ source: "secretlint:@secretlint/secretlint-rule-linear",
386
+ match: {
387
+ kind: "regex",
388
+ pattern: "\\blin_api_[0-9A-Za-z_]{32,128}(?![0-9A-Za-z_])",
389
+ flags: "g"
390
+ },
391
+ excerpt: {
392
+ kind: "mask",
393
+ keep: 8
394
+ }
395
+ },
396
+ {
397
+ id: "figma-token",
398
+ tier: "block",
399
+ scopes: ["query", "publish", "team"],
400
+ description: "Figma personal access token (figd_).",
401
+ source: "secretlint:@secretlint/secretlint-rule-figma",
402
+ match: {
403
+ kind: "regex",
404
+ pattern: "\\bfigd_[0-9A-Za-z_-]{40,200}(?![0-9A-Za-z_-])",
405
+ flags: "g"
406
+ },
407
+ excerpt: {
408
+ kind: "mask",
409
+ keep: 5
410
+ }
411
+ },
412
+ {
413
+ id: "gitlab-token",
414
+ tier: "block",
415
+ scopes: ["query", "publish", "team"],
416
+ description: "GitLab personal access token (glpat-).",
417
+ source: "secretlint:@secretlint/secretlint-rule-gitlab",
418
+ match: {
419
+ kind: "regex",
420
+ pattern: "\\bglpat-[0-9A-Za-z_-]{20,128}(?![0-9A-Za-z_-])",
421
+ flags: "g"
422
+ },
423
+ excerpt: {
424
+ kind: "mask",
425
+ keep: 6
426
+ }
427
+ },
428
+ {
429
+ id: "docker-token",
430
+ tier: "block",
431
+ scopes: ["query", "publish", "team"],
432
+ description: "Docker Hub personal access token (dckr_pat_).",
433
+ source: "secretlint:@secretlint/secretlint-rule-docker",
434
+ match: {
435
+ kind: "regex",
436
+ pattern: "\\bdckr_pat_[0-9A-Za-z_-]{27}(?![0-9A-Za-z_-])",
437
+ flags: "g"
438
+ },
439
+ excerpt: {
440
+ kind: "mask",
441
+ keep: 9
442
+ }
443
+ },
444
+ {
445
+ id: "cloudflare-token",
446
+ tier: "block",
447
+ scopes: ["query", "publish", "team"],
448
+ description: "Cloudflare API key or account/user token (cfk_/cfut_/cfat_).",
449
+ source: "secretlint:@secretlint/secretlint-rule-cloudflare",
450
+ match: {
451
+ kind: "regex",
452
+ pattern: "\\b(?:cfk|cfut|cfat)_[0-9A-Za-z]{40}[0-9a-f]{8}(?![0-9A-Za-z])",
453
+ flags: "g"
454
+ },
455
+ excerpt: {
456
+ kind: "mask",
457
+ keep: 4
458
+ }
459
+ },
460
+ {
461
+ id: "databricks-token",
462
+ tier: "block",
463
+ scopes: ["query", "publish", "team"],
464
+ description: "Databricks personal access token (dapi).",
465
+ source: "secretlint:@secretlint/secretlint-rule-databricks",
466
+ match: {
467
+ kind: "regex",
468
+ pattern: "\\bdapi[0-9A-Fa-f]{32}(?:-[0-9])?(?![0-9A-Fa-f])",
469
+ flags: "g"
470
+ },
471
+ excerpt: {
472
+ kind: "mask",
473
+ keep: 4
474
+ }
475
+ },
476
+ {
477
+ id: "openssh-private-key",
478
+ tier: "block",
479
+ scopes: ["query", "publish", "team"],
480
+ description: "OpenSSH private key body pasted without its PEM framing (base64 of the openssh-key-v1 magic).",
481
+ source: "gitleaks:private-key (framing-free variant)",
482
+ match: {
483
+ kind: "regex",
484
+ pattern: "\\bb3BlbnNzaC1rZXktdjEA[0-9A-Za-z+/=]{20,}",
485
+ flags: "g"
486
+ },
487
+ excerpt: {
488
+ kind: "mask",
489
+ keep: 8
490
+ }
491
+ },
492
+ {
493
+ id: "totp-uri",
494
+ tier: "block",
495
+ scopes: ["query", "publish", "team"],
496
+ description: "otpauth:// TOTP/HOTP provisioning URI; its secret= parameter is a live second factor.",
497
+ source: "tenjin (RFC-style otpauth key URI)",
498
+ match: {
499
+ kind: "regex",
500
+ pattern: "\\botpauth:\\/\\/[ht]otp\\/[^\\s\"'`<>)\\]]+",
501
+ flags: "gi"
502
+ },
503
+ excerpt: {
504
+ kind: "mask",
505
+ keep: 15
506
+ }
507
+ },
508
+ {
509
+ id: "db-connection-uri",
510
+ tier: "block",
511
+ scopes: ["query", "publish", "team"],
512
+ description: "Basic-auth style URI with an embedded password (scheme://user:pass@host), including database connection strings. The scheme run is length-bounded: unbounded, it backtracks quadratically across a transcript-length dotted-token line that never reaches ://. The user may be empty: `redis://:password@host` is the standard Redis form.",
513
+ source: "tenjin",
514
+ match: {
515
+ kind: "regex",
516
+ pattern: "\\b([a-z][a-z0-9+.-]{0,31}):\\/\\/([^\\s:@/]*):([^\\s@/]+)@([^\\s/:]+)",
517
+ flags: "gi"
518
+ },
519
+ excerpt: {
520
+ kind: "custom",
521
+ handler: "dbConnectionUri"
522
+ },
523
+ skip: {
524
+ handler: "exampleDbPassword"
525
+ }
526
+ },
527
+ {
528
+ id: "bearer-token",
529
+ tier: "block",
530
+ scopes: ["query", "publish", "team"],
531
+ description: "Authorization: Bearer header carrying a live token.",
532
+ source: "tenjin",
533
+ match: {
534
+ kind: "regex",
535
+ pattern: "\\bAuthorization:\\s*Bearer\\s+(\\S{8,})",
536
+ flags: "gi"
537
+ },
538
+ excerpt: {
539
+ kind: "custom",
540
+ handler: "bearerToken"
541
+ },
542
+ skip: {
543
+ handler: "placeholderGroup1"
544
+ }
545
+ },
546
+ {
547
+ id: "basic-auth-header",
548
+ tier: "warn",
549
+ scopes: ["query", "publish"],
550
+ description: "Authorization: Basic header: the base64 of user:password, under the entropy floor and on no vendor prefix (tenjin-agent#296). The header name is a bounded lookbehind behind a shape lookahead, so the mask keeps it, replaces the credential alone, and a whitespace run stays linear.",
551
+ source: "tenjin (tenjin-agent#296)",
552
+ match: {
553
+ kind: "regex",
554
+ pattern: "(?=[A-Za-z0-9+/]{8})(?<=\\bAuthorization:[ \\t]{0,16}Basic[ \\t]{1,16})[A-Za-z0-9+/]{8,}={0,2}(?![A-Za-z0-9+/=])",
555
+ flags: "gi"
556
+ },
557
+ excerpt: {
558
+ kind: "mask",
559
+ keep: 0
560
+ }
561
+ },
562
+ {
563
+ id: "curl-user-credential",
564
+ tier: "warn",
565
+ scopes: ["query", "publish"],
566
+ description: "curl -u / --user user:password on one command (tenjin-agent#296): the password is masked and the command and user kept. Anchored on `curl` within 200 characters of the flag on the same pipeline segment, so `docker run -u 1000:1000` never matches. A `$VAR`, a placeholder or a bare lowercase word is skipped as the assignment row skips it.",
567
+ source: "tenjin (tenjin-agent#296)",
568
+ match: {
569
+ kind: "regex",
570
+ pattern: `(\\bcurl\\b[^\\n|;&]{0,200}?[ \\t](?:-u|--user)(?:[ \\t]+|=)["']?[^\\s:"']{1,64}):([^\\s"']+)`,
571
+ flags: "g"
572
+ },
573
+ excerpt: {
574
+ kind: "custom",
575
+ handler: "labeledValue"
576
+ },
577
+ skip: {
578
+ handler: "nonLiteralValue"
579
+ }
580
+ },
581
+ {
582
+ id: "url-query-credential",
583
+ tier: "warn",
584
+ scopes: ["query", "publish"],
585
+ description: "Credential-named query parameter on a URL (?key=, &api_key=, ?token=, ?sig=, ?password=): the value is masked and the name kept. The value class stops at `&`, `#`, whitespace, quotes and brackets, so a value another row already replaced with `[redacted \u2026]` is not masked twice.",
586
+ source: "tenjin (tenjin-agent#388)",
587
+ match: {
588
+ kind: "regex",
589
+ pattern: `([?&](?:key|apikey|api_key|api-key|token|access_token|auth|secret|client_secret|sig|signature|password|pwd))=([^&#\\s"'<>\\[\\]]+)`,
590
+ flags: "gi"
591
+ },
592
+ excerpt: {
593
+ kind: "custom",
594
+ handler: "labeledValue"
595
+ }
596
+ },
597
+ {
598
+ id: "url-path-credential",
599
+ tier: "warn",
600
+ scopes: ["query", "publish"],
601
+ description: "A path segment of 24 or more [A-Za-z0-9_-] characters that mixes letters and digits, on an http(s) URL: the shape a webhook secret or a signed-link token takes. A CDN hash or a content id in a path masks too; in a query that costs one routing offer. Four exclusions, each from a measured miss: a segment with two hyphenated words (an article slug), a 40-hex git commit after a git path marker (/commit/, /commits/, /blob/, /tree/, /raw/, /compare/) or on a git host (github.com, gitlab.com, bitbucket.org, codeberg.org), since elsewhere a 40-hex segment is a node key (https://<name>.quiknode.pro/<40 hex>/), a 0x-prefixed 64-hex (the hex64 row already calls a 64-hex inside a URL a hash), a UUID, and a URL character class that stops at quotes, brackets and commas, so one match never spans two URLs in a JSON string. The segment must be whole (a `.` or `%` inside it is a filename or an encoded slug, not a token). The shape lookahead runs before the scheme lookbehind, and the lookbehind is bounded, so a line of short segments stays linear.",
602
+ source: "tenjin (tenjin-agent#388)",
603
+ match: {
604
+ kind: "regex",
605
+ pattern: "\\/(?=[\\w-]{24})(?<=\\bhttps?:\\/\\/[^\\s?#\"'`<>()\\[\\]{},]{1,2048}\\/)(?=[\\w-]*[A-Za-z])(?=[\\w-]*\\d)(?![\\w-]*?(?<![A-Za-z])[A-Za-z]{3,}-[A-Za-z]{3})(?!(?:0x[0-9a-f]{64}|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?![\\w-]))(?!(?=[0-9a-f]{40}(?![\\w-]))(?<=\\/(?:commit|commits|blob|tree|raw|compare)\\/|\\bhttps?:\\/\\/(?:www\\.)?(?:github\\.com|gitlab\\.com|bitbucket\\.org|codeberg\\.org)\\/[^\\s?#\"'`<>()\\[\\]{},]{0,2048}))[\\w-]{24,}(?=[.;:!]*(?:[\\/?#\\s\"'<>(),\\[\\]{}`]|$))",
606
+ flags: "gi"
607
+ },
608
+ excerpt: {
609
+ kind: "mask",
610
+ keep: 1
611
+ }
612
+ },
613
+ {
614
+ id: "bare-hex-key",
615
+ tier: "warn",
616
+ scopes: ["query", "publish"],
617
+ description: "64 hex with no 0x, the shape a private key takes when a tool exports it bare (tenjin-agent#388). A hash label within two tokens before it (tx, txn, txid, hash, sha, sha256, hmac, digest, commit, id, checksum, sig, signature, across markdown emphasis) or an http(s) URL around it makes it a hash and it is kept, the same downgrade the 0x form has. A 128-hex run (sha512) is not a 64-hex run and never matches.",
618
+ source: "tenjin (tenjin-agent#388)",
619
+ match: {
620
+ kind: "regex",
621
+ pattern: "(?<![0-9A-Za-z])[0-9a-fA-F]{64}(?![0-9A-Za-z])",
622
+ flags: "g"
623
+ },
624
+ excerpt: {
625
+ kind: "mask",
626
+ keep: 0
627
+ },
628
+ skip: {
629
+ handler: "hashLabelled"
630
+ }
631
+ },
632
+ {
633
+ id: "bare-hex-key",
634
+ tier: "warn",
635
+ scopes: ["query", "publish"],
636
+ description: "A 64-hex key split into two 32-hex halves by one space or one newline, with an optional 0x on the first half. Bounded to exactly two adjacent halves: a third 32-hex run before or after (a list of MD5 sums) keeps the whole list as written, and a hash label keeps it as for the row above.",
637
+ source: "tenjin (tenjin-agent#388)",
638
+ match: {
639
+ kind: "regex",
640
+ pattern: "(?<![0-9A-Za-z])(?<![0-9a-fA-F]{32}[ \\n])(?:0x)?[0-9a-fA-F]{32}[ \\n][0-9a-fA-F]{32}(?![0-9A-Za-z])(?![ \\n][0-9a-fA-F]{32})",
641
+ flags: "g"
642
+ },
643
+ excerpt: {
644
+ kind: "mask",
645
+ keep: 0
646
+ },
647
+ skip: {
648
+ handler: "hashLabelled"
649
+ }
650
+ },
651
+ {
652
+ id: "solana-secret-key",
653
+ tier: "warn",
654
+ scopes: ["query", "publish"],
655
+ description: "An 87 or 88 character base58 run: a Solana keypair's 64-byte secret key as a wallet exports it (tenjin-agent#388). A transaction signature has the same shape, so a tx or sig label before it or an http(s) URL around it keeps it, as for bare-hex-key. A 32-byte public key is 43 or 44 characters and never matches.",
656
+ source: "tenjin (tenjin-agent#388)",
657
+ match: {
658
+ kind: "regex",
659
+ pattern: "(?<![1-9A-HJ-NP-Za-km-z])[1-9A-HJ-NP-Za-km-z]{87,88}(?![1-9A-HJ-NP-Za-km-z])",
660
+ flags: "g"
661
+ },
662
+ excerpt: {
663
+ kind: "mask",
664
+ keep: 0
665
+ },
666
+ skip: {
667
+ handler: "hashLabelled"
668
+ }
669
+ },
670
+ {
671
+ id: "solana-secret-key",
672
+ tier: "warn",
673
+ scopes: ["query", "publish"],
674
+ description: "A JSON array of exactly 64 integers from 0 to 255: the solana-keygen keypair file.",
675
+ source: "tenjin (tenjin-agent#388)",
676
+ match: {
677
+ kind: "regex",
678
+ pattern: "\\[\\s*(?:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)\\s*,\\s*){63}(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)\\s*\\]",
679
+ flags: "g"
680
+ },
681
+ excerpt: {
682
+ kind: "mask",
683
+ keep: 1
684
+ }
685
+ },
686
+ {
687
+ id: "wallet-address",
688
+ tier: "warn",
689
+ scopes: ["publish"],
690
+ description: "EVM account/contract address (0x + 40 hex).",
691
+ source: "blockrun-mcp (wallet-key leak scanner)",
692
+ match: {
693
+ kind: "regex",
694
+ pattern: "(?<![0-9a-fx])0x[0-9a-fA-F]{40}(?![0-9a-fA-F])",
695
+ flags: "gi"
696
+ },
697
+ excerpt: {
698
+ kind: "abbreviate",
699
+ head: 6,
700
+ tail: 4
701
+ }
702
+ },
703
+ {
704
+ id: "confidential-marker",
705
+ tier: "warn",
706
+ scopes: ["publish"],
707
+ description: "Document classification legend (CONFIDENTIAL stamp, INTERNAL USE ONLY, DO NOT DISTRIBUTE). Case-sensitive: marker-shaped, not word-in-phrase.",
708
+ source: "tenjin",
709
+ match: {
710
+ kind: "regex",
711
+ pattern: "\\b(?:STRICTLY|COMPANY|HIGHLY)\\s+CONFIDENTIAL\\b|(?<![A-Z]{2,}[ \\t]+)\\bCONFIDENTIAL\\b|\\bCONFIDENTIAL\\b(?![ \\t]+[A-Z]{2,})|\\bConfidential(?=\\s*(?:[-:.,;\u2013\u2014]|$))|\\b(?:INTERNAL|Internal)(?:\\s+(?:USE|Use))?\\s+(?:ONLY|Only)\\b|\\b(?:DO\\s+NOT\\s+DISTRIBUTE|Do\\s+Not\\s+Distribute)\\b",
712
+ flags: "g"
713
+ },
714
+ excerpt: {
715
+ kind: "verbatim"
716
+ }
717
+ },
718
+ {
719
+ id: "internal-hostname",
720
+ tier: "warn",
721
+ scopes: ["publish"],
722
+ description: "Hostname on a private-use suffix (.internal, .corp, .local, .lan, .intranet). Label count and label length are bounded: an unbounded (label\\.)+ run is quadratic on a transcript-length line of dotted digits.",
723
+ source: "tenjin",
724
+ match: {
725
+ kind: "regex",
726
+ pattern: "\\b(?:[a-z0-9-]{1,63}\\.){1,6}(?:internal|corp|local|lan|intranet)\\b",
727
+ flags: "gi"
728
+ },
729
+ excerpt: {
730
+ kind: "verbatim"
731
+ }
732
+ },
733
+ {
734
+ id: "private-network-endpoint",
735
+ tier: "warn",
736
+ scopes: ["publish"],
737
+ description: "RFC1918 / link-local IPv4 endpoint (10/8, 172.16/12, 192.168/16, 169.254/16).",
738
+ source: "tenjin (closes tenjin-agent#45)",
739
+ match: {
740
+ kind: "regex",
741
+ pattern: "(?<![\\d.])(?:10\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)|172\\.(?:1[6-9]|2\\d|3[01])\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)|192\\.168\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)|169\\.254\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d))(?::\\d{2,5})?(?!\\.?\\d)",
742
+ flags: "g"
743
+ },
744
+ excerpt: {
745
+ kind: "verbatim"
746
+ }
747
+ },
748
+ {
749
+ id: "private-network-endpoint",
750
+ tier: "warn",
751
+ scopes: ["publish"],
752
+ description: "Loopback / wildcard-bind development endpoint. Scheme or port required so prose about localhost does not warn.",
753
+ source: "tenjin (closes tenjin-agent#45)",
754
+ match: {
755
+ kind: "regex",
756
+ pattern: "https?:\\/\\/(?:localhost|127\\.0\\.0\\.1|0\\.0\\.0\\.0|\\[::1\\])(?::\\d{2,5})?(?:\\/[^\\s\"'`<>?&)\\]]*)?|\\b(?:localhost|127\\.0\\.0\\.1|0\\.0\\.0\\.0):\\d{2,5}\\b",
757
+ flags: "gi"
758
+ },
759
+ excerpt: {
760
+ kind: "verbatim",
761
+ max: 80
762
+ }
763
+ },
764
+ {
765
+ id: "collaboration-url",
766
+ tier: "warn",
767
+ scopes: ["publish"],
768
+ description: "Link into a collaboration workspace (Google Docs/Drive, Notion, Figma, Slack archives, Linear, Jira/Confluence): the target is usually access-controlled.",
769
+ source: "tenjin (closes tenjin-agent#45)",
770
+ match: {
771
+ kind: "regex",
772
+ pattern: "https?:\\/\\/(?:docs\\.google\\.com|drive\\.google\\.com|(?:[a-z0-9-]+\\.)?notion\\.(?:so|site)|(?:www\\.)?figma\\.com|(?:[a-z0-9-]+\\.)?slack\\.com\\/archives|linear\\.app|[a-z0-9-]+\\.atlassian\\.net)(?:\\/[^\\s\"'`<>?&)\\]]*)?",
773
+ flags: "gi"
774
+ },
775
+ excerpt: {
776
+ kind: "verbatim",
777
+ max: 80
778
+ }
779
+ },
780
+ {
781
+ id: "cloud-resource-id",
782
+ tier: "warn",
783
+ scopes: ["publish"],
784
+ description: "AWS ARN: names an account, region, and resource.",
785
+ source: "tenjin (closes tenjin-agent#45)",
786
+ match: {
787
+ kind: "regex",
788
+ pattern: "\\barn:aws[0-9a-z-]*:[0-9a-z-]+:[0-9a-z-]*:\\d{0,12}:[^\\s\"'`<>,)\\]]+",
789
+ flags: "gi"
790
+ },
791
+ excerpt: {
792
+ kind: "verbatim",
793
+ max: 80
794
+ }
795
+ },
796
+ {
797
+ id: "cloud-resource-id",
798
+ tier: "warn",
799
+ scopes: ["publish"],
800
+ description: "GCP fully-qualified resource name (projects/<id>/<collection>/<name>).",
801
+ source: "tenjin (closes tenjin-agent#45)",
802
+ match: {
803
+ kind: "regex",
804
+ pattern: "\\bprojects\\/[a-z][a-z0-9-]{4,28}[a-z0-9]\\/(?:locations|topics|subscriptions|secrets|instances|serviceAccounts|datasets|buckets|zones|keyRings|clusters|jobs|models)\\/[^\\s\"'`<>,)\\]]+",
805
+ flags: "g"
806
+ },
807
+ excerpt: {
808
+ kind: "verbatim",
809
+ max: 80
810
+ }
811
+ },
812
+ {
813
+ id: "cloud-resource-id",
814
+ tier: "warn",
815
+ scopes: ["publish"],
816
+ description: "Azure resource id: /subscriptions/<guid>/resourceGroups/<name>/...",
817
+ source: "tenjin (closes tenjin-agent#45)",
818
+ match: {
819
+ kind: "regex",
820
+ pattern: "\\/subscriptions\\/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}\\/resourceGroups\\/[^\\s\"'`<>,)\\]/]+(?:\\/[^\\s\"'`<>,)\\]]*)?",
821
+ flags: "g"
822
+ },
823
+ excerpt: {
824
+ kind: "verbatim",
825
+ max: 80
826
+ }
827
+ },
828
+ {
829
+ id: "cloud-resource-id",
830
+ tier: "warn",
831
+ scopes: ["publish"],
832
+ description: "Cloud object-storage location (s3://, gs://, or an S3/Azure Blob/GCS bucket hostname).",
833
+ source: "tenjin (closes tenjin-agent#45)",
834
+ match: {
835
+ kind: "regex",
836
+ pattern: "\\b(?:s3|gs):\\/\\/[a-z0-9][a-z0-9._-]{2,62}(?:\\/[^\\s\"'`<>,?&)\\]]*)?|\\b[a-z0-9][a-z0-9.-]{1,62}\\.(?:s3(?:[.-][a-z0-9-]+)?\\.amazonaws\\.com|blob\\.core\\.windows\\.net|storage\\.googleapis\\.com)\\b",
837
+ flags: "gi"
838
+ },
839
+ excerpt: {
840
+ kind: "verbatim",
841
+ max: 80
842
+ }
843
+ },
844
+ {
845
+ id: "local-path",
846
+ tier: "warn",
847
+ scopes: ["publish"],
848
+ description: "Home-anchored local filesystem path: leaks the machine username and private project layout.",
849
+ source: "tenjin",
850
+ match: {
851
+ kind: "regex",
852
+ pattern: `(?:(?<![\\w.-])\\/(?:Users|home)\\/([A-Za-z0-9._-]+)(?:\\/[^\\s"'\`)\\]}>:,;?&/]+)+|\\b[A-Za-z]:\\\\[Uu]sers\\\\([^\\\\\\s"']+)(?:\\\\[^\\\\\\s"']+)+)`,
853
+ flags: "dg"
854
+ },
855
+ excerpt: {
856
+ kind: "custom",
857
+ handler: "localPath"
858
+ },
859
+ skip: {
860
+ handler: "placeholderUsername"
861
+ }
862
+ },
863
+ {
864
+ id: "customer-identifier",
865
+ tier: "warn",
866
+ scopes: ["publish"],
867
+ description: "Labeled customer/account/tenant identifier with a literal value.",
868
+ source: "tenjin",
869
+ match: {
870
+ kind: "regex",
871
+ pattern: `\\b((?:customer|client|account|tenant|subscriber)[ _-]?(?:id|number|no))\\b\\s*[:=#]\\s*("[^"]{2,}"|'[^']{2,}'|[A-Za-z0-9][A-Za-z0-9._-]{2,})`,
872
+ flags: "gi"
873
+ },
874
+ excerpt: {
875
+ kind: "custom",
876
+ handler: "labeledValue"
877
+ },
878
+ skip: {
879
+ handler: "nonLiteralValue"
880
+ }
881
+ },
882
+ {
883
+ id: "paid-content-marker",
884
+ tier: "warn",
885
+ scopes: ["publish"],
886
+ description: "Third-party rights legend suggesting copied licensed material. Legend shapes only: bare paywall vocabulary is this marketplace\u2019s own subject matter.",
887
+ source: "tenjin",
888
+ match: {
889
+ kind: "regex",
890
+ pattern: "\\ball rights reserved\\b|\\b(?:reprinted|reproduced|used) with permission\\b|\\bnot for (?:redistribution|republication)\\b|\\bdo not (?:redistribute|republish)\\b|(?:\xA9|\\(c\\)|copyright)\\s*(?:19|20)\\d{2}\\b",
891
+ flags: "gi"
892
+ },
893
+ excerpt: {
894
+ kind: "verbatim"
895
+ }
896
+ },
897
+ {
898
+ id: "embedded-instruction",
899
+ tier: "warn",
900
+ scopes: ["publish"],
901
+ description: "Injection-shaped imperative captured from a prompt or tool output.",
902
+ source: "tenjin",
903
+ match: {
904
+ kind: "regex",
905
+ pattern: "\\b(?:ignore|disregard|forget)\\s+(?:all\\s+|any\\s+)?(?:previous|prior|above|earlier|preceding)\\s+(?:instructions?|prompts?|context|messages?)\\b|\\bdo not (?:reveal|disclose|mention) (?:this|these|the above)\\b",
906
+ flags: "gi"
907
+ },
908
+ excerpt: {
909
+ kind: "verbatim"
910
+ }
911
+ },
912
+ {
913
+ id: "embedded-instruction",
914
+ tier: "warn",
915
+ scopes: ["publish"],
916
+ description: "Hidden-prompt document header. Case-sensitive: the all-caps header form is the injection-typed one.",
917
+ source: "tenjin",
918
+ match: {
919
+ kind: "regex",
920
+ pattern: "\\bBEGIN (?:SYSTEM|HIDDEN) (?:PROMPT|INSTRUCTIONS)\\b",
921
+ flags: "g"
922
+ },
923
+ excerpt: {
924
+ kind: "verbatim"
925
+ }
926
+ },
927
+ {
928
+ id: "email",
929
+ tier: "warn",
930
+ scopes: ["publish"],
931
+ description: "Email address (PII), subsuming corporate-domain addresses. Lengths follow the RFC limits so the local part and the domain cannot backtrack against each other: unbounded, the pair is quadratic on a transcript-length line.",
932
+ source: "tenjin",
933
+ match: {
934
+ kind: "regex",
935
+ pattern: "\\b[A-Za-z0-9._%+-]{1,64}@(?:[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?\\.){1,8}[A-Za-z]{2,24}\\b",
936
+ flags: "g"
937
+ },
938
+ excerpt: {
939
+ kind: "verbatim"
940
+ },
941
+ skip: {
942
+ handler: "reservedExampleEmail"
943
+ }
944
+ },
945
+ {
946
+ id: "phone",
947
+ tier: "warn",
948
+ scopes: ["publish"],
949
+ description: "Telephone number (PII).",
950
+ source: "tenjin",
951
+ match: {
952
+ kind: "regex",
953
+ pattern: "(?<!\\d)(?:\\+?\\d{1,2}[\\s.-]?)?(?:\\(\\d{3}\\)|\\d{3})[\\s.-]\\d{3}[\\s.-]\\d{4}(?!\\d)",
954
+ flags: "g"
955
+ },
956
+ excerpt: {
957
+ kind: "verbatim"
958
+ }
959
+ },
960
+ {
961
+ id: "raw-private-key",
962
+ tier: "block",
963
+ scopes: ["query", "publish", "team"],
964
+ description: "0x + 64 hex with no hash context. Demoted to the warn detector hex32-value when a hash/identifier label precedes it (within two intervening tokens, across markdown and quote punctuation), when it sits inside an http(s) URL, or when it is one of the publicHexConstants below. An unlabeled bare 64-hex stays block: that is the floor.",
965
+ source: "blockrun-mcp (wallet-key leak scanner)",
966
+ match: {
967
+ kind: "algorithm",
968
+ algorithm: "hex64"
969
+ },
970
+ excerpt: {
971
+ kind: "custom",
972
+ handler: "hex64"
973
+ }
974
+ },
975
+ {
976
+ id: "pem-private-key",
977
+ tier: "block",
978
+ scopes: ["query", "publish", "team"],
979
+ description: "PEM private-key armor (-----BEGIN ... PRIVATE KEY-----), RSA/EC/OPENSSH/PGP variants.",
980
+ source: "gitleaks:private-key",
981
+ match: {
982
+ kind: "algorithm",
983
+ algorithm: "pemBlock"
984
+ },
985
+ excerpt: {
986
+ kind: "custom",
987
+ handler: "pemBlock"
988
+ }
989
+ },
990
+ {
991
+ id: "bip39-seed-phrase",
992
+ tier: "block",
993
+ scopes: ["query", "publish", "team"],
994
+ description: 'Twelve or more consecutive BIP-39 English wordlist words separated only by whitespace or quote characters, so a quoted `.env` value (MNEMONIC="abandon ... about") counts (tenjin-agent#296): a wallet recovery phrase.',
995
+ source: "tenjin; wordlist from BIP-0039 (see NOTICE.md)",
996
+ match: {
997
+ kind: "algorithm",
998
+ algorithm: "bip39"
999
+ },
1000
+ excerpt: {
1001
+ kind: "custom",
1002
+ handler: "bip39"
1003
+ }
1004
+ },
1005
+ {
1006
+ id: "env-dump-block",
1007
+ tier: "warn",
1008
+ scopes: ["publish"],
1009
+ description: "Three or more consecutive SHOUTY_KEY=value lines carrying at least one substantial literal: a pasted .env file.",
1010
+ source: "tenjin",
1011
+ match: {
1012
+ kind: "algorithm",
1013
+ algorithm: "envDump"
1014
+ },
1015
+ excerpt: {
1016
+ kind: "custom",
1017
+ handler: "envDump"
1018
+ }
1019
+ },
1020
+ {
1021
+ id: "high-entropy-string",
1022
+ tier: "warn",
1023
+ scopes: ["publish"],
1024
+ description: "Catch-all for unknown credential formats: a long mixed-case alphanumeric token whose Shannon entropy and case-run profile match random key material rather than an identifier.",
1025
+ source: "tenjin (entropy heuristic in the spirit of gitleaks entropy gating)",
1026
+ match: {
1027
+ kind: "algorithm",
1028
+ algorithm: "entropy"
1029
+ },
1030
+ excerpt: {
1031
+ kind: "custom",
1032
+ handler: "entropy"
1033
+ }
1034
+ },
1035
+ {
1036
+ id: "long-verbatim-quote",
1037
+ tier: "warn",
1038
+ scopes: ["publish"],
1039
+ description: "Fenced block or blockquote run long enough to read as copied third-party material.",
1040
+ source: "tenjin",
1041
+ match: {
1042
+ kind: "algorithm",
1043
+ algorithm: "longVerbatim"
1044
+ },
1045
+ excerpt: {
1046
+ kind: "custom",
1047
+ handler: "longVerbatim"
1048
+ }
1049
+ }
1050
+ ]
1051
+ };
1052
+
1053
+ // src/lib/bip39-wordlist.json
1054
+ var bip39_wordlist_default = {
1055
+ source: "BIP-0039 English wordlist (bitcoin/bips), as distributed by @scure/bip39 (MIT). Vendored as data, not as a dependency: see NOTICE.md.",
1056
+ count: 2048,
1057
+ words: "abandon ability able about above absent absorb abstract absurd abuse access accident account accuse achieve acid acoustic acquire across act action actor actress actual adapt add addict address adjust admit adult advance advice aerobic affair afford afraid again age agent agree ahead aim air airport aisle alarm album alcohol alert alien all alley allow almost alone alpha already also alter always amateur amazing among amount amused analyst anchor ancient anger angle angry animal ankle announce annual another answer antenna antique anxiety any apart apology appear apple approve april arch arctic area arena argue arm armed armor army around arrange arrest arrive arrow art artefact artist artwork ask aspect assault asset assist assume asthma athlete atom attack attend attitude attract auction audit august aunt author auto autumn average avocado avoid awake aware away awesome awful awkward axis baby bachelor bacon badge bag balance balcony ball bamboo banana banner bar barely bargain barrel base basic basket battle beach bean beauty because become beef before begin behave behind believe below belt bench benefit best betray better between beyond bicycle bid bike bind biology bird birth bitter black blade blame blanket blast bleak bless blind blood blossom blouse blue blur blush board boat body boil bomb bone bonus book boost border boring borrow boss bottom bounce box boy bracket brain brand brass brave bread breeze brick bridge brief bright bring brisk broccoli broken bronze broom brother brown brush bubble buddy budget buffalo build bulb bulk bullet bundle bunker burden burger burst bus business busy butter buyer buzz cabbage cabin cable cactus cage cake call calm camera camp can canal cancel candy cannon canoe canvas canyon capable capital captain car carbon card cargo carpet carry cart case cash casino castle casual cat catalog catch category cattle caught cause caution cave ceiling celery cement census century cereal certain chair chalk champion change chaos chapter charge chase chat cheap check cheese chef cherry chest chicken chief child chimney choice choose chronic chuckle chunk churn cigar cinnamon circle citizen city civil claim clap clarify claw clay clean clerk clever click client cliff climb clinic clip clock clog close cloth cloud clown club clump cluster clutch coach coast coconut code coffee coil coin collect color column combine come comfort comic common company concert conduct confirm congress connect consider control convince cook cool copper copy coral core corn correct cost cotton couch country couple course cousin cover coyote crack cradle craft cram crane crash crater crawl crazy cream credit creek crew cricket crime crisp critic crop cross crouch crowd crucial cruel cruise crumble crunch crush cry crystal cube culture cup cupboard curious current curtain curve cushion custom cute cycle dad damage damp dance danger daring dash daughter dawn day deal debate debris decade december decide decline decorate decrease deer defense define defy degree delay deliver demand demise denial dentist deny depart depend deposit depth deputy derive describe desert design desk despair destroy detail detect develop device devote diagram dial diamond diary dice diesel diet differ digital dignity dilemma dinner dinosaur direct dirt disagree discover disease dish dismiss disorder display distance divert divide divorce dizzy doctor document dog doll dolphin domain donate donkey donor door dose double dove draft dragon drama drastic draw dream dress drift drill drink drip drive drop drum dry duck dumb dune during dust dutch duty dwarf dynamic eager eagle early earn earth easily east easy echo ecology economy edge edit educate effort egg eight either elbow elder electric elegant element elephant elevator elite else embark embody embrace emerge emotion employ empower empty enable enact end endless endorse enemy energy enforce engage engine enhance enjoy enlist enough enrich enroll ensure enter entire entry envelope episode equal equip era erase erode erosion error erupt escape essay essence estate eternal ethics evidence evil evoke evolve exact example excess exchange excite exclude excuse execute exercise exhaust exhibit exile exist exit exotic expand expect expire explain expose express extend extra eye eyebrow fabric face faculty fade faint faith fall false fame family famous fan fancy fantasy farm fashion fat fatal father fatigue fault favorite feature february federal fee feed feel female fence festival fetch fever few fiber fiction field figure file film filter final find fine finger finish fire firm first fiscal fish fit fitness fix flag flame flash flat flavor flee flight flip float flock floor flower fluid flush fly foam focus fog foil fold follow food foot force forest forget fork fortune forum forward fossil foster found fox fragile frame frequent fresh friend fringe frog front frost frown frozen fruit fuel fun funny furnace fury future gadget gain galaxy gallery game gap garage garbage garden garlic garment gas gasp gate gather gauge gaze general genius genre gentle genuine gesture ghost giant gift giggle ginger giraffe girl give glad glance glare glass glide glimpse globe gloom glory glove glow glue goat goddess gold good goose gorilla gospel gossip govern gown grab grace grain grant grape grass gravity great green grid grief grit grocery group grow grunt guard guess guide guilt guitar gun gym habit hair half hammer hamster hand happy harbor hard harsh harvest hat have hawk hazard head health heart heavy hedgehog height hello helmet help hen hero hidden high hill hint hip hire history hobby hockey hold hole holiday hollow home honey hood hope horn horror horse hospital host hotel hour hover hub huge human humble humor hundred hungry hunt hurdle hurry hurt husband hybrid ice icon idea identify idle ignore ill illegal illness image imitate immense immune impact impose improve impulse inch include income increase index indicate indoor industry infant inflict inform inhale inherit initial inject injury inmate inner innocent input inquiry insane insect inside inspire install intact interest into invest invite involve iron island isolate issue item ivory jacket jaguar jar jazz jealous jeans jelly jewel job join joke journey joy judge juice jump jungle junior junk just kangaroo keen keep ketchup key kick kid kidney kind kingdom kiss kit kitchen kite kitten kiwi knee knife knock know lab label labor ladder lady lake lamp language laptop large later latin laugh laundry lava law lawn lawsuit layer lazy leader leaf learn leave lecture left leg legal legend leisure lemon lend length lens leopard lesson letter level liar liberty library license life lift light like limb limit link lion liquid list little live lizard load loan lobster local lock logic lonely long loop lottery loud lounge love loyal lucky luggage lumber lunar lunch luxury lyrics machine mad magic magnet maid mail main major make mammal man manage mandate mango mansion manual maple marble march margin marine market marriage mask mass master match material math matrix matter maximum maze meadow mean measure meat mechanic medal media melody melt member memory mention menu mercy merge merit merry mesh message metal method middle midnight milk million mimic mind minimum minor minute miracle mirror misery miss mistake mix mixed mixture mobile model modify mom moment monitor monkey monster month moon moral more morning mosquito mother motion motor mountain mouse move movie much muffin mule multiply muscle museum mushroom music must mutual myself mystery myth naive name napkin narrow nasty nation nature near neck need negative neglect neither nephew nerve nest net network neutral never news next nice night noble noise nominee noodle normal north nose notable note nothing notice novel now nuclear number nurse nut oak obey object oblige obscure observe obtain obvious occur ocean october odor off offer office often oil okay old olive olympic omit once one onion online only open opera opinion oppose option orange orbit orchard order ordinary organ orient original orphan ostrich other outdoor outer output outside oval oven over own owner oxygen oyster ozone pact paddle page pair palace palm panda panel panic panther paper parade parent park parrot party pass patch path patient patrol pattern pause pave payment peace peanut pear peasant pelican pen penalty pencil people pepper perfect permit person pet phone photo phrase physical piano picnic picture piece pig pigeon pill pilot pink pioneer pipe pistol pitch pizza place planet plastic plate play please pledge pluck plug plunge poem poet point polar pole police pond pony pool popular portion position possible post potato pottery poverty powder power practice praise predict prefer prepare present pretty prevent price pride primary print priority prison private prize problem process produce profit program project promote proof property prosper protect proud provide public pudding pull pulp pulse pumpkin punch pupil puppy purchase purity purpose purse push put puzzle pyramid quality quantum quarter question quick quit quiz quote rabbit raccoon race rack radar radio rail rain raise rally ramp ranch random range rapid rare rate rather raven raw razor ready real reason rebel rebuild recall receive recipe record recycle reduce reflect reform refuse region regret regular reject relax release relief rely remain remember remind remove render renew rent reopen repair repeat replace report require rescue resemble resist resource response result retire retreat return reunion reveal review reward rhythm rib ribbon rice rich ride ridge rifle right rigid ring riot ripple risk ritual rival river road roast robot robust rocket romance roof rookie room rose rotate rough round route royal rubber rude rug rule run runway rural sad saddle sadness safe sail salad salmon salon salt salute same sample sand satisfy satoshi sauce sausage save say scale scan scare scatter scene scheme school science scissors scorpion scout scrap screen script scrub sea search season seat second secret section security seed seek segment select sell seminar senior sense sentence series service session settle setup seven shadow shaft shallow share shed shell sheriff shield shift shine ship shiver shock shoe shoot shop short shoulder shove shrimp shrug shuffle shy sibling sick side siege sight sign silent silk silly silver similar simple since sing siren sister situate six size skate sketch ski skill skin skirt skull slab slam sleep slender slice slide slight slim slogan slot slow slush small smart smile smoke smooth snack snake snap sniff snow soap soccer social sock soda soft solar soldier solid solution solve someone song soon sorry sort soul sound soup source south space spare spatial spawn speak special speed spell spend sphere spice spider spike spin spirit split spoil sponsor spoon sport spot spray spread spring spy square squeeze squirrel stable stadium staff stage stairs stamp stand start state stay steak steel stem step stereo stick still sting stock stomach stone stool story stove strategy street strike strong struggle student stuff stumble style subject submit subway success such sudden suffer sugar suggest suit summer sun sunny sunset super supply supreme sure surface surge surprise surround survey suspect sustain swallow swamp swap swarm swear sweet swift swim swing switch sword symbol symptom syrup system table tackle tag tail talent talk tank tape target task taste tattoo taxi teach team tell ten tenant tennis tent term test text thank that theme then theory there they thing this thought three thrive throw thumb thunder ticket tide tiger tilt timber time tiny tip tired tissue title toast tobacco today toddler toe together toilet token tomato tomorrow tone tongue tonight tool tooth top topic topple torch tornado tortoise toss total tourist toward tower town toy track trade traffic tragic train transfer trap trash travel tray treat tree trend trial tribe trick trigger trim trip trophy trouble truck true truly trumpet trust truth try tube tuition tumble tuna tunnel turkey turn turtle twelve twenty twice twin twist two type typical ugly umbrella unable unaware uncle uncover under undo unfair unfold unhappy uniform unique unit universe unknown unlock until unusual unveil update upgrade uphold upon upper upset urban urge usage use used useful useless usual utility vacant vacuum vague valid valley valve van vanish vapor various vast vault vehicle velvet vendor venture venue verb verify version very vessel veteran viable vibrant vicious victory video view village vintage violin virtual virus visa visit visual vital vivid vocal voice void volcano volume vote voyage wage wagon wait walk wall walnut want warfare warm warrior wash wasp waste water wave way wealth weapon wear weasel weather web wedding weekend weird welcome west wet whale what wheat wheel when where whip whisper wide width wife wild will win window wine wing wink winner winter wire wisdom wise wish witness wolf woman wonder wood wool word work world worry worth wrap wreck wrestle wrist write wrong yard year yellow you young youth zebra zero zone zoo"
1058
+ };
1059
+
1060
+ // src/lib/redact.ts
1061
+ var LONG_QUOTE_WORDS = 80;
1062
+ function findings(text, scope) {
1063
+ const lines = text.split("\n");
1064
+ const found = [
1065
+ ...scanHex64(lines),
1066
+ ...scanLineDetectors(lines),
1067
+ ...scanPemBlocks(lines),
1068
+ ...scanSeedPhrases(lines),
1069
+ ...scanEnvDumpBlocks(lines),
1070
+ ...scanLongVerbatim(lines)
1071
+ ];
1072
+ const named = dedupeAndSort(suppressEmailsInDbUris(found));
1073
+ const all = dedupeAndSort([...named, ...scanHighEntropy(lines, named)]);
1074
+ if (scope === "publish") return all;
1075
+ const keep = CHECKS[scope];
1076
+ return all.filter((f) => keep.has(f.check));
1077
+ }
1078
+ function mask(text) {
1079
+ let out = text.replace(/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g, "");
1080
+ for (const detector of MASK_DETECTORS) {
1081
+ out = out.replace(detector.re, (...args) => {
1082
+ const tail = typeof args.at(-1) === "object" ? 3 : 2;
1083
+ const m = Object.assign(args.slice(0, -tail), {
1084
+ index: args.at(-tail),
1085
+ input: args.at(-tail + 1)
1086
+ });
1087
+ return detector.skip?.(m) === true ? m[0] : detector.excerpt(m);
1088
+ });
1089
+ }
1090
+ if (MASKED_ALGORITHMS.has("hex64") || MASKED_ALGORITHMS.has("bip39")) {
1091
+ out = out.split("\n").map(maskLineSpans).join("\n");
1092
+ }
1093
+ if (MASKED_ALGORITHMS.has("bip39")) out = maskLooseMnemonics(out);
1094
+ return MASKED_ALGORITHMS.has("pemBlock") ? maskPemBlocks(out) : out;
1095
+ }
1096
+ function maskLineSpans(line) {
1097
+ const lines = [line];
1098
+ const spans = [
1099
+ ...MASKED_ALGORITHMS.has("hex64") ? scanHex64(lines) : [],
1100
+ ...MASKED_ALGORITHMS.has("bip39") ? scanSeedPhrases(lines) : []
1101
+ ].filter((f) => f.check !== "hex32-value").filter(
1102
+ (f) => f.check !== "bip39-seed-phrase" || line.slice(f.span[0], f.span[1]).split(/[\s"'`]+/).length <= SEED_PHRASE_MAX_WORDS
1103
+ ).sort((a, b) => a.span[0] - b.span[0]);
1104
+ if (spans.length === 0) return line;
1105
+ const parts = [];
1106
+ let cursor = 0;
1107
+ for (const f of spans) {
1108
+ if (f.span[0] < cursor) continue;
1109
+ parts.push(line.slice(cursor, f.span[0]), f.excerpt);
1110
+ cursor = f.span[1];
1111
+ }
1112
+ parts.push(line.slice(cursor));
1113
+ return parts.join("");
1114
+ }
1115
+ function maskPemBlocks(text) {
1116
+ let out = "";
1117
+ let rest = text;
1118
+ for (; ; ) {
1119
+ const begin = PEM_BEGIN.exec(rest);
1120
+ if (begin === null) return out + rest;
1121
+ const body = begin.index + begin[0].length;
1122
+ const end = PEM_END.exec(rest.slice(body));
1123
+ const stop = end === null ? rest.length : body + end.index + end[0].length;
1124
+ out += rest.slice(0, begin.index) + maskKeeping(rest.slice(begin.index, stop), begin[0].length);
1125
+ rest = rest.slice(stop);
1126
+ }
1127
+ }
1128
+ var SCOPES = /* @__PURE__ */ new Set(["query", "publish", "team"]);
1129
+ var CORPUS = redact_rules_default;
1130
+ var ALGORITHMS = /* @__PURE__ */ new Set(["hex64", "pemBlock", "bip39", "envDump", "entropy", "longVerbatim"]);
1131
+ var MASKABLE_ALGORITHMS = /* @__PURE__ */ new Set(["hex64", "pemBlock", "bip39"]);
1132
+ var EXCERPT_HANDLERS = {
1133
+ googleKey: (m) => maskKeeping(m[0], m[0].startsWith("AIza") ? 4 : 7),
1134
+ dbConnectionUri: (m) => `${m[1]}://${m[2]}:[redacted]@${m[4]}`,
1135
+ bearerToken: (m) => `Authorization: Bearer [redacted ${m[1]?.length ?? 0} chars]`,
1136
+ labeledValue: (m) => `${m[1]}=[redacted ${dequote(m[2] ?? "").length} chars]`,
1137
+ localPath: localPathExcerpt
1138
+ };
1139
+ var SKIP_HANDLERS = {
1140
+ exampleDbPassword: (m) => isPlaceholder(m[3] ?? "") || isExamplePassword(m[3] ?? ""),
1141
+ placeholderGroup1: (m) => isPlaceholder(m[1] ?? ""),
1142
+ nonLiteralValue: skipNonLiteralValue,
1143
+ placeholderUsername: (m) => PLACEHOLDER_USERNAME.test(m[1] ?? m[2] ?? ""),
1144
+ reservedExampleEmail: (m) => RESERVED_EXAMPLE_DOMAIN.test(m[0]),
1145
+ hashLabelled: isLabelledHash
1146
+ };
1147
+ function validateScopes(rule) {
1148
+ if (!Array.isArray(rule.scopes) || rule.scopes.length === 0) {
1149
+ throw new Error(`redact-rules.json: rule ${rule.id} has no scopes`);
1150
+ }
1151
+ for (const scope of rule.scopes) {
1152
+ if (!SCOPES.has(scope))
1153
+ throw new Error(`redact-rules.json: rule ${rule.id} names unknown scope ${scope}`);
1154
+ }
1155
+ if (rule.tier !== "block" && rule.tier !== "warn") {
1156
+ throw new Error(`redact-rules.json: rule ${rule.id} has unknown tier ${String(rule.tier)}`);
1157
+ }
1158
+ if (!rule.scopes.includes("publish")) {
1159
+ throw new Error(`redact-rules.json: rule ${rule.id} reports for team but not publish`);
1160
+ }
1161
+ if (rule.tier === "block" && !rule.scopes.includes("team")) {
1162
+ throw new Error(`redact-rules.json: block rule ${rule.id} must be scoped to team as well`);
1163
+ }
1164
+ const maskable = rule.match.kind === "regex" || rule.match.kind === "algorithm" && MASKABLE_ALGORITHMS.has(rule.match.algorithm ?? "");
1165
+ if (rule.scopes.includes("query") && !maskable) {
1166
+ throw new Error(
1167
+ `redact-rules.json: rule ${rule.id} is masked in queries but mask() cannot apply it`
1168
+ );
1169
+ }
1170
+ }
1171
+ function compileSkip(rule) {
1172
+ const skip = rule.skip === void 0 ? void 0 : SKIP_HANDLERS[rule.skip.handler];
1173
+ if (rule.skip !== void 0 && skip === void 0) {
1174
+ throw new Error(`redact-rules.json: rule ${rule.id} names unknown skip ${rule.skip.handler}`);
1175
+ }
1176
+ return skip;
1177
+ }
1178
+ function compileRegex(rule) {
1179
+ if (rule.match.kind !== "regex" || rule.match.pattern === void 0) {
1180
+ throw new Error(`redact-rules.json: rule ${rule.id} has unknown match kind ${rule.match.kind}`);
1181
+ }
1182
+ return new RegExp(rule.match.pattern, rule.match.flags ?? "g");
1183
+ }
1184
+ function compileLineDetectors(rules) {
1185
+ const out = [];
1186
+ for (const rule of rules) {
1187
+ if (rule.match.kind === "algorithm") continue;
1188
+ out.push({
1189
+ check: rule.id,
1190
+ severity: rule.tier,
1191
+ scopes: new Set(rule.scopes),
1192
+ re: compileRegex(rule),
1193
+ excerpt: compileExcerpt(rule),
1194
+ skip: compileSkip(rule)
1195
+ });
1196
+ }
1197
+ return out;
1198
+ }
1199
+ function validateCorpus(rules) {
1200
+ for (const rule of rules) {
1201
+ validateScopes(rule);
1202
+ if (rule.match.kind === "algorithm") {
1203
+ if (!ALGORITHMS.has(rule.match.algorithm ?? "")) {
1204
+ throw new Error(`redact-rules.json: rule ${rule.id} names unknown algorithm`);
1205
+ }
1206
+ continue;
1207
+ }
1208
+ compileRegex(rule);
1209
+ }
1210
+ for (const algorithm of ALGORITHMS) {
1211
+ const rows = rules.filter(
1212
+ (r) => r.match.kind === "algorithm" && r.match.algorithm === algorithm
1213
+ );
1214
+ if (rows.length !== 1) {
1215
+ throw new Error(
1216
+ `redact-rules.json: algorithm ${algorithm} has ${rows.length} rows, needs exactly one`
1217
+ );
1218
+ }
1219
+ }
1220
+ }
1221
+ function compileExcerpt(rule) {
1222
+ const policy = rule.excerpt;
1223
+ switch (policy.kind) {
1224
+ case "mask": {
1225
+ const keep = policy.keep ?? 0;
1226
+ return (m) => maskKeeping(m[0], keep);
1227
+ }
1228
+ case "verbatim": {
1229
+ const max = policy.max;
1230
+ return (m) => max === void 0 ? m[0] : truncate(m[0], max);
1231
+ }
1232
+ case "abbreviate": {
1233
+ const head = policy.head ?? 6;
1234
+ const tail = policy.tail ?? 4;
1235
+ return (m) => `${m[0].slice(0, head)}\u2026${m[0].slice(-tail)}`;
1236
+ }
1237
+ case "custom": {
1238
+ const handler = EXCERPT_HANDLERS[policy.handler ?? ""];
1239
+ if (handler === void 0) {
1240
+ throw new Error(`redact-rules.json: rule ${rule.id} names unknown excerpt handler`);
1241
+ }
1242
+ return handler;
1243
+ }
1244
+ default:
1245
+ throw new Error(`redact-rules.json: rule ${rule.id} has unknown excerpt kind ${policy.kind}`);
1246
+ }
1247
+ }
1248
+ validateCorpus(CORPUS.rules);
1249
+ var LINE_DETECTORS = compileLineDetectors(CORPUS.rules);
1250
+ var MASK_DETECTORS = LINE_DETECTORS.filter((d) => d.scopes.has("query"));
1251
+ var MASKED_ALGORITHMS = new Set(
1252
+ CORPUS.rules.filter((r) => r.match.kind === "algorithm" && r.scopes.includes("query")).map((r) => r.match.algorithm ?? "")
1253
+ );
1254
+ function scanLineDetectors(lines) {
1255
+ const out = [];
1256
+ for (let i = 0; i < lines.length; i++) {
1257
+ const line = lines[i] ?? "";
1258
+ for (const detector of LINE_DETECTORS) {
1259
+ detector.re.lastIndex = 0;
1260
+ let m;
1261
+ while ((m = detector.re.exec(line)) !== null) {
1262
+ if (!isSuppressedAsDocs(detector, m) && detector.skip?.(m) !== true) {
1263
+ out.push({
1264
+ check: detector.check,
1265
+ severity: detector.severity,
1266
+ line: i + 1,
1267
+ span: [m.index, m.index + m[0].length],
1268
+ excerpt: detector.excerpt(m)
1269
+ });
1270
+ }
1271
+ }
1272
+ }
1273
+ }
1274
+ return out;
1275
+ }
1276
+ var DOCS_PLACEHOLDER = /x{6,}|<[^<>]*>|\{\{[^{}]*\}\}|\byour[_-]?(?:key|token|secret|password)\b/i;
1277
+ function isSuppressedAsDocs(detector, m) {
1278
+ return detector.severity === "warn" && DOCS_PLACEHOLDER.test(m[0]);
1279
+ }
1280
+ var RESERVED_EXAMPLE_DOMAIN = /@(?:[A-Za-z0-9-]+\.)*example\.(?:com|org|net)$/i;
1281
+ var PLACEHOLDER_USERNAME = /^(?:user(?:name)?|you(?:rname)?|example|foo|me|myuser|somebody)$/i;
1282
+ function suppressEmailsInDbUris(findings2) {
1283
+ const uris = findings2.filter((f) => f.check === "db-connection-uri");
1284
+ if (uris.length === 0) return findings2;
1285
+ return findings2.filter(
1286
+ (f) => f.check !== "email" || !uris.some((u) => u.line === f.line && f.span[0] >= u.span[0] && f.span[1] <= u.span[1])
1287
+ );
1288
+ }
1289
+ function maskKeeping(match, prefixLen) {
1290
+ const prefix = match.slice(0, Math.min(prefixLen, match.length));
1291
+ return `${prefix}\u2026[redacted ${match.length - prefix.length} chars]`;
1292
+ }
1293
+ function truncate(value, max) {
1294
+ return value.length > max ? `${value.slice(0, max - 3)}\u2026` : value;
1295
+ }
1296
+ function localPathExcerpt(m) {
1297
+ const bounds = m.indices?.[1] ?? m.indices?.[2];
1298
+ const masked = bounds === void 0 ? m[0] : `${m[0].slice(0, bounds[0] - m.index)}[user]${m[0].slice(bounds[1] - m.index)}`;
1299
+ return truncate(masked, 60);
1300
+ }
1301
+ function skipNonLiteralValue(m) {
1302
+ const raw = m[2] ?? "";
1303
+ const value = dequote(raw);
1304
+ if (isPlaceholder(value) || isStructural(value)) return true;
1305
+ return raw === value && isCodeExpression(value);
1306
+ }
1307
+ function dequote(value) {
1308
+ const m = /^"([^"]*)"$|^'([^']*)'$/.exec(value);
1309
+ return m !== null ? m[1] ?? m[2] ?? "" : value;
1310
+ }
1311
+ var PLACEHOLDER_WORD = /^(?:xxx+|example|example-value|placeholder|redacted|changeme|dummy|sample|todo|tbd|none|null|secret|test|\*+|\.{3,})$/i;
1312
+ var PLACEHOLDER_PREFIX = /^(?:your|my)[-_][a-z]+(?:[-_][a-z]+)*$/i;
1313
+ function isPlaceholder(value) {
1314
+ if (/^[<${%]/.test(value)) return true;
1315
+ return PLACEHOLDER_WORD.test(value) || PLACEHOLDER_PREFIX.test(value);
1316
+ }
1317
+ function isCodeExpression(value) {
1318
+ const v = value.replace(/[,;]+$/, "");
1319
+ if (/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)+$/.test(v)) return true;
1320
+ if (/^[A-Za-z_$][\w$.]*\([^)]*\)$/.test(v)) return true;
1321
+ if (/\($/.test(v)) return true;
1322
+ return /^[a-z_$][a-z_$]*$/.test(v);
1323
+ }
1324
+ function isStructural(value) {
1325
+ return /^(?:\.?\.?\/|~\/|https?:\/\/|\^)/.test(value);
1326
+ }
1327
+ var EXAMPLE_PASSWORDS = /* @__PURE__ */ new Set([
1328
+ "password",
1329
+ "postgres",
1330
+ "mysql",
1331
+ "root",
1332
+ "admin",
1333
+ "changeme",
1334
+ "example",
1335
+ "secret",
1336
+ "test",
1337
+ "guest",
1338
+ "toor"
1339
+ ]);
1340
+ function isExamplePassword(password) {
1341
+ return EXAMPLE_PASSWORDS.has(password.toLowerCase());
1342
+ }
1343
+ var HEX64_RE = /(?<![0-9a-fx])0x[0-9a-fA-F]{64}(?![0-9a-fA-F])/gi;
1344
+ var HASH_LABEL_RE = /(?:^|[^a-z0-9])(?:blockhash|txhash|txn|tx|hash|salt|id|topic\d*|root|digest|commitment)(?:[\s:=/,._'"`‘’“”-]*[A-Za-z0-9_]{1,12}){0,2}[\s:=/,._'"`‘’“”-]*$/i;
1345
+ var PUBLIC_HEX_CONSTANTS = new Set(
1346
+ (CORPUS.publicHexConstants ?? []).map((c) => c.value.toLowerCase())
1347
+ );
1348
+ function scanHex64(lines) {
1349
+ const out = [];
1350
+ for (let i = 0; i < lines.length; i++) {
1351
+ const line = lines[i] ?? "";
1352
+ HEX64_RE.lastIndex = 0;
1353
+ let m;
1354
+ while ((m = HEX64_RE.exec(line)) !== null) {
1355
+ const hash = isHashContext(line, m.index, m[0]);
1356
+ out.push({
1357
+ check: hash ? "hex32-value" : "raw-private-key",
1358
+ severity: hash ? "warn" : "block",
1359
+ line: i + 1,
1360
+ span: [m.index, m.index + m[0].length],
1361
+ excerpt: hash ? `${m[0].slice(0, 6)}\u2026${m[0].slice(-4)}` : maskKeeping(m[0], 2)
1362
+ });
1363
+ }
1364
+ }
1365
+ return out;
1366
+ }
1367
+ var LABEL_LOOKBACK = 256;
1368
+ function isHashContext(line, matchIndex, match) {
1369
+ if (PUBLIC_HEX_CONSTANTS.has(match.toLowerCase())) return true;
1370
+ const from = Math.max(0, matchIndex - LABEL_LOOKBACK);
1371
+ const before = line.slice(from, matchIndex);
1372
+ const labelWindow = from === 0 ? before : before.replace(/^[A-Za-z0-9]+/, "");
1373
+ if (HASH_LABEL_RE.test(labelWindow)) return true;
1374
+ const prefix = /(\S*)$/.exec(before)?.[1] ?? "";
1375
+ return /^https?:\/\//.test(line.slice(matchIndex - prefix.length));
1376
+ }
1377
+ var BARE_HASH_LABEL_RE = /(?:^|[^a-z0-9])(?:tx|txn|txid|hash|sha\d*|hmac|digest|commit|id|checksum|sig|signature)(?:[\s:=/,._*'"`‘’“”-]*[A-Za-z0-9_]{1,12}){0,2}[\s:=/,._*'"`‘’“”-]*$/i;
1378
+ function isLabelledHash(m) {
1379
+ const input = m.input;
1380
+ const from = Math.max(0, m.index - LABEL_LOOKBACK);
1381
+ const before = input.slice(from, m.index);
1382
+ const labelWindow = from === 0 ? before : before.replace(/^[A-Za-z0-9]+/, "");
1383
+ if (BARE_HASH_LABEL_RE.test(labelWindow)) return true;
1384
+ const prefix = /(\S*)$/.exec(before)?.[1] ?? "";
1385
+ return /^https?:\/\//.test(input.slice(m.index - prefix.length));
1386
+ }
1387
+ var PEM_BEGIN = /-----BEGIN[ A-Z0-9]*PRIVATE KEY(?: BLOCK)?-----/;
1388
+ var PEM_END = /-----END[ A-Z0-9]*PRIVATE KEY(?: BLOCK)?-----/;
1389
+ function scanPemBlocks(lines) {
1390
+ const out = [];
1391
+ for (let i = 0; i < lines.length; i++) {
1392
+ const line = lines[i] ?? "";
1393
+ const m = PEM_BEGIN.exec(line);
1394
+ if (m !== null) {
1395
+ out.push({
1396
+ check: "pem-private-key",
1397
+ severity: "block",
1398
+ line: i + 1,
1399
+ span: [m.index, m.index + m[0].length],
1400
+ excerpt: m[0]
1401
+ // the header marker only — no key material follows on it
1402
+ });
1403
+ }
1404
+ }
1405
+ return out;
1406
+ }
1407
+ var BIP39_WORDS = new Set(bip39_wordlist_default.words.split(" "));
1408
+ var SEED_PHRASE_MIN_WORDS = 12;
1409
+ var SEED_PHRASE_MAX_WORDS = 24;
1410
+ var SEED_PHRASE_SIZES = [24, 21, 18, 15, 12];
1411
+ var BIP39_INDEX = new Map(
1412
+ bip39_wordlist_default.words.split(" ").map((word, index) => [word, index])
1413
+ );
1414
+ var LOOSE_SEPARATOR = /^[\s,"'`]+$/;
1415
+ function maskLooseMnemonics(text) {
1416
+ const tokens = [...text.matchAll(/[A-Za-z]+/g)].map((m) => ({
1417
+ word: m[0].toLowerCase(),
1418
+ start: m.index,
1419
+ end: m.index + m[0].length
1420
+ }));
1421
+ const checked = /* @__PURE__ */ new Map();
1422
+ const valid = (window) => {
1423
+ const key = window.join(" ");
1424
+ let result = checked.get(key);
1425
+ if (result === void 0) checked.set(key, result = isMnemonic(window));
1426
+ return result;
1427
+ };
1428
+ const parts = [];
1429
+ let cursor = 0;
1430
+ let i = 0;
1431
+ while (i < tokens.length) {
1432
+ let j = i;
1433
+ while (j < tokens.length && BIP39_INDEX.has(tokens[j].word) && (j === i || LOOSE_SEPARATOR.test(text.slice(tokens[j - 1].end, tokens[j].start)))) {
1434
+ j++;
1435
+ }
1436
+ if (j === i) {
1437
+ i++;
1438
+ continue;
1439
+ }
1440
+ let k = i;
1441
+ while (k + SEED_PHRASE_MIN_WORDS <= j) {
1442
+ const size = SEED_PHRASE_SIZES.find(
1443
+ (n) => k + n <= j && valid(tokens.slice(k, k + n).map((t) => t.word))
1444
+ );
1445
+ if (size === void 0) {
1446
+ k++;
1447
+ continue;
1448
+ }
1449
+ parts.push(
1450
+ text.slice(cursor, tokens[k].start),
1451
+ `[redacted ${size}-word BIP-39 recovery phrase]`
1452
+ );
1453
+ cursor = tokens[k + size - 1].end;
1454
+ k += size;
1455
+ }
1456
+ i = j;
1457
+ }
1458
+ parts.push(text.slice(cursor));
1459
+ return parts.join("");
1460
+ }
1461
+ function isMnemonic(words) {
1462
+ let bits = 0n;
1463
+ for (const word of words) bits = bits << 11n | BigInt(BIP39_INDEX.get(word) ?? 0);
1464
+ const checksumBits = BigInt(words.length / 3);
1465
+ const entropyBytes = (words.length * 11 - words.length / 3) / 8;
1466
+ const entropy = Buffer.from(
1467
+ (bits >> checksumBits).toString(16).padStart(entropyBytes * 2, "0"),
1468
+ "hex"
1469
+ );
1470
+ const expected = BigInt(createHash("sha256").update(entropy).digest()[0]) >> 8n - checksumBits;
1471
+ return (bits & (1n << checksumBits) - 1n) === expected;
1472
+ }
1473
+ function scanSeedPhrases(lines) {
1474
+ const out = [];
1475
+ const token = /[^\s"'`]+/g;
1476
+ for (let i = 0; i < lines.length; i++) {
1477
+ const line = lines[i] ?? "";
1478
+ token.lastIndex = 0;
1479
+ let runStart = -1;
1480
+ let runEnd = -1;
1481
+ let runWords = 0;
1482
+ let m;
1483
+ const flush = () => {
1484
+ if (runWords >= SEED_PHRASE_MIN_WORDS) {
1485
+ out.push({
1486
+ check: "bip39-seed-phrase",
1487
+ severity: "block",
1488
+ line: i + 1,
1489
+ span: [runStart, runEnd],
1490
+ excerpt: `[redacted ${runWords}-word BIP-39 recovery phrase]`
1491
+ });
1492
+ }
1493
+ runWords = 0;
1494
+ };
1495
+ while ((m = token.exec(line)) !== null) {
1496
+ if (BIP39_WORDS.has(m[0])) {
1497
+ if (runWords === 0) runStart = m.index;
1498
+ runEnd = m.index + m[0].length;
1499
+ runWords++;
1500
+ } else {
1501
+ flush();
1502
+ }
1503
+ }
1504
+ flush();
1505
+ }
1506
+ return out;
1507
+ }
1508
+ var ENV_LINE = /^\s*(?:export\s+)?([A-Z][A-Z0-9_]{2,})=(\S.*)$/;
1509
+ var ENV_BLOCK_MIN_LINES = 3;
1510
+ var ENV_SUBSTANTIAL_VALUE = 12;
1511
+ function scanEnvDumpBlocks(lines) {
1512
+ const out = [];
1513
+ let i = 0;
1514
+ while (i < lines.length) {
1515
+ const keys = [];
1516
+ let substantial = false;
1517
+ const start = i;
1518
+ let m;
1519
+ while (i < lines.length && (m = ENV_LINE.exec(lines[i] ?? "")) !== null) {
1520
+ keys.push(m[1] ?? "");
1521
+ const value = dequote((m[2] ?? "").trim());
1522
+ if (value.length >= ENV_SUBSTANTIAL_VALUE && !isPlaceholder(value) && !isStructural(value)) {
1523
+ substantial = true;
1524
+ }
1525
+ i++;
1526
+ }
1527
+ if (keys.length >= ENV_BLOCK_MIN_LINES && substantial) {
1528
+ const shown = keys.slice(0, 3).join(", ");
1529
+ const rest = keys.length - 3;
1530
+ out.push({
1531
+ check: "env-dump-block",
1532
+ severity: "warn",
1533
+ line: start + 1,
1534
+ span: [0, (lines[start] ?? "").length],
1535
+ excerpt: `${keys.length} KEY=VALUE lines (${shown}${rest > 0 ? `, +${rest} more` : ""})`
1536
+ });
1537
+ }
1538
+ if (i === start) i++;
1539
+ }
1540
+ return out;
1541
+ }
1542
+ var ENTROPY_CANDIDATE = /[A-Za-z0-9+_-]{32,}/g;
1543
+ var MIN_ENTROPY_BITS = 3.5;
1544
+ var MAX_SAME_CASE_RUN = 8;
1545
+ function scanHighEntropy(lines, named) {
1546
+ const out = [];
1547
+ for (let i = 0; i < lines.length; i++) {
1548
+ const line = lines[i] ?? "";
1549
+ ENTROPY_CANDIDATE.lastIndex = 0;
1550
+ let m;
1551
+ while ((m = ENTROPY_CANDIDATE.exec(line)) !== null) {
1552
+ const token = m[0];
1553
+ if (!looksRandom(token) || DOCS_PLACEHOLDER.test(token)) continue;
1554
+ const span = [m.index, m.index + token.length];
1555
+ if (named.some((f) => f.line === i + 1 && f.span[0] < span[1] && span[0] < f.span[1])) {
1556
+ continue;
1557
+ }
1558
+ out.push({
1559
+ check: "high-entropy-string",
1560
+ severity: "warn",
1561
+ line: i + 1,
1562
+ span,
1563
+ excerpt: maskKeeping(token, 4)
1564
+ });
1565
+ }
1566
+ }
1567
+ return out;
1568
+ }
1569
+ function looksRandom(token) {
1570
+ if (!/[a-z]/.test(token) || !/[A-Z]/.test(token) || !/[0-9]/.test(token)) return false;
1571
+ if (longestSameCaseRun(token) > MAX_SAME_CASE_RUN) return false;
1572
+ return shannonBits(token) >= MIN_ENTROPY_BITS;
1573
+ }
1574
+ function longestSameCaseRun(token) {
1575
+ let best = 0;
1576
+ let run = 0;
1577
+ let previous = "";
1578
+ for (const ch of token) {
1579
+ let kind = "";
1580
+ if (/[a-z]/.test(ch)) kind = "lower";
1581
+ else if (/[A-Z]/.test(ch)) kind = "upper";
1582
+ if (kind === "") run = 0;
1583
+ else run = kind === previous ? run + 1 : 1;
1584
+ previous = kind;
1585
+ if (run > best) best = run;
1586
+ }
1587
+ return best;
1588
+ }
1589
+ function shannonBits(token) {
1590
+ const counts = /* @__PURE__ */ new Map();
1591
+ for (const ch of token) counts.set(ch, (counts.get(ch) ?? 0) + 1);
1592
+ let bits = 0;
1593
+ for (const n of counts.values()) {
1594
+ const p = n / token.length;
1595
+ bits -= p * Math.log2(p);
1596
+ }
1597
+ return bits;
1598
+ }
1599
+ var EMITTED_CHECKS = {
1600
+ "hex32-value": "raw-private-key"
1601
+ };
1602
+ function checksFor(scope) {
1603
+ const ids = new Set(CORPUS.rules.filter((r) => r.scopes.includes(scope)).map((r) => r.id));
1604
+ for (const [check, rule] of Object.entries(EMITTED_CHECKS)) if (ids.has(rule)) ids.add(check);
1605
+ return ids;
1606
+ }
1607
+ var CHECKS = {
1608
+ publish: checksFor("publish"),
1609
+ team: checksFor("team")
1610
+ };
1611
+ var FENCE = /^(\s*)(`{3,}|~{3,})/;
1612
+ function scanLongVerbatim(lines) {
1613
+ const out = [];
1614
+ let i = 0;
1615
+ while (i < lines.length) {
1616
+ const line = lines[i] ?? "";
1617
+ const fence = FENCE.exec(line);
1618
+ if (fence !== null) {
1619
+ const marker = fence[2] ?? "```";
1620
+ const start = i;
1621
+ const body = [];
1622
+ i++;
1623
+ while (i < lines.length && !closesFence(lines[i] ?? "", marker)) {
1624
+ body.push(lines[i] ?? "");
1625
+ i++;
1626
+ }
1627
+ i++;
1628
+ pushIfLong(out, body, start, line);
1629
+ continue;
1630
+ }
1631
+ if (/^\s*>/.test(line)) {
1632
+ const start = i;
1633
+ const body = [];
1634
+ while (i < lines.length && /^\s*>/.test(lines[i] ?? "")) {
1635
+ body.push((lines[i] ?? "").replace(/^\s*>\s?/, ""));
1636
+ i++;
1637
+ }
1638
+ pushIfLong(out, body, start, lines[start] ?? "");
1639
+ continue;
1640
+ }
1641
+ i++;
1642
+ }
1643
+ return out;
1644
+ }
1645
+ function closesFence(line, marker) {
1646
+ const m = FENCE.exec(line);
1647
+ return m !== null && (m[2] ?? "").startsWith(marker);
1648
+ }
1649
+ function pushIfLong(out, body, startLine, firstLine) {
1650
+ const text = body.join(" ").trim();
1651
+ const words = text.length === 0 ? 0 : text.split(/\s+/).length;
1652
+ if (words < LONG_QUOTE_WORDS) return;
1653
+ out.push({
1654
+ check: "long-verbatim-quote",
1655
+ severity: "warn",
1656
+ line: startLine + 1,
1657
+ span: [0, firstLine.length],
1658
+ excerpt: truncate(text, 60)
1659
+ });
1660
+ }
1661
+ function dedupeAndSort(findings2) {
1662
+ const seen = /* @__PURE__ */ new Set();
1663
+ const unique = findings2.filter((f) => {
1664
+ const key = `${f.check}:${f.line}:${f.span[0]}:${f.span[1]}`;
1665
+ if (seen.has(key)) return false;
1666
+ seen.add(key);
1667
+ return true;
1668
+ });
1669
+ return unique.sort(
1670
+ (a, b) => a.line - b.line || a.span[0] - b.span[0] || a.check.localeCompare(b.check)
1671
+ );
1672
+ }
1673
+
1674
+ export {
1675
+ findings,
1676
+ mask,
1677
+ EMITTED_CHECKS,
1678
+ checksFor
1679
+ };
1680
+ //# sourceMappingURL=chunk-7QKHZQKW.js.map