tenjin-cli 0.1.0-alpha.14 → 0.1.0-alpha.16

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 (253) hide show
  1. package/NOTICE.md +54 -7
  2. package/README.md +41 -295
  3. package/dist/{_esm-N4KAVXQR.js → _esm-CE7KNONL.js} +9 -10
  4. package/dist/{ccip-ZGGWQN4X.js → ccip-7RMRLAGV.js} +4 -4
  5. package/dist/{ccip-RPPPKTJR.js → ccip-NLCSCHKI.js} +5 -5
  6. package/dist/chunk-25TJPVBF.js +353 -0
  7. package/dist/chunk-25TJPVBF.js.map +1 -0
  8. package/dist/chunk-2BKS2FVE.js +93 -0
  9. package/dist/chunk-2BKS2FVE.js.map +1 -0
  10. package/dist/chunk-2QYORQBF.js +55 -0
  11. package/dist/chunk-2QYORQBF.js.map +1 -0
  12. package/dist/{chunk-ACBEHJAH.js → chunk-2U5ZVEV3.js} +14 -16
  13. package/dist/chunk-2U5ZVEV3.js.map +1 -0
  14. package/dist/{chunk-MJSXP4LW.js → chunk-3AJS6LLN.js} +11 -8
  15. package/dist/chunk-3AJS6LLN.js.map +1 -0
  16. package/dist/{chunk-OWVVI4VQ.js → chunk-3AUDA53C.js} +7650 -7361
  17. package/dist/chunk-3AUDA53C.js.map +1 -0
  18. package/dist/{chunk-MJZZTKCC.js → chunk-56MOAIP5.js} +5 -10
  19. package/dist/chunk-56MOAIP5.js.map +1 -0
  20. package/dist/{chunk-U5S527PP.js → chunk-5IEP5EGE.js} +3 -3
  21. package/dist/chunk-5X4SZ5BF.js +227 -0
  22. package/dist/chunk-5X4SZ5BF.js.map +1 -0
  23. package/dist/chunk-7WEQQJLG.js +68 -0
  24. package/dist/chunk-7WEQQJLG.js.map +1 -0
  25. package/dist/{chunk-7FK2UN2T.js → chunk-AWQPGIR6.js} +65 -67
  26. package/dist/{chunk-7FK2UN2T.js.map → chunk-AWQPGIR6.js.map} +1 -1
  27. package/dist/{chunk-PAOVPSP6.js → chunk-BBVUVBUO.js} +517 -138
  28. package/dist/chunk-BBVUVBUO.js.map +1 -0
  29. package/dist/{chunk-ETKZWJ4B.js → chunk-BFFM2WFK.js} +8 -8
  30. package/dist/chunk-BFFM2WFK.js.map +1 -0
  31. package/dist/{chunk-KYQVEKP5.js → chunk-BPMWXTFX.js} +8 -8
  32. package/dist/chunk-DMZZLPZN.js +205 -0
  33. package/dist/chunk-DMZZLPZN.js.map +1 -0
  34. package/dist/{chunk-47PP7TAG.js → chunk-EGELTSPU.js} +1356 -1356
  35. package/dist/chunk-EGELTSPU.js.map +1 -0
  36. package/dist/chunk-GULLJQXA.js +698 -0
  37. package/dist/chunk-GULLJQXA.js.map +1 -0
  38. package/dist/{chunk-S5RYMCV6.js → chunk-HPWO4O6S.js} +3 -3
  39. package/dist/chunk-HVRC33OL.js +174 -0
  40. package/dist/chunk-HVRC33OL.js.map +1 -0
  41. package/dist/{chunk-W6R3HAAG.js → chunk-JRGFKVAZ.js} +2 -2
  42. package/dist/{chunk-XJN5WUKL.js → chunk-KG3D7FIF.js} +2 -2
  43. package/dist/chunk-L3PVMIYQ.js +10328 -0
  44. package/dist/chunk-L3PVMIYQ.js.map +1 -0
  45. package/dist/{chunk-QW2Q2KAH.js → chunk-LHHMV4GU.js} +2 -2
  46. package/dist/{chunk-ZOBNS7CX.js → chunk-MEFB5KHA.js} +4 -18
  47. package/dist/chunk-MEFB5KHA.js.map +1 -0
  48. package/dist/{chunk-M2O56UK7.js → chunk-N35E6CM2.js} +293 -163
  49. package/dist/chunk-N35E6CM2.js.map +1 -0
  50. package/dist/chunk-OCBHUHWB.js +69 -0
  51. package/dist/chunk-OCBHUHWB.js.map +1 -0
  52. package/dist/chunk-OIM4HLN6.js +1405 -0
  53. package/dist/chunk-OIM4HLN6.js.map +1 -0
  54. package/dist/{chunk-PKW3H26Z.js → chunk-OJLYNM4Z.js} +56 -33
  55. package/dist/chunk-OJLYNM4Z.js.map +1 -0
  56. package/dist/{chunk-POJRB2AE.js → chunk-POUWHWID.js} +2 -2
  57. package/dist/chunk-PZEN5PHN.js +285 -0
  58. package/dist/chunk-PZEN5PHN.js.map +1 -0
  59. package/dist/chunk-SKAHDQH7.js +1785 -0
  60. package/dist/chunk-SKAHDQH7.js.map +1 -0
  61. package/dist/{chunk-KZAAWQNP.js → chunk-TTNESUPQ.js} +3 -3
  62. package/dist/{chunk-QWBUKIP2.js → chunk-U5DXNFJC.js} +23 -94
  63. package/dist/chunk-U5DXNFJC.js.map +1 -0
  64. package/dist/chunk-USS336NF.js +165 -0
  65. package/dist/chunk-USS336NF.js.map +1 -0
  66. package/dist/{chunk-UO22YNY4.js → chunk-WH7OWT6G.js} +49 -1
  67. package/dist/chunk-WH7OWT6G.js.map +1 -0
  68. package/dist/chunk-WXC57XGG.js +29 -0
  69. package/dist/chunk-WXC57XGG.js.map +1 -0
  70. package/dist/{chunk-YLYINX2H.js → chunk-XZKD7DIF.js} +3 -3
  71. package/dist/{chunk-7GJQ5RGA.js → chunk-YEETV6IW.js} +1077 -1039
  72. package/dist/chunk-YEETV6IW.js.map +1 -0
  73. package/dist/{chunk-B676GPS2.js → chunk-YJHHCWM3.js} +39 -16
  74. package/dist/chunk-YJHHCWM3.js.map +1 -0
  75. package/dist/{cli-U2BEUA55.js → cli-M3XCSOU6.js} +295 -349
  76. package/dist/cli-M3XCSOU6.js.map +1 -0
  77. package/dist/config-MXOX7XDR.js +41 -0
  78. package/dist/{dist-U4M6QCKE.js → dist-3LOO6M4U.js} +10 -10
  79. package/dist/doctor-LU4YIZWM.js +349 -0
  80. package/dist/doctor-LU4YIZWM.js.map +1 -0
  81. package/dist/{ethersCompat-Df4a6QIZ-WHYKB6HA.js → ethersCompat-Df4a6QIZ-THAVUGIJ.js} +5 -5
  82. package/dist/{chunk-3ZW7HPY5.js → fund-A54P2QFK.js} +81 -22
  83. package/dist/fund-A54P2QFK.js.map +1 -0
  84. package/dist/hook-command-U6KWPEDQ.js +377 -0
  85. package/dist/hook-command-U6KWPEDQ.js.map +1 -0
  86. package/dist/index.js +8 -3
  87. package/dist/index.js.map +1 -1
  88. package/dist/install-XUM2XSHW.js +53 -0
  89. package/dist/install-wallet-QIOFORTX.js +105 -0
  90. package/dist/install-wallet-QIOFORTX.js.map +1 -0
  91. package/dist/{run-CJWPGMIQ.js → mcp-HJC2PLRV.js} +3725 -10661
  92. package/dist/mcp-HJC2PLRV.js.map +1 -0
  93. package/dist/paths-P2N4JTDZ.js +49 -0
  94. package/dist/pay-SBXZEPEP.js +37 -0
  95. package/dist/redact-46ZHF2NH.js +17 -0
  96. package/dist/{secp256k1-XRPVBC6V.js → secp256k1-ZZZT2CAX.js} +3 -3
  97. package/dist/{send-C5EOKXOU.js → send-ASD2ZXJD.js} +28 -30
  98. package/dist/send-ASD2ZXJD.js.map +1 -0
  99. package/dist/{chunk-NAAMHWSI.js → skill-placement-NFVHY6A3.js} +159 -12
  100. package/dist/skill-placement-NFVHY6A3.js.map +1 -0
  101. package/dist/status-T2SDB57A.js +63 -0
  102. package/dist/status-T2SDB57A.js.map +1 -0
  103. package/dist/status-line-CGPUSDMC.js +71 -0
  104. package/dist/status-line-CGPUSDMC.js.map +1 -0
  105. package/dist/status-line-wiring-BYPHTYZE.js +30 -0
  106. package/dist/tenjin-daemon.mjs +20060 -0
  107. package/dist/tenjin-shim.mjs +251 -0
  108. package/dist/tenjin-vitest-reporter.mjs +49 -0
  109. package/dist/uninstall-FKYZHAM3.js +144 -0
  110. package/dist/uninstall-FKYZHAM3.js.map +1 -0
  111. package/dist/{update-24Y2CQTT.js → update-ANJ2AOTN.js} +133 -17
  112. package/dist/update-ANJ2AOTN.js.map +1 -0
  113. package/dist/{viemAdapter-By13KInL-TUQJBMHM.js → viemAdapter-By13KInL-X2VY6CY3.js} +5 -5
  114. package/dist/wallet-PWAHVKWW.js +31 -0
  115. package/dist/wallet-kdf-worker.mjs +980 -0
  116. package/docs/agent-permissions.md +68 -342
  117. package/docs/safety-model.md +25 -6
  118. package/package.json +8 -7
  119. package/LICENSE +0 -21
  120. package/dist/buy-2JBYPHAI.js +0 -46
  121. package/dist/chunk-3P3ES4XU.js +0 -144
  122. package/dist/chunk-3P3ES4XU.js.map +0 -1
  123. package/dist/chunk-3ZW7HPY5.js.map +0 -1
  124. package/dist/chunk-47PP7TAG.js.map +0 -1
  125. package/dist/chunk-4UHNXY6B.js +0 -786
  126. package/dist/chunk-4UHNXY6B.js.map +0 -1
  127. package/dist/chunk-4Y53PDH6.js +0 -213
  128. package/dist/chunk-4Y53PDH6.js.map +0 -1
  129. package/dist/chunk-54AJIO3E.js +0 -198
  130. package/dist/chunk-54AJIO3E.js.map +0 -1
  131. package/dist/chunk-736DW4V3.js +0 -65
  132. package/dist/chunk-736DW4V3.js.map +0 -1
  133. package/dist/chunk-7GJQ5RGA.js.map +0 -1
  134. package/dist/chunk-7NADDA2V.js +0 -161
  135. package/dist/chunk-7NADDA2V.js.map +0 -1
  136. package/dist/chunk-ACBEHJAH.js.map +0 -1
  137. package/dist/chunk-B676GPS2.js.map +0 -1
  138. package/dist/chunk-DAZAXFSF.js +0 -1357
  139. package/dist/chunk-DAZAXFSF.js.map +0 -1
  140. package/dist/chunk-DTCXO7HS.js +0 -791
  141. package/dist/chunk-DTCXO7HS.js.map +0 -1
  142. package/dist/chunk-ETKZWJ4B.js.map +0 -1
  143. package/dist/chunk-FDUD3W5V.js +0 -317
  144. package/dist/chunk-FDUD3W5V.js.map +0 -1
  145. package/dist/chunk-GEHL43VE.js +0 -711
  146. package/dist/chunk-GEHL43VE.js.map +0 -1
  147. package/dist/chunk-IU2HVT3Y.js +0 -313
  148. package/dist/chunk-IU2HVT3Y.js.map +0 -1
  149. package/dist/chunk-IUQZ4Z7M.js +0 -162
  150. package/dist/chunk-IUQZ4Z7M.js.map +0 -1
  151. package/dist/chunk-IXZJ3JOO.js +0 -614
  152. package/dist/chunk-IXZJ3JOO.js.map +0 -1
  153. package/dist/chunk-J6FUAIRR.js +0 -205
  154. package/dist/chunk-J6FUAIRR.js.map +0 -1
  155. package/dist/chunk-L6G35FU5.js +0 -105
  156. package/dist/chunk-L6G35FU5.js.map +0 -1
  157. package/dist/chunk-LSWP7MU2.js +0 -290
  158. package/dist/chunk-LSWP7MU2.js.map +0 -1
  159. package/dist/chunk-M2O56UK7.js.map +0 -1
  160. package/dist/chunk-MJSXP4LW.js.map +0 -1
  161. package/dist/chunk-MJZZTKCC.js.map +0 -1
  162. package/dist/chunk-NAAMHWSI.js.map +0 -1
  163. package/dist/chunk-O75FOHXS.js +0 -372
  164. package/dist/chunk-O75FOHXS.js.map +0 -1
  165. package/dist/chunk-OWVVI4VQ.js.map +0 -1
  166. package/dist/chunk-PAOVPSP6.js.map +0 -1
  167. package/dist/chunk-PCX2JQ2J.js +0 -233
  168. package/dist/chunk-PCX2JQ2J.js.map +0 -1
  169. package/dist/chunk-PKW3H26Z.js.map +0 -1
  170. package/dist/chunk-PQZVDCCA.js +0 -125
  171. package/dist/chunk-PQZVDCCA.js.map +0 -1
  172. package/dist/chunk-QWBUKIP2.js.map +0 -1
  173. package/dist/chunk-SGK2B724.js +0 -67
  174. package/dist/chunk-SGK2B724.js.map +0 -1
  175. package/dist/chunk-UHTVXQ2O.js +0 -140
  176. package/dist/chunk-UHTVXQ2O.js.map +0 -1
  177. package/dist/chunk-UO22YNY4.js.map +0 -1
  178. package/dist/chunk-VEAERJVJ.js +0 -43
  179. package/dist/chunk-VEAERJVJ.js.map +0 -1
  180. package/dist/chunk-VRPLZERE.js +0 -1421
  181. package/dist/chunk-VRPLZERE.js.map +0 -1
  182. package/dist/chunk-W4VW5XYB.js +0 -149
  183. package/dist/chunk-W4VW5XYB.js.map +0 -1
  184. package/dist/chunk-WU5CZPLD.js +0 -145
  185. package/dist/chunk-WU5CZPLD.js.map +0 -1
  186. package/dist/chunk-WYLMJQVH.js +0 -240
  187. package/dist/chunk-WYLMJQVH.js.map +0 -1
  188. package/dist/chunk-XGZ5EVMB.js +0 -35
  189. package/dist/chunk-XGZ5EVMB.js.map +0 -1
  190. package/dist/chunk-XVPQGCH4.js +0 -176
  191. package/dist/chunk-XVPQGCH4.js.map +0 -1
  192. package/dist/chunk-ZOBNS7CX.js.map +0 -1
  193. package/dist/chunk-ZQIQ55KK.js +0 -51
  194. package/dist/chunk-ZQIQ55KK.js.map +0 -1
  195. package/dist/cli-U2BEUA55.js.map +0 -1
  196. package/dist/config-CNUIX23Q.js +0 -32
  197. package/dist/doctor-QJJXRWTO.js +0 -31
  198. package/dist/edit-HJ44P44P.js +0 -40
  199. package/dist/fund-Y5IAHZ5D.js +0 -40
  200. package/dist/inspect-NFQ6SQQQ.js +0 -37
  201. package/dist/install-DXX7PVUP.js +0 -854
  202. package/dist/install-DXX7PVUP.js.map +0 -1
  203. package/dist/outcome-ANV4QIED.js +0 -24
  204. package/dist/publish-PCBTCXCZ.js +0 -42
  205. package/dist/read-W7QVRBVD.js +0 -160
  206. package/dist/read-W7QVRBVD.js.map +0 -1
  207. package/dist/run-CJWPGMIQ.js.map +0 -1
  208. package/dist/search-JGAVKTYJ.js +0 -25
  209. package/dist/secp256k1-XRPVBC6V.js.map +0 -1
  210. package/dist/send-C5EOKXOU.js.map +0 -1
  211. package/dist/session-OBCUUIFX.js +0 -89
  212. package/dist/session-OBCUUIFX.js.map +0 -1
  213. package/dist/skill-heal-D6EPLPS6.js +0 -84
  214. package/dist/skill-heal-D6EPLPS6.js.map +0 -1
  215. package/dist/uninstall-OWJNJ5LI.js +0 -73
  216. package/dist/uninstall-OWJNJ5LI.js.map +0 -1
  217. package/dist/update-24Y2CQTT.js.map +0 -1
  218. package/dist/usdc-4VCDHFWX.js +0 -38
  219. package/dist/usdc-4VCDHFWX.js.map +0 -1
  220. package/dist/viemAdapter-By13KInL-TUQJBMHM.js.map +0 -1
  221. package/dist/wallet-OFXDIIGP.js +0 -33
  222. package/dist/wallet-OFXDIIGP.js.map +0 -1
  223. package/dist/wallet-SLRIYJ2U.js +0 -42
  224. package/dist/wallet-SLRIYJ2U.js.map +0 -1
  225. package/docs/command-reference.md +0 -261
  226. package/skills/tenjin/SKILL.md +0 -364
  227. package/skills/tenjin-publish/SKILL.md +0 -224
  228. package/skills/tenjin-publish/references/maintain.md +0 -39
  229. package/skills/tenjin-search/SKILL.md +0 -149
  230. package/skills/tenjin-search/references/permissions.md +0 -106
  231. /package/dist/{_esm-N4KAVXQR.js.map → _esm-CE7KNONL.js.map} +0 -0
  232. /package/dist/{buy-2JBYPHAI.js.map → ccip-7RMRLAGV.js.map} +0 -0
  233. /package/dist/{ccip-RPPPKTJR.js.map → ccip-NLCSCHKI.js.map} +0 -0
  234. /package/dist/{chunk-U5S527PP.js.map → chunk-5IEP5EGE.js.map} +0 -0
  235. /package/dist/{chunk-KYQVEKP5.js.map → chunk-BPMWXTFX.js.map} +0 -0
  236. /package/dist/{chunk-S5RYMCV6.js.map → chunk-HPWO4O6S.js.map} +0 -0
  237. /package/dist/{chunk-W6R3HAAG.js.map → chunk-JRGFKVAZ.js.map} +0 -0
  238. /package/dist/{chunk-XJN5WUKL.js.map → chunk-KG3D7FIF.js.map} +0 -0
  239. /package/dist/{chunk-QW2Q2KAH.js.map → chunk-LHHMV4GU.js.map} +0 -0
  240. /package/dist/{chunk-POJRB2AE.js.map → chunk-POUWHWID.js.map} +0 -0
  241. /package/dist/{chunk-KZAAWQNP.js.map → chunk-TTNESUPQ.js.map} +0 -0
  242. /package/dist/{chunk-YLYINX2H.js.map → chunk-XZKD7DIF.js.map} +0 -0
  243. /package/dist/{ccip-ZGGWQN4X.js.map → config-MXOX7XDR.js.map} +0 -0
  244. /package/dist/{dist-U4M6QCKE.js.map → dist-3LOO6M4U.js.map} +0 -0
  245. /package/dist/{config-CNUIX23Q.js.map → ethersCompat-Df4a6QIZ-THAVUGIJ.js.map} +0 -0
  246. /package/dist/{doctor-QJJXRWTO.js.map → install-XUM2XSHW.js.map} +0 -0
  247. /package/dist/{edit-HJ44P44P.js.map → paths-P2N4JTDZ.js.map} +0 -0
  248. /package/dist/{ethersCompat-Df4a6QIZ-WHYKB6HA.js.map → pay-SBXZEPEP.js.map} +0 -0
  249. /package/dist/{fund-Y5IAHZ5D.js.map → redact-46ZHF2NH.js.map} +0 -0
  250. /package/dist/{inspect-NFQ6SQQQ.js.map → secp256k1-ZZZT2CAX.js.map} +0 -0
  251. /package/dist/{outcome-ANV4QIED.js.map → status-line-wiring-BYPHTYZE.js.map} +0 -0
  252. /package/dist/{publish-PCBTCXCZ.js.map → viemAdapter-By13KInL-X2VY6CY3.js.map} +0 -0
  253. /package/dist/{search-JGAVKTYJ.js.map → wallet-PWAHVKWW.js.map} +0 -0
@@ -0,0 +1,1405 @@
1
+ import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
+
3
+ // src/lib/redact-rules.json
4
+ var redact_rules_default = {
5
+ schemaVersion: 1,
6
+ 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 by `mask()`; regex rows only). 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.",
7
+ publicHexConstants: [
8
+ {
9
+ value: "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
10
+ name: "topic0 ERC-20 / ERC-721 Transfer"
11
+ },
12
+ {
13
+ value: "0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925",
14
+ name: "topic0 ERC-20 / ERC-721 Approval"
15
+ },
16
+ {
17
+ value: "0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31",
18
+ name: "topic0 ERC-721 / ERC-1155 ApprovalForAll"
19
+ },
20
+ {
21
+ value: "0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62",
22
+ name: "topic0 ERC-1155 TransferSingle"
23
+ },
24
+ {
25
+ value: "0x4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb",
26
+ name: "topic0 ERC-1155 TransferBatch"
27
+ },
28
+ {
29
+ value: "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0",
30
+ name: "topic0 Ownable OwnershipTransferred"
31
+ },
32
+ {
33
+ value: "0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c",
34
+ name: "topic0 WETH Deposit"
35
+ },
36
+ {
37
+ value: "0x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65",
38
+ name: "topic0 WETH Withdrawal"
39
+ },
40
+ {
41
+ value: "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc",
42
+ name: "EIP-1967 implementation storage slot"
43
+ },
44
+ {
45
+ value: "0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103",
46
+ name: "EIP-1967 admin storage slot"
47
+ },
48
+ {
49
+ value: "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
50
+ name: "keccak256 of the empty string"
51
+ },
52
+ {
53
+ value: "0x0000000000000000000000000000000000000000000000000000000000000000",
54
+ name: "the zero hash"
55
+ }
56
+ ],
57
+ excerptPolicies: {
58
+ mask: "Keep the first `keep` characters (a public type marker) and replace the rest with a redaction count.",
59
+ verbatim: "Echo the match, truncated to `max` characters when set. Only for non-secret matches.",
60
+ abbreviate: "Keep `head` leading and `tail` trailing characters joined by an ellipsis.",
61
+ custom: "Consumer-implemented builder named by `handler`."
62
+ },
63
+ rules: [
64
+ {
65
+ id: "secret-assignment",
66
+ tier: "warn",
67
+ scopes: ["query", "publish", "team"],
68
+ description: 'Secret-named assignment (API_KEY=, password:, token=) with a literal value. NOT the JSON-quoted form ("password": "..."): reading a quote after the name turned ordinary config keys into findings ({"credentials": "include"}, {"max_tokens": 128000}, {"tokenizer": "cl100k_base"}), and a JSON key is an identifier the shelf ranks on (owner decision, 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.',
69
+ source: "tenjin",
70
+ match: {
71
+ kind: "regex",
72
+ 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,})`,
73
+ flags: "gi"
74
+ },
75
+ excerpt: {
76
+ kind: "custom",
77
+ handler: "labeledValue"
78
+ },
79
+ skip: {
80
+ handler: "nonLiteralValue"
81
+ }
82
+ },
83
+ {
84
+ id: "secret-assignment",
85
+ tier: "warn",
86
+ scopes: ["query", "publish", "team"],
87
+ 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.",
88
+ source: "tenjin (closes tenjin-agent#281)",
89
+ match: {
90
+ kind: "regex",
91
+ 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,})`,
92
+ flags: "gi"
93
+ },
94
+ excerpt: {
95
+ kind: "custom",
96
+ handler: "labeledValue"
97
+ },
98
+ skip: {
99
+ handler: "nonLiteralValue"
100
+ }
101
+ },
102
+ {
103
+ id: "aws-access-key",
104
+ tier: "block",
105
+ scopes: ["query", "publish", "team"],
106
+ description: "AWS access key id (AKIA/ASIA/ABIA/ACCA/A3T prefixes).",
107
+ source: "gitleaks:aws-access-token",
108
+ match: {
109
+ kind: "regex",
110
+ pattern: "\\b(?:A3T[A-Z0-9]|AKIA|ASIA|ABIA|ACCA)[0-9A-Z]{16}\\b",
111
+ flags: "g"
112
+ },
113
+ excerpt: {
114
+ kind: "mask",
115
+ keep: 4
116
+ }
117
+ },
118
+ {
119
+ id: "jwt",
120
+ tier: "block",
121
+ scopes: ["query", "publish", "team"],
122
+ description: "JSON Web Token: three base64url segments whose header starts eyJ.",
123
+ source: "gitleaks:jwt",
124
+ match: {
125
+ kind: "regex",
126
+ pattern: "\\beyJ[A-Za-z0-9_-]{5,}\\.eyJ[A-Za-z0-9_-]{5,}\\.[A-Za-z0-9_-]{5,}\\b",
127
+ flags: "g"
128
+ },
129
+ excerpt: {
130
+ kind: "mask",
131
+ keep: 3
132
+ }
133
+ },
134
+ {
135
+ id: "github-token",
136
+ tier: "block",
137
+ scopes: ["query", "publish", "team"],
138
+ description: "GitHub classic PAT/OAuth/app/refresh token or fine-grained PAT (github_pat_).",
139
+ source: "gitleaks:github-pat + github-fine-grained-pat",
140
+ match: {
141
+ kind: "regex",
142
+ pattern: "\\b(?:gh[posru]_[0-9A-Za-z]{36}|github_pat_[0-9A-Za-z_]{82})\\b",
143
+ flags: "g"
144
+ },
145
+ excerpt: {
146
+ kind: "mask",
147
+ keep: 4
148
+ }
149
+ },
150
+ {
151
+ id: "slack-token",
152
+ tier: "block",
153
+ scopes: ["query", "publish", "team"],
154
+ description: "Slack bot/user/app/refresh/legacy token.",
155
+ source: "gitleaks:slack-*-token",
156
+ match: {
157
+ kind: "regex",
158
+ pattern: "\\bxox[baprs]-[0-9A-Za-z-]{10,}\\b",
159
+ flags: "g"
160
+ },
161
+ excerpt: {
162
+ kind: "mask",
163
+ keep: 5
164
+ }
165
+ },
166
+ {
167
+ id: "stripe-token",
168
+ tier: "block",
169
+ scopes: ["query", "publish", "team"],
170
+ description: "Stripe live or test secret/restricted key.",
171
+ source: "gitleaks:stripe-access-token",
172
+ match: {
173
+ kind: "regex",
174
+ pattern: "\\b[sr]k_(?:live|test)_[0-9A-Za-z]{10,99}\\b",
175
+ flags: "g"
176
+ },
177
+ excerpt: {
178
+ kind: "mask",
179
+ keep: 8
180
+ }
181
+ },
182
+ {
183
+ id: "anthropic-key",
184
+ tier: "block",
185
+ scopes: ["query", "publish", "team"],
186
+ description: "Anthropic API key (sk-ant-).",
187
+ source: "gitleaks:anthropic-api-key",
188
+ match: {
189
+ kind: "regex",
190
+ pattern: "\\bsk-ant-[0-9A-Za-z_-]{20,}\\b",
191
+ flags: "g"
192
+ },
193
+ excerpt: {
194
+ kind: "mask",
195
+ keep: 7
196
+ }
197
+ },
198
+ {
199
+ id: "openai-key",
200
+ tier: "block",
201
+ scopes: ["query", "publish", "team"],
202
+ 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).",
203
+ source: "gitleaks:openai-api-key",
204
+ match: {
205
+ kind: "regex",
206
+ 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]))",
207
+ flags: "g"
208
+ },
209
+ excerpt: {
210
+ kind: "mask",
211
+ keep: 3
212
+ }
213
+ },
214
+ {
215
+ id: "google-key",
216
+ tier: "block",
217
+ scopes: ["query", "publish", "team"],
218
+ description: "Google API key (AIza) or OAuth client secret (GOCSPX-).",
219
+ source: "gitleaks:gcp-api-key + gcp-oauth-client-secret",
220
+ match: {
221
+ kind: "regex",
222
+ pattern: "\\b(?:AIza[0-9A-Za-z_-]{35}|GOCSPX-[0-9A-Za-z_-]{20,})\\b",
223
+ flags: "g"
224
+ },
225
+ excerpt: {
226
+ kind: "custom",
227
+ handler: "googleKey"
228
+ }
229
+ },
230
+ {
231
+ id: "npm-token",
232
+ tier: "block",
233
+ scopes: ["query", "publish", "team"],
234
+ description: "npm access token.",
235
+ source: "gitleaks:npm-access-token",
236
+ match: {
237
+ kind: "regex",
238
+ pattern: "\\bnpm_[0-9A-Za-z]{36}\\b",
239
+ flags: "g"
240
+ },
241
+ excerpt: {
242
+ kind: "mask",
243
+ keep: 4
244
+ }
245
+ },
246
+ {
247
+ id: "supabase-token",
248
+ tier: "block",
249
+ scopes: ["query", "publish", "team"],
250
+ description: "Supabase personal access token (sbp_) or secret/publishable API key (sb_*_).",
251
+ source: "gitleaks:supabase-access-token",
252
+ match: {
253
+ kind: "regex",
254
+ pattern: "\\bsbp_[0-9a-f]{40}\\b|\\bsb_(?:secret|publishable)_[0-9A-Za-z_-]{20,}\\b",
255
+ flags: "g"
256
+ },
257
+ excerpt: {
258
+ kind: "mask",
259
+ keep: 4
260
+ }
261
+ },
262
+ {
263
+ id: "twilio-key",
264
+ tier: "block",
265
+ scopes: ["query", "publish", "team"],
266
+ description: "Twilio API key SID (SK + 32 lowercase hex).",
267
+ source: "gitleaks:twilio-api-key",
268
+ match: {
269
+ kind: "regex",
270
+ pattern: "\\bSK[0-9a-f]{32}\\b",
271
+ flags: "g"
272
+ },
273
+ excerpt: {
274
+ kind: "mask",
275
+ keep: 2
276
+ }
277
+ },
278
+ {
279
+ id: "sendgrid-token",
280
+ tier: "block",
281
+ scopes: ["query", "publish", "team"],
282
+ description: "SendGrid API key (SG.<id>.<secret>).",
283
+ source: "gitleaks:sendgrid-api-token",
284
+ match: {
285
+ kind: "regex",
286
+ pattern: "\\bSG\\.[0-9A-Za-z_-]{16,32}\\.[0-9A-Za-z_-]{16,64}\\b",
287
+ flags: "g"
288
+ },
289
+ excerpt: {
290
+ kind: "mask",
291
+ keep: 3
292
+ }
293
+ },
294
+ {
295
+ id: "huggingface-token",
296
+ tier: "block",
297
+ scopes: ["query", "publish", "team"],
298
+ description: "Hugging Face user access token (hf_).",
299
+ source: "gitleaks:huggingface-access-token",
300
+ match: {
301
+ kind: "regex",
302
+ pattern: "\\bhf_[0-9A-Za-z]{30,}\\b",
303
+ flags: "g"
304
+ },
305
+ excerpt: {
306
+ kind: "mask",
307
+ keep: 3
308
+ }
309
+ },
310
+ {
311
+ id: "vercel-token",
312
+ tier: "block",
313
+ scopes: ["query", "publish", "team"],
314
+ description: "Vercel Blob read/write store token.",
315
+ source: "tenjin (shape from the Vercel Blob docs)",
316
+ match: {
317
+ kind: "regex",
318
+ pattern: "\\bvercel_blob_[a-z]{2}_[0-9A-Za-z_]{24,}\\b",
319
+ flags: "g"
320
+ },
321
+ excerpt: {
322
+ kind: "mask",
323
+ keep: 12
324
+ }
325
+ },
326
+ {
327
+ id: "vercel-token",
328
+ tier: "block",
329
+ scopes: ["query", "publish", "team"],
330
+ description: "Vercel platform token (vcp_/vci_/vca_/vcr_/vck_ prefixes).",
331
+ source: "secretlint:@secretlint/secretlint-rule-vercel",
332
+ match: {
333
+ kind: "regex",
334
+ pattern: "\\b(?:vcp|vci|vca|vcr|vck)_[0-9A-Za-z]{20,60}(?![0-9A-Za-z])",
335
+ flags: "g"
336
+ },
337
+ excerpt: {
338
+ kind: "mask",
339
+ keep: 4
340
+ }
341
+ },
342
+ {
343
+ id: "notion-token",
344
+ tier: "block",
345
+ scopes: ["query", "publish", "team"],
346
+ description: "Notion integration token (ntn_).",
347
+ source: "secretlint:@secretlint/secretlint-rule-notion",
348
+ match: {
349
+ kind: "regex",
350
+ pattern: "\\bntn_[0-9]{11}[0-9A-Za-z]{35}(?![0-9A-Za-z])",
351
+ flags: "g"
352
+ },
353
+ excerpt: {
354
+ kind: "mask",
355
+ keep: 4
356
+ }
357
+ },
358
+ {
359
+ id: "linear-token",
360
+ tier: "block",
361
+ scopes: ["query", "publish", "team"],
362
+ description: "Linear API key (lin_api_).",
363
+ source: "secretlint:@secretlint/secretlint-rule-linear",
364
+ match: {
365
+ kind: "regex",
366
+ pattern: "\\blin_api_[0-9A-Za-z_]{32,128}(?![0-9A-Za-z_])",
367
+ flags: "g"
368
+ },
369
+ excerpt: {
370
+ kind: "mask",
371
+ keep: 8
372
+ }
373
+ },
374
+ {
375
+ id: "figma-token",
376
+ tier: "block",
377
+ scopes: ["query", "publish", "team"],
378
+ description: "Figma personal access token (figd_).",
379
+ source: "secretlint:@secretlint/secretlint-rule-figma",
380
+ match: {
381
+ kind: "regex",
382
+ pattern: "\\bfigd_[0-9A-Za-z_-]{40,200}(?![0-9A-Za-z_-])",
383
+ flags: "g"
384
+ },
385
+ excerpt: {
386
+ kind: "mask",
387
+ keep: 5
388
+ }
389
+ },
390
+ {
391
+ id: "gitlab-token",
392
+ tier: "block",
393
+ scopes: ["query", "publish", "team"],
394
+ description: "GitLab personal access token (glpat-).",
395
+ source: "secretlint:@secretlint/secretlint-rule-gitlab",
396
+ match: {
397
+ kind: "regex",
398
+ pattern: "\\bglpat-[0-9A-Za-z_-]{20,128}(?![0-9A-Za-z_-])",
399
+ flags: "g"
400
+ },
401
+ excerpt: {
402
+ kind: "mask",
403
+ keep: 6
404
+ }
405
+ },
406
+ {
407
+ id: "docker-token",
408
+ tier: "block",
409
+ scopes: ["query", "publish", "team"],
410
+ description: "Docker Hub personal access token (dckr_pat_).",
411
+ source: "secretlint:@secretlint/secretlint-rule-docker",
412
+ match: {
413
+ kind: "regex",
414
+ pattern: "\\bdckr_pat_[0-9A-Za-z_-]{27}(?![0-9A-Za-z_-])",
415
+ flags: "g"
416
+ },
417
+ excerpt: {
418
+ kind: "mask",
419
+ keep: 9
420
+ }
421
+ },
422
+ {
423
+ id: "cloudflare-token",
424
+ tier: "block",
425
+ scopes: ["query", "publish", "team"],
426
+ description: "Cloudflare API key or account/user token (cfk_/cfut_/cfat_).",
427
+ source: "secretlint:@secretlint/secretlint-rule-cloudflare",
428
+ match: {
429
+ kind: "regex",
430
+ pattern: "\\b(?:cfk|cfut|cfat)_[0-9A-Za-z]{40}[0-9a-f]{8}(?![0-9A-Za-z])",
431
+ flags: "g"
432
+ },
433
+ excerpt: {
434
+ kind: "mask",
435
+ keep: 4
436
+ }
437
+ },
438
+ {
439
+ id: "databricks-token",
440
+ tier: "block",
441
+ scopes: ["query", "publish", "team"],
442
+ description: "Databricks personal access token (dapi).",
443
+ source: "secretlint:@secretlint/secretlint-rule-databricks",
444
+ match: {
445
+ kind: "regex",
446
+ pattern: "\\bdapi[0-9A-Fa-f]{32}(?:-[0-9])?(?![0-9A-Fa-f])",
447
+ flags: "g"
448
+ },
449
+ excerpt: {
450
+ kind: "mask",
451
+ keep: 4
452
+ }
453
+ },
454
+ {
455
+ id: "openssh-private-key",
456
+ tier: "block",
457
+ scopes: ["query", "publish", "team"],
458
+ description: "OpenSSH private key body pasted without its PEM framing (base64 of the openssh-key-v1 magic).",
459
+ source: "gitleaks:private-key (framing-free variant)",
460
+ match: {
461
+ kind: "regex",
462
+ pattern: "\\bb3BlbnNzaC1rZXktdjEA[0-9A-Za-z+/=]{20,}",
463
+ flags: "g"
464
+ },
465
+ excerpt: {
466
+ kind: "mask",
467
+ keep: 8
468
+ }
469
+ },
470
+ {
471
+ id: "totp-uri",
472
+ tier: "block",
473
+ scopes: ["query", "publish", "team"],
474
+ description: "otpauth:// TOTP/HOTP provisioning URI; its secret= parameter is a live second factor.",
475
+ source: "tenjin (RFC-style otpauth key URI)",
476
+ match: {
477
+ kind: "regex",
478
+ pattern: "\\botpauth:\\/\\/[ht]otp\\/[^\\s\"'`<>)\\]]+",
479
+ flags: "gi"
480
+ },
481
+ excerpt: {
482
+ kind: "mask",
483
+ keep: 15
484
+ }
485
+ },
486
+ {
487
+ id: "db-connection-uri",
488
+ tier: "block",
489
+ scopes: ["query", "publish", "team"],
490
+ 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.",
491
+ source: "tenjin",
492
+ match: {
493
+ kind: "regex",
494
+ pattern: "\\b([a-z][a-z0-9+.-]{0,31}):\\/\\/([^\\s:@/]*):([^\\s@/]+)@([^\\s/:]+)",
495
+ flags: "gi"
496
+ },
497
+ excerpt: {
498
+ kind: "custom",
499
+ handler: "dbConnectionUri"
500
+ },
501
+ skip: {
502
+ handler: "exampleDbPassword"
503
+ }
504
+ },
505
+ {
506
+ id: "bearer-token",
507
+ tier: "block",
508
+ scopes: ["query", "publish", "team"],
509
+ description: "Authorization: Bearer header carrying a live token.",
510
+ source: "tenjin",
511
+ match: {
512
+ kind: "regex",
513
+ pattern: "\\bAuthorization:\\s*Bearer\\s+(\\S{8,})",
514
+ flags: "gi"
515
+ },
516
+ excerpt: {
517
+ kind: "custom",
518
+ handler: "bearerToken"
519
+ },
520
+ skip: {
521
+ handler: "placeholderGroup1"
522
+ }
523
+ },
524
+ {
525
+ id: "wallet-address",
526
+ tier: "warn",
527
+ scopes: ["publish"],
528
+ description: "EVM account/contract address (0x + 40 hex).",
529
+ source: "blockrun-mcp (wallet-key leak scanner)",
530
+ match: {
531
+ kind: "regex",
532
+ pattern: "(?<![0-9a-fx])0x[0-9a-fA-F]{40}(?![0-9a-fA-F])",
533
+ flags: "gi"
534
+ },
535
+ excerpt: {
536
+ kind: "abbreviate",
537
+ head: 6,
538
+ tail: 4
539
+ }
540
+ },
541
+ {
542
+ id: "confidential-marker",
543
+ tier: "warn",
544
+ scopes: ["publish"],
545
+ description: "Document classification legend (CONFIDENTIAL stamp, INTERNAL USE ONLY, DO NOT DISTRIBUTE). Case-sensitive: marker-shaped, not word-in-phrase.",
546
+ source: "tenjin",
547
+ match: {
548
+ kind: "regex",
549
+ 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",
550
+ flags: "g"
551
+ },
552
+ excerpt: {
553
+ kind: "verbatim"
554
+ }
555
+ },
556
+ {
557
+ id: "internal-hostname",
558
+ tier: "warn",
559
+ scopes: ["publish"],
560
+ 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.",
561
+ source: "tenjin",
562
+ match: {
563
+ kind: "regex",
564
+ pattern: "\\b(?:[a-z0-9-]{1,63}\\.){1,6}(?:internal|corp|local|lan|intranet)\\b",
565
+ flags: "gi"
566
+ },
567
+ excerpt: {
568
+ kind: "verbatim"
569
+ }
570
+ },
571
+ {
572
+ id: "private-network-endpoint",
573
+ tier: "warn",
574
+ scopes: ["publish"],
575
+ description: "RFC1918 / link-local IPv4 endpoint (10/8, 172.16/12, 192.168/16, 169.254/16).",
576
+ source: "tenjin (closes tenjin-agent#45)",
577
+ match: {
578
+ kind: "regex",
579
+ 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)",
580
+ flags: "g"
581
+ },
582
+ excerpt: {
583
+ kind: "verbatim"
584
+ }
585
+ },
586
+ {
587
+ id: "private-network-endpoint",
588
+ tier: "warn",
589
+ scopes: ["publish"],
590
+ description: "Loopback / wildcard-bind development endpoint. Scheme or port required so prose about localhost does not warn.",
591
+ source: "tenjin (closes tenjin-agent#45)",
592
+ match: {
593
+ kind: "regex",
594
+ 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",
595
+ flags: "gi"
596
+ },
597
+ excerpt: {
598
+ kind: "verbatim",
599
+ max: 80
600
+ }
601
+ },
602
+ {
603
+ id: "collaboration-url",
604
+ tier: "warn",
605
+ scopes: ["publish"],
606
+ description: "Link into a collaboration workspace (Google Docs/Drive, Notion, Figma, Slack archives, Linear, Jira/Confluence): the target is usually access-controlled.",
607
+ source: "tenjin (closes tenjin-agent#45)",
608
+ match: {
609
+ kind: "regex",
610
+ 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\"'`<>?&)\\]]*)?",
611
+ flags: "gi"
612
+ },
613
+ excerpt: {
614
+ kind: "verbatim",
615
+ max: 80
616
+ }
617
+ },
618
+ {
619
+ id: "cloud-resource-id",
620
+ tier: "warn",
621
+ scopes: ["publish"],
622
+ description: "AWS ARN: names an account, region, and resource.",
623
+ source: "tenjin (closes tenjin-agent#45)",
624
+ match: {
625
+ kind: "regex",
626
+ pattern: "\\barn:aws[0-9a-z-]*:[0-9a-z-]+:[0-9a-z-]*:\\d{0,12}:[^\\s\"'`<>,)\\]]+",
627
+ flags: "gi"
628
+ },
629
+ excerpt: {
630
+ kind: "verbatim",
631
+ max: 80
632
+ }
633
+ },
634
+ {
635
+ id: "cloud-resource-id",
636
+ tier: "warn",
637
+ scopes: ["publish"],
638
+ description: "GCP fully-qualified resource name (projects/<id>/<collection>/<name>).",
639
+ source: "tenjin (closes tenjin-agent#45)",
640
+ match: {
641
+ kind: "regex",
642
+ 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\"'`<>,)\\]]+",
643
+ flags: "g"
644
+ },
645
+ excerpt: {
646
+ kind: "verbatim",
647
+ max: 80
648
+ }
649
+ },
650
+ {
651
+ id: "cloud-resource-id",
652
+ tier: "warn",
653
+ scopes: ["publish"],
654
+ description: "Azure resource id: /subscriptions/<guid>/resourceGroups/<name>/...",
655
+ source: "tenjin (closes tenjin-agent#45)",
656
+ match: {
657
+ kind: "regex",
658
+ 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\"'`<>,)\\]]*)?",
659
+ flags: "g"
660
+ },
661
+ excerpt: {
662
+ kind: "verbatim",
663
+ max: 80
664
+ }
665
+ },
666
+ {
667
+ id: "cloud-resource-id",
668
+ tier: "warn",
669
+ scopes: ["publish"],
670
+ description: "Cloud object-storage location (s3://, gs://, or an S3/Azure Blob/GCS bucket hostname).",
671
+ source: "tenjin (closes tenjin-agent#45)",
672
+ match: {
673
+ kind: "regex",
674
+ 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",
675
+ flags: "gi"
676
+ },
677
+ excerpt: {
678
+ kind: "verbatim",
679
+ max: 80
680
+ }
681
+ },
682
+ {
683
+ id: "local-path",
684
+ tier: "warn",
685
+ scopes: ["publish"],
686
+ description: "Home-anchored local filesystem path: leaks the machine username and private project layout.",
687
+ source: "tenjin",
688
+ match: {
689
+ kind: "regex",
690
+ pattern: `(?:(?<![\\w.-])\\/(?:Users|home)\\/([A-Za-z0-9._-]+)(?:\\/[^\\s"'\`)\\]}>:,;?&/]+)+|\\b[A-Za-z]:\\\\[Uu]sers\\\\([^\\\\\\s"']+)(?:\\\\[^\\\\\\s"']+)+)`,
691
+ flags: "dg"
692
+ },
693
+ excerpt: {
694
+ kind: "custom",
695
+ handler: "localPath"
696
+ },
697
+ skip: {
698
+ handler: "placeholderUsername"
699
+ }
700
+ },
701
+ {
702
+ id: "customer-identifier",
703
+ tier: "warn",
704
+ scopes: ["publish"],
705
+ description: "Labeled customer/account/tenant identifier with a literal value.",
706
+ source: "tenjin",
707
+ match: {
708
+ kind: "regex",
709
+ pattern: `\\b((?:customer|client|account|tenant|subscriber)[ _-]?(?:id|number|no))\\b\\s*[:=#]\\s*("[^"]{2,}"|'[^']{2,}'|[A-Za-z0-9][A-Za-z0-9._-]{2,})`,
710
+ flags: "gi"
711
+ },
712
+ excerpt: {
713
+ kind: "custom",
714
+ handler: "labeledValue"
715
+ },
716
+ skip: {
717
+ handler: "nonLiteralValue"
718
+ }
719
+ },
720
+ {
721
+ id: "paid-content-marker",
722
+ tier: "warn",
723
+ scopes: ["publish"],
724
+ description: "Third-party rights legend suggesting copied licensed material. Legend shapes only: bare paywall vocabulary is this marketplace\u2019s own subject matter.",
725
+ source: "tenjin",
726
+ match: {
727
+ kind: "regex",
728
+ 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",
729
+ flags: "gi"
730
+ },
731
+ excerpt: {
732
+ kind: "verbatim"
733
+ }
734
+ },
735
+ {
736
+ id: "embedded-instruction",
737
+ tier: "warn",
738
+ scopes: ["publish"],
739
+ description: "Injection-shaped imperative captured from a prompt or tool output.",
740
+ source: "tenjin",
741
+ match: {
742
+ kind: "regex",
743
+ 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",
744
+ flags: "gi"
745
+ },
746
+ excerpt: {
747
+ kind: "verbatim"
748
+ }
749
+ },
750
+ {
751
+ id: "embedded-instruction",
752
+ tier: "warn",
753
+ scopes: ["publish"],
754
+ description: "Hidden-prompt document header. Case-sensitive: the all-caps header form is the injection-typed one.",
755
+ source: "tenjin",
756
+ match: {
757
+ kind: "regex",
758
+ pattern: "\\bBEGIN (?:SYSTEM|HIDDEN) (?:PROMPT|INSTRUCTIONS)\\b",
759
+ flags: "g"
760
+ },
761
+ excerpt: {
762
+ kind: "verbatim"
763
+ }
764
+ },
765
+ {
766
+ id: "email",
767
+ tier: "warn",
768
+ scopes: ["publish"],
769
+ 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.",
770
+ source: "tenjin",
771
+ match: {
772
+ kind: "regex",
773
+ 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",
774
+ flags: "g"
775
+ },
776
+ excerpt: {
777
+ kind: "verbatim"
778
+ },
779
+ skip: {
780
+ handler: "reservedExampleEmail"
781
+ }
782
+ },
783
+ {
784
+ id: "phone",
785
+ tier: "warn",
786
+ scopes: ["publish"],
787
+ description: "Telephone number (PII).",
788
+ source: "tenjin",
789
+ match: {
790
+ kind: "regex",
791
+ pattern: "(?<!\\d)(?:\\+?\\d{1,2}[\\s.-]?)?(?:\\(\\d{3}\\)|\\d{3})[\\s.-]\\d{3}[\\s.-]\\d{4}(?!\\d)",
792
+ flags: "g"
793
+ },
794
+ excerpt: {
795
+ kind: "verbatim"
796
+ }
797
+ },
798
+ {
799
+ id: "raw-private-key",
800
+ tier: "block",
801
+ scopes: ["publish", "team"],
802
+ 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.",
803
+ source: "blockrun-mcp (wallet-key leak scanner)",
804
+ match: {
805
+ kind: "algorithm",
806
+ algorithm: "hex64"
807
+ },
808
+ excerpt: {
809
+ kind: "custom",
810
+ handler: "hex64"
811
+ }
812
+ },
813
+ {
814
+ id: "pem-private-key",
815
+ tier: "block",
816
+ scopes: ["publish", "team"],
817
+ description: "PEM private-key armor (-----BEGIN ... PRIVATE KEY-----), RSA/EC/OPENSSH/PGP variants.",
818
+ source: "gitleaks:private-key",
819
+ match: {
820
+ kind: "algorithm",
821
+ algorithm: "pemBlock"
822
+ },
823
+ excerpt: {
824
+ kind: "custom",
825
+ handler: "pemBlock"
826
+ }
827
+ },
828
+ {
829
+ id: "bip39-seed-phrase",
830
+ tier: "block",
831
+ scopes: ["publish", "team"],
832
+ description: "Twelve or more consecutive BIP-39 English wordlist words separated only by spaces or tabs: a wallet recovery phrase.",
833
+ source: "tenjin; wordlist from BIP-0039 (see NOTICE.md)",
834
+ match: {
835
+ kind: "algorithm",
836
+ algorithm: "bip39"
837
+ },
838
+ excerpt: {
839
+ kind: "custom",
840
+ handler: "bip39"
841
+ }
842
+ },
843
+ {
844
+ id: "env-dump-block",
845
+ tier: "warn",
846
+ scopes: ["publish"],
847
+ description: "Three or more consecutive SHOUTY_KEY=value lines carrying at least one substantial literal: a pasted .env file.",
848
+ source: "tenjin",
849
+ match: {
850
+ kind: "algorithm",
851
+ algorithm: "envDump"
852
+ },
853
+ excerpt: {
854
+ kind: "custom",
855
+ handler: "envDump"
856
+ }
857
+ },
858
+ {
859
+ id: "high-entropy-string",
860
+ tier: "warn",
861
+ scopes: ["publish"],
862
+ 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.",
863
+ source: "tenjin (entropy heuristic in the spirit of gitleaks entropy gating)",
864
+ match: {
865
+ kind: "algorithm",
866
+ algorithm: "entropy"
867
+ },
868
+ excerpt: {
869
+ kind: "custom",
870
+ handler: "entropy"
871
+ }
872
+ },
873
+ {
874
+ id: "long-verbatim-quote",
875
+ tier: "warn",
876
+ scopes: ["publish"],
877
+ description: "Fenced block or blockquote run long enough to read as copied third-party material.",
878
+ source: "tenjin",
879
+ match: {
880
+ kind: "algorithm",
881
+ algorithm: "longVerbatim"
882
+ },
883
+ excerpt: {
884
+ kind: "custom",
885
+ handler: "longVerbatim"
886
+ }
887
+ }
888
+ ]
889
+ };
890
+
891
+ // src/lib/bip39-wordlist.json
892
+ var bip39_wordlist_default = {
893
+ source: "BIP-0039 English wordlist (bitcoin/bips), as distributed by @scure/bip39 (MIT). Vendored as data, not as a dependency: see NOTICE.md.",
894
+ count: 2048,
895
+ 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"
896
+ };
897
+
898
+ // src/lib/redact.ts
899
+ var LONG_QUOTE_WORDS = 80;
900
+ function findings(text, scope) {
901
+ const lines = text.split("\n");
902
+ const found = [
903
+ ...scanHex64(lines),
904
+ ...scanLineDetectors(lines),
905
+ ...scanPemBlocks(lines),
906
+ ...scanSeedPhrases(lines),
907
+ ...scanEnvDumpBlocks(lines),
908
+ ...scanLongVerbatim(lines)
909
+ ];
910
+ const named = dedupeAndSort(suppressEmailsInDbUris(found));
911
+ const all = dedupeAndSort([...named, ...scanHighEntropy(lines, named)]);
912
+ if (scope === "publish") return all;
913
+ const keep = CHECKS[scope];
914
+ return all.filter((f) => keep.has(f.check));
915
+ }
916
+ function mask(text) {
917
+ let out = text.replace(/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g, "");
918
+ for (const detector of MASK_DETECTORS) {
919
+ out = out.replace(detector.re, (...args) => {
920
+ const m = args;
921
+ return detector.skip?.(m) === true ? m[0] : detector.excerpt(m);
922
+ });
923
+ }
924
+ return out;
925
+ }
926
+ function maskRules() {
927
+ return CORPUS.rules.filter((r) => r.scopes.includes("query") && r.match.kind === "regex").map((r) => ({
928
+ pattern: r.match.pattern ?? "",
929
+ flags: r.match.flags ?? "g",
930
+ keep: r.excerpt.kind === "mask" ? r.excerpt.keep ?? 0 : 0
931
+ }));
932
+ }
933
+ var SCOPES = /* @__PURE__ */ new Set(["query", "publish", "team"]);
934
+ var CORPUS = redact_rules_default;
935
+ var ALGORITHMS = /* @__PURE__ */ new Set(["hex64", "pemBlock", "bip39", "envDump", "entropy", "longVerbatim"]);
936
+ var EXCERPT_HANDLERS = {
937
+ googleKey: (m) => maskKeeping(m[0], m[0].startsWith("AIza") ? 4 : 7),
938
+ dbConnectionUri: (m) => `${m[1]}://${m[2]}:[redacted]@${m[4]}`,
939
+ bearerToken: (m) => `Authorization: Bearer [redacted ${m[1]?.length ?? 0} chars]`,
940
+ labeledValue: (m) => `${m[1]}=[redacted ${dequote(m[2] ?? "").length} chars]`,
941
+ localPath: localPathExcerpt
942
+ };
943
+ var SKIP_HANDLERS = {
944
+ exampleDbPassword: (m) => isPlaceholder(m[3] ?? "") || isExamplePassword(m[3] ?? ""),
945
+ placeholderGroup1: (m) => isPlaceholder(m[1] ?? ""),
946
+ nonLiteralValue: skipNonLiteralValue,
947
+ placeholderUsername: (m) => PLACEHOLDER_USERNAME.test(m[1] ?? m[2] ?? ""),
948
+ reservedExampleEmail: (m) => RESERVED_EXAMPLE_DOMAIN.test(m[0])
949
+ };
950
+ function validateScopes(rule) {
951
+ if (!Array.isArray(rule.scopes) || rule.scopes.length === 0) {
952
+ throw new Error(`redact-rules.json: rule ${rule.id} has no scopes`);
953
+ }
954
+ for (const scope of rule.scopes) {
955
+ if (!SCOPES.has(scope))
956
+ throw new Error(`redact-rules.json: rule ${rule.id} names unknown scope ${scope}`);
957
+ }
958
+ if (rule.tier !== "block" && rule.tier !== "warn") {
959
+ throw new Error(`redact-rules.json: rule ${rule.id} has unknown tier ${String(rule.tier)}`);
960
+ }
961
+ if (!rule.scopes.includes("publish")) {
962
+ throw new Error(`redact-rules.json: rule ${rule.id} reports for team but not publish`);
963
+ }
964
+ if (rule.tier === "block" && !rule.scopes.includes("team")) {
965
+ throw new Error(`redact-rules.json: block rule ${rule.id} must be scoped to team as well`);
966
+ }
967
+ if (rule.scopes.includes("query") && rule.match.kind !== "regex") {
968
+ throw new Error(
969
+ `redact-rules.json: rule ${rule.id} is masked in queries but is not a regex row`
970
+ );
971
+ }
972
+ }
973
+ function compileSkip(rule) {
974
+ const skip = rule.skip === void 0 ? void 0 : SKIP_HANDLERS[rule.skip.handler];
975
+ if (rule.skip !== void 0 && skip === void 0) {
976
+ throw new Error(`redact-rules.json: rule ${rule.id} names unknown skip ${rule.skip.handler}`);
977
+ }
978
+ return skip;
979
+ }
980
+ function compileRegex(rule) {
981
+ if (rule.match.kind !== "regex" || rule.match.pattern === void 0) {
982
+ throw new Error(`redact-rules.json: rule ${rule.id} has unknown match kind ${rule.match.kind}`);
983
+ }
984
+ return new RegExp(rule.match.pattern, rule.match.flags ?? "g");
985
+ }
986
+ function compileLineDetectors(rules) {
987
+ const out = [];
988
+ for (const rule of rules) {
989
+ if (rule.match.kind === "algorithm") continue;
990
+ out.push({
991
+ check: rule.id,
992
+ severity: rule.tier,
993
+ scopes: new Set(rule.scopes),
994
+ re: compileRegex(rule),
995
+ excerpt: compileExcerpt(rule),
996
+ skip: compileSkip(rule)
997
+ });
998
+ }
999
+ return out;
1000
+ }
1001
+ function validateCorpus(rules) {
1002
+ for (const rule of rules) {
1003
+ validateScopes(rule);
1004
+ if (rule.match.kind === "algorithm") {
1005
+ if (!ALGORITHMS.has(rule.match.algorithm ?? "")) {
1006
+ throw new Error(`redact-rules.json: rule ${rule.id} names unknown algorithm`);
1007
+ }
1008
+ continue;
1009
+ }
1010
+ compileRegex(rule);
1011
+ }
1012
+ for (const algorithm of ALGORITHMS) {
1013
+ const rows = rules.filter(
1014
+ (r) => r.match.kind === "algorithm" && r.match.algorithm === algorithm
1015
+ );
1016
+ if (rows.length !== 1) {
1017
+ throw new Error(
1018
+ `redact-rules.json: algorithm ${algorithm} has ${rows.length} rows, needs exactly one`
1019
+ );
1020
+ }
1021
+ }
1022
+ }
1023
+ function compileExcerpt(rule) {
1024
+ const policy = rule.excerpt;
1025
+ switch (policy.kind) {
1026
+ case "mask": {
1027
+ const keep = policy.keep ?? 0;
1028
+ return (m) => maskKeeping(m[0], keep);
1029
+ }
1030
+ case "verbatim": {
1031
+ const max = policy.max;
1032
+ return (m) => max === void 0 ? m[0] : truncate(m[0], max);
1033
+ }
1034
+ case "abbreviate": {
1035
+ const head = policy.head ?? 6;
1036
+ const tail = policy.tail ?? 4;
1037
+ return (m) => `${m[0].slice(0, head)}\u2026${m[0].slice(-tail)}`;
1038
+ }
1039
+ case "custom": {
1040
+ const handler = EXCERPT_HANDLERS[policy.handler ?? ""];
1041
+ if (handler === void 0) {
1042
+ throw new Error(`redact-rules.json: rule ${rule.id} names unknown excerpt handler`);
1043
+ }
1044
+ return handler;
1045
+ }
1046
+ default:
1047
+ throw new Error(`redact-rules.json: rule ${rule.id} has unknown excerpt kind ${policy.kind}`);
1048
+ }
1049
+ }
1050
+ validateCorpus(CORPUS.rules);
1051
+ var LINE_DETECTORS = compileLineDetectors(CORPUS.rules);
1052
+ var MASK_DETECTORS = LINE_DETECTORS.filter((d) => d.scopes.has("query"));
1053
+ function scanLineDetectors(lines) {
1054
+ const out = [];
1055
+ for (let i = 0; i < lines.length; i++) {
1056
+ const line = lines[i] ?? "";
1057
+ for (const detector of LINE_DETECTORS) {
1058
+ detector.re.lastIndex = 0;
1059
+ let m;
1060
+ while ((m = detector.re.exec(line)) !== null) {
1061
+ if (!isSuppressedAsDocs(detector, m) && detector.skip?.(m) !== true) {
1062
+ out.push({
1063
+ check: detector.check,
1064
+ severity: detector.severity,
1065
+ line: i + 1,
1066
+ span: [m.index, m.index + m[0].length],
1067
+ excerpt: detector.excerpt(m)
1068
+ });
1069
+ }
1070
+ }
1071
+ }
1072
+ }
1073
+ return out;
1074
+ }
1075
+ var DOCS_PLACEHOLDER = /x{6,}|<[^<>]*>|\{\{[^{}]*\}\}|\byour[_-]?(?:key|token|secret|password)\b/i;
1076
+ function isSuppressedAsDocs(detector, m) {
1077
+ return detector.severity === "warn" && DOCS_PLACEHOLDER.test(m[0]);
1078
+ }
1079
+ var RESERVED_EXAMPLE_DOMAIN = /@(?:[A-Za-z0-9-]+\.)*example\.(?:com|org|net)$/i;
1080
+ var PLACEHOLDER_USERNAME = /^(?:user(?:name)?|you(?:rname)?|example|foo|me|myuser|somebody)$/i;
1081
+ function suppressEmailsInDbUris(findings2) {
1082
+ const uris = findings2.filter((f) => f.check === "db-connection-uri");
1083
+ if (uris.length === 0) return findings2;
1084
+ return findings2.filter(
1085
+ (f) => f.check !== "email" || !uris.some((u) => u.line === f.line && f.span[0] >= u.span[0] && f.span[1] <= u.span[1])
1086
+ );
1087
+ }
1088
+ function maskKeeping(match, prefixLen) {
1089
+ const prefix = match.slice(0, Math.min(prefixLen, match.length));
1090
+ return `${prefix}\u2026[redacted ${match.length - prefix.length} chars]`;
1091
+ }
1092
+ function truncate(value, max) {
1093
+ return value.length > max ? `${value.slice(0, max - 3)}\u2026` : value;
1094
+ }
1095
+ function localPathExcerpt(m) {
1096
+ const bounds = m.indices?.[1] ?? m.indices?.[2];
1097
+ const masked = bounds === void 0 ? m[0] : `${m[0].slice(0, bounds[0] - m.index)}[user]${m[0].slice(bounds[1] - m.index)}`;
1098
+ return truncate(masked, 60);
1099
+ }
1100
+ function skipNonLiteralValue(m) {
1101
+ const raw = m[2] ?? "";
1102
+ const value = dequote(raw);
1103
+ if (isPlaceholder(value) || isStructural(value)) return true;
1104
+ return raw === value && isCodeExpression(value);
1105
+ }
1106
+ function dequote(value) {
1107
+ const m = /^"([^"]*)"$|^'([^']*)'$/.exec(value);
1108
+ return m !== null ? m[1] ?? m[2] ?? "" : value;
1109
+ }
1110
+ var PLACEHOLDER_WORD = /^(?:xxx+|example|example-value|placeholder|redacted|changeme|dummy|sample|todo|tbd|none|null|secret|test|\*+|\.{3,})$/i;
1111
+ var PLACEHOLDER_PREFIX = /^(?:your|my)[-_][a-z]+(?:[-_][a-z]+)*$/i;
1112
+ function isPlaceholder(value) {
1113
+ if (/^[<${%]/.test(value)) return true;
1114
+ return PLACEHOLDER_WORD.test(value) || PLACEHOLDER_PREFIX.test(value);
1115
+ }
1116
+ function isCodeExpression(value) {
1117
+ const v = value.replace(/[,;]+$/, "");
1118
+ if (/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)+$/.test(v)) return true;
1119
+ if (/^[A-Za-z_$][\w$.]*\([^)]*\)$/.test(v)) return true;
1120
+ if (/\($/.test(v)) return true;
1121
+ return /^[a-z_$][a-z_$]*$/.test(v);
1122
+ }
1123
+ function isStructural(value) {
1124
+ return /^(?:\.?\.?\/|~\/|https?:\/\/|\^)/.test(value);
1125
+ }
1126
+ var EXAMPLE_PASSWORDS = /* @__PURE__ */ new Set([
1127
+ "password",
1128
+ "postgres",
1129
+ "mysql",
1130
+ "root",
1131
+ "admin",
1132
+ "changeme",
1133
+ "example",
1134
+ "secret",
1135
+ "test",
1136
+ "guest",
1137
+ "toor"
1138
+ ]);
1139
+ function isExamplePassword(password) {
1140
+ return EXAMPLE_PASSWORDS.has(password.toLowerCase());
1141
+ }
1142
+ var HEX64_RE = /(?<![0-9a-fx])0x[0-9a-fA-F]{64}(?![0-9a-fA-F])/gi;
1143
+ 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;
1144
+ var PUBLIC_HEX_CONSTANTS = new Set(
1145
+ (CORPUS.publicHexConstants ?? []).map((c) => c.value.toLowerCase())
1146
+ );
1147
+ function scanHex64(lines) {
1148
+ const out = [];
1149
+ for (let i = 0; i < lines.length; i++) {
1150
+ const line = lines[i] ?? "";
1151
+ HEX64_RE.lastIndex = 0;
1152
+ let m;
1153
+ while ((m = HEX64_RE.exec(line)) !== null) {
1154
+ const hash = isHashContext(line, m.index, m[0]);
1155
+ out.push({
1156
+ check: hash ? "hex32-value" : "raw-private-key",
1157
+ severity: hash ? "warn" : "block",
1158
+ line: i + 1,
1159
+ span: [m.index, m.index + m[0].length],
1160
+ excerpt: hash ? `${m[0].slice(0, 6)}\u2026${m[0].slice(-4)}` : maskKeeping(m[0], 2)
1161
+ });
1162
+ }
1163
+ }
1164
+ return out;
1165
+ }
1166
+ var LABEL_LOOKBACK = 256;
1167
+ function isHashContext(line, matchIndex, match) {
1168
+ if (PUBLIC_HEX_CONSTANTS.has(match.toLowerCase())) return true;
1169
+ const from = Math.max(0, matchIndex - LABEL_LOOKBACK);
1170
+ const before = line.slice(from, matchIndex);
1171
+ const labelWindow = from === 0 ? before : before.replace(/^[A-Za-z0-9]+/, "");
1172
+ if (HASH_LABEL_RE.test(labelWindow)) return true;
1173
+ const prefix = /(\S*)$/.exec(before)?.[1] ?? "";
1174
+ return /^https?:\/\//.test(line.slice(matchIndex - prefix.length));
1175
+ }
1176
+ var PEM_BEGIN = /-----BEGIN[ A-Z0-9]*PRIVATE KEY(?: BLOCK)?-----/;
1177
+ function scanPemBlocks(lines) {
1178
+ const out = [];
1179
+ for (let i = 0; i < lines.length; i++) {
1180
+ const line = lines[i] ?? "";
1181
+ const m = PEM_BEGIN.exec(line);
1182
+ if (m !== null) {
1183
+ out.push({
1184
+ check: "pem-private-key",
1185
+ severity: "block",
1186
+ line: i + 1,
1187
+ span: [m.index, m.index + m[0].length],
1188
+ excerpt: m[0]
1189
+ // the header marker only — no key material follows on it
1190
+ });
1191
+ }
1192
+ }
1193
+ return out;
1194
+ }
1195
+ var BIP39_WORDS = new Set(bip39_wordlist_default.words.split(" "));
1196
+ var SEED_PHRASE_MIN_WORDS = 12;
1197
+ function scanSeedPhrases(lines) {
1198
+ const out = [];
1199
+ const token = /\S+/g;
1200
+ for (let i = 0; i < lines.length; i++) {
1201
+ const line = lines[i] ?? "";
1202
+ token.lastIndex = 0;
1203
+ let runStart = -1;
1204
+ let runEnd = -1;
1205
+ let runWords = 0;
1206
+ let m;
1207
+ const flush = () => {
1208
+ if (runWords >= SEED_PHRASE_MIN_WORDS) {
1209
+ out.push({
1210
+ check: "bip39-seed-phrase",
1211
+ severity: "block",
1212
+ line: i + 1,
1213
+ span: [runStart, runEnd],
1214
+ excerpt: `[redacted ${runWords}-word BIP-39 recovery phrase]`
1215
+ });
1216
+ }
1217
+ runWords = 0;
1218
+ };
1219
+ while ((m = token.exec(line)) !== null) {
1220
+ if (BIP39_WORDS.has(m[0])) {
1221
+ if (runWords === 0) runStart = m.index;
1222
+ runEnd = m.index + m[0].length;
1223
+ runWords++;
1224
+ } else {
1225
+ flush();
1226
+ }
1227
+ }
1228
+ flush();
1229
+ }
1230
+ return out;
1231
+ }
1232
+ var ENV_LINE = /^\s*(?:export\s+)?([A-Z][A-Z0-9_]{2,})=(\S.*)$/;
1233
+ var ENV_BLOCK_MIN_LINES = 3;
1234
+ var ENV_SUBSTANTIAL_VALUE = 12;
1235
+ function scanEnvDumpBlocks(lines) {
1236
+ const out = [];
1237
+ let i = 0;
1238
+ while (i < lines.length) {
1239
+ const keys = [];
1240
+ let substantial = false;
1241
+ const start = i;
1242
+ let m;
1243
+ while (i < lines.length && (m = ENV_LINE.exec(lines[i] ?? "")) !== null) {
1244
+ keys.push(m[1] ?? "");
1245
+ const value = dequote((m[2] ?? "").trim());
1246
+ if (value.length >= ENV_SUBSTANTIAL_VALUE && !isPlaceholder(value) && !isStructural(value)) {
1247
+ substantial = true;
1248
+ }
1249
+ i++;
1250
+ }
1251
+ if (keys.length >= ENV_BLOCK_MIN_LINES && substantial) {
1252
+ const shown = keys.slice(0, 3).join(", ");
1253
+ const rest = keys.length - 3;
1254
+ out.push({
1255
+ check: "env-dump-block",
1256
+ severity: "warn",
1257
+ line: start + 1,
1258
+ span: [0, (lines[start] ?? "").length],
1259
+ excerpt: `${keys.length} KEY=VALUE lines (${shown}${rest > 0 ? `, +${rest} more` : ""})`
1260
+ });
1261
+ }
1262
+ if (i === start) i++;
1263
+ }
1264
+ return out;
1265
+ }
1266
+ var ENTROPY_CANDIDATE = /[A-Za-z0-9+_-]{32,}/g;
1267
+ var MIN_ENTROPY_BITS = 3.5;
1268
+ var MAX_SAME_CASE_RUN = 8;
1269
+ function scanHighEntropy(lines, named) {
1270
+ const out = [];
1271
+ for (let i = 0; i < lines.length; i++) {
1272
+ const line = lines[i] ?? "";
1273
+ ENTROPY_CANDIDATE.lastIndex = 0;
1274
+ let m;
1275
+ while ((m = ENTROPY_CANDIDATE.exec(line)) !== null) {
1276
+ const token = m[0];
1277
+ if (!looksRandom(token) || DOCS_PLACEHOLDER.test(token)) continue;
1278
+ const span = [m.index, m.index + token.length];
1279
+ if (named.some((f) => f.line === i + 1 && f.span[0] < span[1] && span[0] < f.span[1])) {
1280
+ continue;
1281
+ }
1282
+ out.push({
1283
+ check: "high-entropy-string",
1284
+ severity: "warn",
1285
+ line: i + 1,
1286
+ span,
1287
+ excerpt: maskKeeping(token, 4)
1288
+ });
1289
+ }
1290
+ }
1291
+ return out;
1292
+ }
1293
+ function looksRandom(token) {
1294
+ if (!/[a-z]/.test(token) || !/[A-Z]/.test(token) || !/[0-9]/.test(token)) return false;
1295
+ if (longestSameCaseRun(token) > MAX_SAME_CASE_RUN) return false;
1296
+ return shannonBits(token) >= MIN_ENTROPY_BITS;
1297
+ }
1298
+ function longestSameCaseRun(token) {
1299
+ let best = 0;
1300
+ let run = 0;
1301
+ let previous = "";
1302
+ for (const ch of token) {
1303
+ let kind = "";
1304
+ if (/[a-z]/.test(ch)) kind = "lower";
1305
+ else if (/[A-Z]/.test(ch)) kind = "upper";
1306
+ if (kind === "") run = 0;
1307
+ else run = kind === previous ? run + 1 : 1;
1308
+ previous = kind;
1309
+ if (run > best) best = run;
1310
+ }
1311
+ return best;
1312
+ }
1313
+ function shannonBits(token) {
1314
+ const counts = /* @__PURE__ */ new Map();
1315
+ for (const ch of token) counts.set(ch, (counts.get(ch) ?? 0) + 1);
1316
+ let bits = 0;
1317
+ for (const n of counts.values()) {
1318
+ const p = n / token.length;
1319
+ bits -= p * Math.log2(p);
1320
+ }
1321
+ return bits;
1322
+ }
1323
+ var EMITTED_CHECKS = {
1324
+ "hex32-value": "raw-private-key"
1325
+ };
1326
+ function checksFor(scope) {
1327
+ const ids = new Set(CORPUS.rules.filter((r) => r.scopes.includes(scope)).map((r) => r.id));
1328
+ for (const [check, rule] of Object.entries(EMITTED_CHECKS)) if (ids.has(rule)) ids.add(check);
1329
+ return ids;
1330
+ }
1331
+ var CHECKS = {
1332
+ publish: checksFor("publish"),
1333
+ team: checksFor("team")
1334
+ };
1335
+ var FENCE = /^(\s*)(`{3,}|~{3,})/;
1336
+ function scanLongVerbatim(lines) {
1337
+ const out = [];
1338
+ let i = 0;
1339
+ while (i < lines.length) {
1340
+ const line = lines[i] ?? "";
1341
+ const fence = FENCE.exec(line);
1342
+ if (fence !== null) {
1343
+ const marker = fence[2] ?? "```";
1344
+ const start = i;
1345
+ const body = [];
1346
+ i++;
1347
+ while (i < lines.length && !closesFence(lines[i] ?? "", marker)) {
1348
+ body.push(lines[i] ?? "");
1349
+ i++;
1350
+ }
1351
+ i++;
1352
+ pushIfLong(out, body, start, line);
1353
+ continue;
1354
+ }
1355
+ if (/^\s*>/.test(line)) {
1356
+ const start = i;
1357
+ const body = [];
1358
+ while (i < lines.length && /^\s*>/.test(lines[i] ?? "")) {
1359
+ body.push((lines[i] ?? "").replace(/^\s*>\s?/, ""));
1360
+ i++;
1361
+ }
1362
+ pushIfLong(out, body, start, lines[start] ?? "");
1363
+ continue;
1364
+ }
1365
+ i++;
1366
+ }
1367
+ return out;
1368
+ }
1369
+ function closesFence(line, marker) {
1370
+ const m = FENCE.exec(line);
1371
+ return m !== null && (m[2] ?? "").startsWith(marker);
1372
+ }
1373
+ function pushIfLong(out, body, startLine, firstLine) {
1374
+ const text = body.join(" ").trim();
1375
+ const words = text.length === 0 ? 0 : text.split(/\s+/).length;
1376
+ if (words < LONG_QUOTE_WORDS) return;
1377
+ out.push({
1378
+ check: "long-verbatim-quote",
1379
+ severity: "warn",
1380
+ line: startLine + 1,
1381
+ span: [0, firstLine.length],
1382
+ excerpt: truncate(text, 60)
1383
+ });
1384
+ }
1385
+ function dedupeAndSort(findings2) {
1386
+ const seen = /* @__PURE__ */ new Set();
1387
+ const unique = findings2.filter((f) => {
1388
+ const key = `${f.check}:${f.line}:${f.span[0]}:${f.span[1]}`;
1389
+ if (seen.has(key)) return false;
1390
+ seen.add(key);
1391
+ return true;
1392
+ });
1393
+ return unique.sort(
1394
+ (a, b) => a.line - b.line || a.span[0] - b.span[0] || a.check.localeCompare(b.check)
1395
+ );
1396
+ }
1397
+
1398
+ export {
1399
+ findings,
1400
+ mask,
1401
+ maskRules,
1402
+ EMITTED_CHECKS,
1403
+ checksFor
1404
+ };
1405
+ //# sourceMappingURL=chunk-OIM4HLN6.js.map