@zivis/mcp 0.1.8 → 0.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (346) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +19 -0
  3. package/dist/api-client.d.ts +2 -24
  4. package/dist/api-client.js +32 -52
  5. package/dist/auth/index.d.ts +1 -22
  6. package/dist/auth/index.js +17 -38
  7. package/dist/auth/jwt.d.ts +0 -16
  8. package/dist/auth/jwt.js +0 -13
  9. package/dist/auth/keychain.d.ts +6 -32
  10. package/dist/auth/keychain.js +83 -114
  11. package/dist/auth/oauth.d.ts +3 -32
  12. package/dist/auth/oauth.js +67 -61
  13. package/dist/auth/sessions.d.ts +5 -25
  14. package/dist/auth/sessions.js +20 -39
  15. package/dist/auth/token-refresh.d.ts +2 -22
  16. package/dist/auth/token-refresh.js +33 -36
  17. package/dist/cli.d.ts +1 -18
  18. package/dist/cli.js +30 -908
  19. package/dist/http-probe/capture.d.ts +51 -0
  20. package/dist/http-probe/capture.js +96 -0
  21. package/dist/http-probe/compare.d.ts +43 -0
  22. package/dist/http-probe/compare.js +117 -0
  23. package/dist/http-probe/index.d.ts +2 -0
  24. package/dist/http-probe/index.js +2 -0
  25. package/dist/index.d.ts +0 -6
  26. package/dist/index.js +0 -7
  27. package/dist/lib/inspect-cache.d.ts +10 -0
  28. package/dist/lib/inspect-cache.js +75 -0
  29. package/dist/lib/next-steps.d.ts +27 -0
  30. package/dist/lib/next-steps.js +21 -0
  31. package/dist/matcher/ast-eval.d.ts +8 -0
  32. package/dist/matcher/ast-eval.js +95 -0
  33. package/dist/matcher/finding.d.ts +55 -0
  34. package/dist/matcher/finding.js +1 -0
  35. package/dist/matcher/index.d.ts +8 -0
  36. package/dist/matcher/index.js +202 -0
  37. package/dist/matcher/inference-candidates.d.ts +26 -0
  38. package/dist/matcher/inference-candidates.js +81 -0
  39. package/dist/matcher/walker.d.ts +7 -0
  40. package/dist/matcher/walker.js +71 -0
  41. package/dist/pattern-pack/index.d.ts +125 -0
  42. package/dist/pattern-pack/index.js +189 -0
  43. package/dist/pattern-packs/zivis-public-0.2.0/capsules/agents/privilege-separation.yaml +224 -0
  44. package/dist/pattern-packs/zivis-public-0.2.0/capsules/prompting/self-consistency-no-isolation.yaml +237 -0
  45. package/dist/pattern-packs/zivis-public-0.2.0/capsules/retrieval/context-injection-no-validator.yaml +348 -0
  46. package/dist/pattern-packs/zivis-public-0.2.0/capsules/security/late-org-filter.yaml +266 -0
  47. package/dist/pattern-packs/zivis-public-0.2.0/controls/external_validator_on_facts.yaml +37 -0
  48. package/dist/pattern-packs/zivis-public-0.2.0/controls/fact_validator_present.yaml +68 -0
  49. package/dist/pattern-packs/zivis-public-0.2.0/controls/human_approval_gate.yaml +44 -0
  50. package/dist/pattern-packs/zivis-public-0.2.0/controls/langgraph_state_machine_with_per_node_tools.yaml +35 -0
  51. package/dist/pattern-packs/zivis-public-0.2.0/controls/per_sample_retrieval_diversification.yaml +38 -0
  52. package/dist/pattern-packs/zivis-public-0.2.0/controls/prisma_extension_or_middleware_attaching_org_filter.yaml +31 -0
  53. package/dist/pattern-packs/zivis-public-0.2.0/controls/row_level_security_policy.yaml +37 -0
  54. package/dist/pattern-packs/zivis-public-0.2.0/controls/source_attribution_present.yaml +58 -0
  55. package/dist/pattern-packs/zivis-public-0.2.0/manifest.json +167 -0
  56. package/dist/pattern-packs/zivis-public-0.2.0/prompts/agents/privilege-separation/identify.md +54 -0
  57. package/dist/pattern-packs/zivis-public-0.2.0/prompts/prompting/self-consistency-no-isolation/identify.md +60 -0
  58. package/dist/pattern-packs/zivis-public-0.2.0/prompts/retrieval/context-injection-no-validator/identify.md +109 -0
  59. package/dist/pattern-packs/zivis-public-0.2.0/prompts/security/late-org-filter/identify.md +78 -0
  60. package/dist/project-binding.d.ts +2 -19
  61. package/dist/project-binding.js +38 -21
  62. package/dist/prompts/audit-dependencies.d.ts +2 -0
  63. package/dist/prompts/audit-dependencies.js +47 -0
  64. package/dist/prompts/getting-started.d.ts +2 -0
  65. package/dist/prompts/getting-started.js +37 -0
  66. package/dist/prompts/index.d.ts +2 -0
  67. package/dist/prompts/index.js +6 -0
  68. package/dist/redact.d.ts +30 -0
  69. package/dist/redact.js +164 -0
  70. package/dist/resolve-application-id.d.ts +0 -4
  71. package/dist/resolve-application-id.js +0 -5
  72. package/dist/sanitize.d.ts +1 -21
  73. package/dist/sanitize.js +7 -41
  74. package/dist/scanners/index.d.ts +3 -0
  75. package/dist/scanners/index.js +2 -0
  76. package/dist/scanners/normalize.d.ts +6 -0
  77. package/dist/scanners/normalize.js +181 -0
  78. package/dist/scanners/run.d.ts +27 -0
  79. package/dist/scanners/run.js +142 -0
  80. package/dist/scanners/types.d.ts +40 -0
  81. package/dist/scanners/types.js +1 -0
  82. package/dist/server.d.ts +1 -13
  83. package/dist/server.js +142 -265
  84. package/dist/tools/artifacts.d.ts +76 -0
  85. package/dist/tools/artifacts.js +178 -0
  86. package/dist/tools/check-project.d.ts +5 -18
  87. package/dist/tools/check-project.js +122 -110
  88. package/dist/tools/check-repo-trust.d.ts +4 -19
  89. package/dist/tools/check-repo-trust.js +56 -47
  90. package/dist/tools/create-diagram.d.ts +0 -5
  91. package/dist/tools/create-diagram.js +0 -10
  92. package/dist/tools/create-document.d.ts +0 -5
  93. package/dist/tools/create-document.js +3 -9
  94. package/dist/tools/create-finding.d.ts +85 -0
  95. package/dist/tools/create-finding.js +136 -0
  96. package/dist/tools/delete-finding.d.ts +19 -0
  97. package/dist/tools/delete-finding.js +36 -0
  98. package/dist/tools/devx-run.d.ts +88 -0
  99. package/dist/tools/devx-run.js +175 -0
  100. package/dist/tools/discover-local-infra.d.ts +0 -10
  101. package/dist/tools/discover-local-infra.js +3 -73
  102. package/dist/tools/enterprise/get-org-zat.d.ts +0 -5
  103. package/dist/tools/enterprise/get-org-zat.js +0 -6
  104. package/dist/tools/explain-signal-for-diff.d.ts +34 -0
  105. package/dist/tools/explain-signal-for-diff.js +75 -0
  106. package/dist/tools/generate-diagram.d.ts +0 -6
  107. package/dist/tools/generate-diagram.js +21 -13
  108. package/dist/tools/get-application-overview.d.ts +0 -5
  109. package/dist/tools/get-application-overview.js +0 -6
  110. package/dist/tools/get-application.d.ts +0 -5
  111. package/dist/tools/get-application.js +0 -6
  112. package/dist/tools/get-diagram.d.ts +0 -5
  113. package/dist/tools/get-diagram.js +1 -11
  114. package/dist/tools/get-document.d.ts +0 -5
  115. package/dist/tools/get-document.js +0 -6
  116. package/dist/tools/get-oss-zat.d.ts +0 -5
  117. package/dist/tools/get-oss-zat.js +0 -7
  118. package/dist/tools/get-signal.d.ts +24 -0
  119. package/dist/tools/get-signal.js +75 -0
  120. package/dist/tools/get-started.d.ts +18 -0
  121. package/dist/tools/get-started.js +470 -0
  122. package/dist/tools/get-trust-keys.d.ts +0 -5
  123. package/dist/tools/get-trust-keys.js +0 -6
  124. package/dist/tools/import-openapi-endpoints.d.ts +0 -5
  125. package/dist/tools/import-openapi-endpoints.js +0 -6
  126. package/dist/tools/inspect-zat.d.ts +0 -5
  127. package/dist/tools/inspect-zat.js +0 -19
  128. package/dist/tools/inspect.d.ts +21 -0
  129. package/dist/tools/inspect.js +222 -0
  130. package/dist/tools/list-applications.d.ts +1 -6
  131. package/dist/tools/list-applications.js +0 -6
  132. package/dist/tools/list-diagrams.d.ts +0 -5
  133. package/dist/tools/list-diagrams.js +0 -6
  134. package/dist/tools/list-documents.d.ts +0 -5
  135. package/dist/tools/list-documents.js +0 -6
  136. package/dist/tools/list-endpoints.d.ts +1 -6
  137. package/dist/tools/list-endpoints.js +0 -6
  138. package/dist/tools/list-signals.d.ts +37 -0
  139. package/dist/tools/list-signals.js +83 -0
  140. package/dist/tools/manage-application.d.ts +64 -0
  141. package/dist/tools/manage-application.js +129 -0
  142. package/dist/tools/manage-diagram.d.ts +0 -5
  143. package/dist/tools/manage-diagram.js +0 -16
  144. package/dist/tools/manage-endpoint-lifecycle.d.ts +80 -0
  145. package/dist/tools/manage-endpoint-lifecycle.js +180 -0
  146. package/dist/tools/open-in-ide.d.ts +2 -14
  147. package/dist/tools/open-in-ide.js +0 -13
  148. package/dist/tools/review-change.d.ts +34 -0
  149. package/dist/tools/review-change.js +93 -0
  150. package/dist/tools/security-memory.d.ts +76 -0
  151. package/dist/tools/security-memory.js +202 -0
  152. package/dist/tools/security-review.d.ts +1 -21
  153. package/dist/tools/security-review.js +8 -108
  154. package/dist/tools/threat-get-capsule.d.ts +15 -0
  155. package/dist/tools/threat-get-capsule.js +53 -0
  156. package/dist/tools/threat-get-inference-prompt.d.ts +15 -0
  157. package/dist/tools/threat-get-inference-prompt.js +73 -0
  158. package/dist/tools/threat-list-relevant-capsules.d.ts +17 -0
  159. package/dist/tools/threat-list-relevant-capsules.js +158 -0
  160. package/dist/tools/threat-run-matcher.d.ts +17 -0
  161. package/dist/tools/threat-run-matcher.js +145 -0
  162. package/dist/tools/update-document.d.ts +0 -5
  163. package/dist/tools/update-document.js +3 -9
  164. package/dist/tools/update-endpoint.d.ts +1 -6
  165. package/dist/tools/update-endpoint.js +0 -7
  166. package/dist/tools/update-finding.d.ts +61 -0
  167. package/dist/tools/update-finding.js +80 -0
  168. package/dist/tools/update-mermaid-source.d.ts +0 -13
  169. package/dist/tools/update-mermaid-source.js +0 -14
  170. package/dist/tools/verify-trust-mark.d.ts +0 -5
  171. package/dist/tools/verify-trust-mark.js +0 -6
  172. package/dist/types.d.ts +14 -14
  173. package/dist/types.js +22 -28
  174. package/package.json +41 -15
  175. package/dist/api-client.js.map +0 -1
  176. package/dist/auth/index.js.map +0 -1
  177. package/dist/auth/jwt.js.map +0 -1
  178. package/dist/auth/keychain.js.map +0 -1
  179. package/dist/auth/oauth.js.map +0 -1
  180. package/dist/auth/sessions.js.map +0 -1
  181. package/dist/auth/token-refresh.js.map +0 -1
  182. package/dist/cli.js.map +0 -1
  183. package/dist/index.js.map +0 -1
  184. package/dist/project-binding.js.map +0 -1
  185. package/dist/resolve-application-id.js.map +0 -1
  186. package/dist/sanitize.js.map +0 -1
  187. package/dist/server.js.map +0 -1
  188. package/dist/tools/check-project.js.map +0 -1
  189. package/dist/tools/check-repo-trust.js.map +0 -1
  190. package/dist/tools/create-diagram.js.map +0 -1
  191. package/dist/tools/create-document.js.map +0 -1
  192. package/dist/tools/discover-local-infra.js.map +0 -1
  193. package/dist/tools/enterprise/capture-evidence.d.ts +0 -54
  194. package/dist/tools/enterprise/capture-evidence.js +0 -72
  195. package/dist/tools/enterprise/capture-evidence.js.map +0 -1
  196. package/dist/tools/enterprise/create-report-ticket.d.ts +0 -34
  197. package/dist/tools/enterprise/create-report-ticket.js +0 -44
  198. package/dist/tools/enterprise/create-report-ticket.js.map +0 -1
  199. package/dist/tools/enterprise/end-pentest-session.d.ts +0 -33
  200. package/dist/tools/enterprise/end-pentest-session.js +0 -42
  201. package/dist/tools/enterprise/end-pentest-session.js.map +0 -1
  202. package/dist/tools/enterprise/generate-report.d.ts +0 -55
  203. package/dist/tools/enterprise/generate-report.js +0 -111
  204. package/dist/tools/enterprise/generate-report.js.map +0 -1
  205. package/dist/tools/enterprise/get-org-zat.js.map +0 -1
  206. package/dist/tools/enterprise/get-report-status.d.ts +0 -27
  207. package/dist/tools/enterprise/get-report-status.js +0 -38
  208. package/dist/tools/enterprise/get-report-status.js.map +0 -1
  209. package/dist/tools/enterprise/get-threat-model.d.ts +0 -29
  210. package/dist/tools/enterprise/get-threat-model.js +0 -83
  211. package/dist/tools/enterprise/get-threat-model.js.map +0 -1
  212. package/dist/tools/enterprise/list-agents.d.ts +0 -42
  213. package/dist/tools/enterprise/list-agents.js +0 -95
  214. package/dist/tools/enterprise/list-agents.js.map +0 -1
  215. package/dist/tools/enterprise/list-report-issues.d.ts +0 -36
  216. package/dist/tools/enterprise/list-report-issues.js +0 -50
  217. package/dist/tools/enterprise/list-report-issues.js.map +0 -1
  218. package/dist/tools/enterprise/list-threat-models.d.ts +0 -36
  219. package/dist/tools/enterprise/list-threat-models.js +0 -82
  220. package/dist/tools/enterprise/list-threat-models.js.map +0 -1
  221. package/dist/tools/enterprise/manage-actor.d.ts +0 -58
  222. package/dist/tools/enterprise/manage-actor.js +0 -99
  223. package/dist/tools/enterprise/manage-actor.js.map +0 -1
  224. package/dist/tools/enterprise/manage-attack-scenario.d.ts +0 -70
  225. package/dist/tools/enterprise/manage-attack-scenario.js +0 -89
  226. package/dist/tools/enterprise/manage-attack-scenario.js.map +0 -1
  227. package/dist/tools/enterprise/manage-component.d.ts +0 -58
  228. package/dist/tools/enterprise/manage-component.js +0 -90
  229. package/dist/tools/enterprise/manage-component.js.map +0 -1
  230. package/dist/tools/enterprise/manage-data-asset.d.ts +0 -53
  231. package/dist/tools/enterprise/manage-data-asset.js +0 -90
  232. package/dist/tools/enterprise/manage-data-asset.js.map +0 -1
  233. package/dist/tools/enterprise/manage-data-flow.d.ts +0 -57
  234. package/dist/tools/enterprise/manage-data-flow.js +0 -98
  235. package/dist/tools/enterprise/manage-data-flow.js.map +0 -1
  236. package/dist/tools/enterprise/manage-finding.d.ts +0 -69
  237. package/dist/tools/enterprise/manage-finding.js +0 -106
  238. package/dist/tools/enterprise/manage-finding.js.map +0 -1
  239. package/dist/tools/enterprise/manage-security-control.d.ts +0 -59
  240. package/dist/tools/enterprise/manage-security-control.js +0 -96
  241. package/dist/tools/enterprise/manage-security-control.js.map +0 -1
  242. package/dist/tools/enterprise/manage-test-case.d.ts +0 -88
  243. package/dist/tools/enterprise/manage-test-case.js +0 -119
  244. package/dist/tools/enterprise/manage-test-case.js.map +0 -1
  245. package/dist/tools/enterprise/promote-finding-to-issue.d.ts +0 -36
  246. package/dist/tools/enterprise/promote-finding-to-issue.js +0 -65
  247. package/dist/tools/enterprise/promote-finding-to-issue.js.map +0 -1
  248. package/dist/tools/enterprise/publish-report-version.d.ts +0 -34
  249. package/dist/tools/enterprise/publish-report-version.js +0 -75
  250. package/dist/tools/enterprise/publish-report-version.js.map +0 -1
  251. package/dist/tools/enterprise/publish-test-to-library.d.ts +0 -31
  252. package/dist/tools/enterprise/publish-test-to-library.js +0 -40
  253. package/dist/tools/enterprise/publish-test-to-library.js.map +0 -1
  254. package/dist/tools/enterprise/record-test-result.d.ts +0 -67
  255. package/dist/tools/enterprise/record-test-result.js +0 -75
  256. package/dist/tools/enterprise/record-test-result.js.map +0 -1
  257. package/dist/tools/enterprise/start-pentest-session.d.ts +0 -35
  258. package/dist/tools/enterprise/start-pentest-session.js +0 -50
  259. package/dist/tools/enterprise/start-pentest-session.js.map +0 -1
  260. package/dist/tools/enterprise/sync-report-section.d.ts +0 -41
  261. package/dist/tools/enterprise/sync-report-section.js +0 -79
  262. package/dist/tools/enterprise/sync-report-section.js.map +0 -1
  263. package/dist/tools/enterprise/update-report-issue.d.ts +0 -55
  264. package/dist/tools/enterprise/update-report-issue.js +0 -69
  265. package/dist/tools/enterprise/update-report-issue.js.map +0 -1
  266. package/dist/tools/generate-diagram.js.map +0 -1
  267. package/dist/tools/get-agent-test-results.d.ts +0 -41
  268. package/dist/tools/get-agent-test-results.js +0 -86
  269. package/dist/tools/get-agent-test-results.js.map +0 -1
  270. package/dist/tools/get-application-overview.js.map +0 -1
  271. package/dist/tools/get-application.js.map +0 -1
  272. package/dist/tools/get-artifact-content.d.ts +0 -29
  273. package/dist/tools/get-artifact-content.js +0 -86
  274. package/dist/tools/get-artifact-content.js.map +0 -1
  275. package/dist/tools/get-diagram.js.map +0 -1
  276. package/dist/tools/get-document.js.map +0 -1
  277. package/dist/tools/get-finding-details.d.ts +0 -28
  278. package/dist/tools/get-finding-details.js +0 -43
  279. package/dist/tools/get-finding-details.js.map +0 -1
  280. package/dist/tools/get-findings.d.ts +0 -57
  281. package/dist/tools/get-findings.js +0 -103
  282. package/dist/tools/get-findings.js.map +0 -1
  283. package/dist/tools/get-oss-zat.js.map +0 -1
  284. package/dist/tools/get-recon-scan.d.ts +0 -27
  285. package/dist/tools/get-recon-scan.js +0 -46
  286. package/dist/tools/get-recon-scan.js.map +0 -1
  287. package/dist/tools/get-scan-output.d.ts +0 -27
  288. package/dist/tools/get-scan-output.js +0 -64
  289. package/dist/tools/get-scan-output.js.map +0 -1
  290. package/dist/tools/get-scenario-details.d.ts +0 -27
  291. package/dist/tools/get-scenario-details.js +0 -46
  292. package/dist/tools/get-scenario-details.js.map +0 -1
  293. package/dist/tools/get-test-case-results.d.ts +0 -37
  294. package/dist/tools/get-test-case-results.js +0 -66
  295. package/dist/tools/get-test-case-results.js.map +0 -1
  296. package/dist/tools/get-test-details.d.ts +0 -29
  297. package/dist/tools/get-test-details.js +0 -49
  298. package/dist/tools/get-test-details.js.map +0 -1
  299. package/dist/tools/get-trust-keys.js.map +0 -1
  300. package/dist/tools/import-openapi-endpoints.js.map +0 -1
  301. package/dist/tools/inspect-zat.js.map +0 -1
  302. package/dist/tools/list-agent-test-cases.d.ts +0 -41
  303. package/dist/tools/list-agent-test-cases.js +0 -73
  304. package/dist/tools/list-agent-test-cases.js.map +0 -1
  305. package/dist/tools/list-applications.js.map +0 -1
  306. package/dist/tools/list-diagrams.js.map +0 -1
  307. package/dist/tools/list-documents.js.map +0 -1
  308. package/dist/tools/list-endpoints.js.map +0 -1
  309. package/dist/tools/list-recon-scans.d.ts +0 -36
  310. package/dist/tools/list-recon-scans.js +0 -74
  311. package/dist/tools/list-recon-scans.js.map +0 -1
  312. package/dist/tools/list-scan-artifacts.d.ts +0 -41
  313. package/dist/tools/list-scan-artifacts.js +0 -63
  314. package/dist/tools/list-scan-artifacts.js.map +0 -1
  315. package/dist/tools/list-scans.d.ts +0 -44
  316. package/dist/tools/list-scans.js +0 -91
  317. package/dist/tools/list-scans.js.map +0 -1
  318. package/dist/tools/list-test-library.d.ts +0 -44
  319. package/dist/tools/list-test-library.js +0 -83
  320. package/dist/tools/list-test-library.js.map +0 -1
  321. package/dist/tools/list-test-scenarios.d.ts +0 -31
  322. package/dist/tools/list-test-scenarios.js +0 -66
  323. package/dist/tools/list-test-scenarios.js.map +0 -1
  324. package/dist/tools/local-scan.d.ts +0 -40
  325. package/dist/tools/local-scan.js +0 -261
  326. package/dist/tools/local-scan.js.map +0 -1
  327. package/dist/tools/manage-diagram.js.map +0 -1
  328. package/dist/tools/open-in-ide.js.map +0 -1
  329. package/dist/tools/run-test-scenario.d.ts +0 -37
  330. package/dist/tools/run-test-scenario.js +0 -70
  331. package/dist/tools/run-test-scenario.js.map +0 -1
  332. package/dist/tools/scan-pr.d.ts +0 -27
  333. package/dist/tools/scan-pr.js +0 -51
  334. package/dist/tools/scan-pr.js.map +0 -1
  335. package/dist/tools/security-review.js.map +0 -1
  336. package/dist/tools/setup-red-team-target.d.ts +0 -79
  337. package/dist/tools/setup-red-team-target.js +0 -430
  338. package/dist/tools/setup-red-team-target.js.map +0 -1
  339. package/dist/tools/triage-finding.d.ts +0 -47
  340. package/dist/tools/triage-finding.js +0 -116
  341. package/dist/tools/triage-finding.js.map +0 -1
  342. package/dist/tools/update-document.js.map +0 -1
  343. package/dist/tools/update-endpoint.js.map +0 -1
  344. package/dist/tools/update-mermaid-source.js.map +0 -1
  345. package/dist/tools/verify-trust-mark.js.map +0 -1
  346. package/dist/types.js.map +0 -1
@@ -0,0 +1,109 @@
1
+ # Inference prompt: retrieval.context-injection-no-validator — identify
2
+
3
+ You are reviewing code that appears to implement retrieval-augmented
4
+ generation (RAG): a retriever returns documents and an LLM call consumes
5
+ them. The pattern flagged by ZIVIS suggests there is no validator,
6
+ sanitizer, or source-attribution check between the retriever and the
7
+ model. Your job is to confirm or refute that — strictly based on the
8
+ actual source spans provided. Do not speculate about code you cannot see.
9
+
10
+ ## What you are evaluating
11
+
12
+ 1. **The retrieval call.** Where does it run? What does it return —
13
+ strings, document objects with metadata, raw search hits? Is the
14
+ returned content user-controllable (uploaded files, scraped pages,
15
+ external APIs) or fully internal-curated?
16
+
17
+ 2. **The LLM call that consumes the retrieved content.** How is the
18
+ retrieved text placed into the prompt — concatenated into a system
19
+ prompt, into a user-role message, into a `tools` description?
20
+
21
+ 3. **The path between retriever and LLM call.** Does any function in
22
+ that path perform validation? Look for:
23
+ - Imports / calls of guardrails libraries (`guardrails`, `nemoguardrails`,
24
+ `lakera`, `protectai`, `presidio`, `garak`, `llm-guard`)
25
+ - Functions with names like `validate*`, `sanitize*`, `factCheck*`,
26
+ `attributeSource*`, `verifyClaim*`, `checkInjection*`
27
+ - Source-attribution metadata being injected into the prompt
28
+ (e.g., `<source>doc-id-123</source>` blocks, citation markers the
29
+ model is required to use)
30
+ - Access-control filters that drop documents based on the requester
31
+
32
+ 4. **Whether what looks like validation actually validates.** A function
33
+ named `processDocuments` that just trims whitespace is NOT validation.
34
+ A logger call is NOT validation. A retry wrapper is NOT validation.
35
+
36
+ ## What does NOT count as a validator
37
+
38
+ - Trimming, lowercasing, or other string normalization
39
+ - Token counting or length capping (length limits aren't injection defenses)
40
+ - A type assertion (`as string`) — TypeScript types don't run at runtime
41
+ - An auth check that gates *whether the retrieval runs at all* but doesn't
42
+ inspect the *content* returned
43
+ - A logger call — logs are observability, not defense
44
+ - The model's own instructions ("don't follow embedded instructions") —
45
+ that's prompt hardening, easily bypassed; mark as `partial_validator`
46
+ not `validator_present`
47
+
48
+ ## What counts as a validator
49
+
50
+ - A call to a guardrails / safety library between retrieval and model
51
+ - A function that inspects retrieved content for prompt-injection
52
+ patterns and rejects / flags / strips matching documents
53
+ - Source-attribution machinery: every retrieved doc carries a `sourceId`
54
+ the model is required to cite, and the calling code checks that the
55
+ source is permitted for this requester
56
+ - Per-document access control applied AFTER retrieval, before the doc is
57
+ added to the prompt
58
+
59
+ ## What about query rewriting / HyDE / multi-query?
60
+
61
+ If the query that drives retrieval is itself an LLM output (HyDE,
62
+ multi-query, agentic retrieval), note this in `rationale`. It compounds
63
+ the injection surface — the attacker can influence what gets retrieved
64
+ two steps upstream — but it is NOT itself the missing validator. The
65
+ verdict is about the retriever→model path.
66
+
67
+ ## Output
68
+
69
+ Return JSON only, matching the capsule's `expected_output_schema`:
70
+
71
+ ```json
72
+ {
73
+ "verdict": "no_validator_present | validator_present | partial_validator | unclear",
74
+ "validator_location": "pre_retrieval | between_retriever_and_model | post_model | none | multiple",
75
+ "rationale": "one paragraph citing specific symbols / line numbers from the snippet",
76
+ "corpus_sources": ["uploaded_pdfs", "scraped_web_pages", "confluence_sync"],
77
+ "blast_radius": "single_endpoint | route_family | service_wide | agent_wide | unclear",
78
+ "recommended_controls": ["guardrails_library", "source_attribution_in_prompt"],
79
+ "evidence_spans": [
80
+ { "file": "src/rag.ts", "start_line": 14, "end_line": 38, "note": "retriever→model, no validator" }
81
+ ]
82
+ }
83
+ ```
84
+
85
+ ### Verdict definitions
86
+
87
+ - `no_validator_present` — retrieval feeds the model directly; nothing
88
+ between them inspects content.
89
+ - `validator_present` — a real validator (per the "what counts" list)
90
+ sits between retriever and model.
91
+ - `partial_validator` — something inspects content but with known gaps:
92
+ e.g., regex-only injection filter, or only one document type is
93
+ validated, or validation only runs in some branches. Use this when
94
+ there is *some* defense but it doesn't cover the full path.
95
+ - `unclear` — the snippet doesn't show enough of the path to determine.
96
+ Don't guess. Surface what you'd need to see to decide.
97
+
98
+ ### Blast-radius guidance
99
+
100
+ - `single_endpoint` — one route handler.
101
+ - `route_family` — a helper / chain reused across a router.
102
+ - `service_wide` — the retrieval helper is the shared way the service
103
+ answers questions.
104
+ - `agent_wide` — an agent's tool-use path itself runs through this
105
+ retriever (more dangerous: agent can iterate on injections).
106
+
107
+ Cite line numbers and symbol names from the snippet only. Do not invent
108
+ files. If a control is named in code but you can't see its
109
+ implementation, mark `unclear` and note which file you'd need.
@@ -0,0 +1,78 @@
1
+ # Inference prompt: security.late-org-filter — identify
2
+
3
+ You are reviewing a multi-tenant route handler, stream, or async iterator
4
+ that has been flagged as *possibly* applying tenant scoping at the
5
+ presentation layer rather than inside the data query. The pattern is one of
6
+ the most common causes of cross-tenant data leaks in SaaS systems. Your job
7
+ is to determine where in the stack the org/tenant filter actually lives.
8
+
9
+ ## What you are evaluating
10
+
11
+ 1. Where does the query that returns rows execute? Identify the call (raw
12
+ SQL, ORM method, repository call, fetch, etc.). Does its `WHERE` /
13
+ `where:` / equivalent clause include an org / tenant predicate?
14
+ 2. Where does the filter referencing `request.orgId` (or a session-scoped
15
+ tenant id) fire? In the query, in a middleware, in the response loop,
16
+ in the stream emit?
17
+ 3. Is there a row-level security policy, ORM middleware, or repository
18
+ pattern that *implicitly* scopes every query — even queries that don't
19
+ themselves mention tenant?
20
+ 4. For SSE / stream / async iterator responses: does the filter run per
21
+ emit, before any logging, tracing, or buffering hook?
22
+ 5. Does any logging or observability hook capture the row set BEFORE the
23
+ filter applies?
24
+
25
+ ## What does NOT count as data-layer scoping
26
+
27
+ - A presentation-layer filter that "looks like" it's inside the query just
28
+ because it sits in the same function body. Trace where the SQL actually
29
+ runs.
30
+ - A comment claiming the ORM is org-scoped without code enforcing it.
31
+ - A type system that makes "OrgScopedQuery<T>" but is never actually
32
+ required at the call site.
33
+ - An auth middleware that *checks* the user can access the org but does
34
+ not constrain what rows the subsequent query returns.
35
+
36
+ ## What counts as data-layer scoping
37
+
38
+ - A `WHERE org_id = $1` (or equivalent) inside the query itself.
39
+ - Postgres row-level security with a session GUC the connection sets.
40
+ - Prisma extension / SQLAlchemy event listener / ORM middleware that
41
+ appends the predicate.
42
+ - Repository pattern where the `findByX(ctx)` method takes the org from
43
+ `ctx` and mandates the predicate.
44
+
45
+ ## Output
46
+
47
+ Return JSON only, matching the capsule's `expected_output_schema`:
48
+
49
+ ```json
50
+ {
51
+ "verdict": "late_filter_present | scoped_at_query | partial_scope | unclear",
52
+ "scope_location": "data_layer | query_layer | presentation_layer | multiple | none",
53
+ "rationale": "one paragraph",
54
+ "blast_radius": "single_endpoint | route_family | service_wide | unclear",
55
+ "recommended_controls": ["row_level_security", "query_helper"],
56
+ "evidence_spans": [
57
+ { "file": "routes/queue.ts", "start_line": 18, "end_line": 60, "note": "..." }
58
+ ]
59
+ }
60
+ ```
61
+
62
+ - `late_filter_present` — the query returns cross-tenant rows; the only
63
+ enforcement is at the response/emit layer.
64
+ - `scoped_at_query` — the query itself filters by org/tenant; presentation
65
+ filter (if any) is defense in depth.
66
+ - `partial_scope` — *some* queries are scoped at the data layer but at
67
+ least one in the path is not.
68
+ - `unclear` — query plumbing crosses too many layers to determine from the
69
+ snippet. Don't guess.
70
+
71
+ For `blast_radius`: estimate based on whether the unscoped query helper is
72
+ used elsewhere. `service_wide` if the helper / repository method is shared
73
+ across many routes; `route_family` if reused inside the same router;
74
+ `single_endpoint` if isolated.
75
+
76
+ Cite line numbers from the snippet only. Do not invent files. If a control
77
+ (e.g. "RLS") is mentioned but you can't see the policy text, mark
78
+ `unclear` and explain.
@@ -1,25 +1,8 @@
1
- /**
2
- * Project Binding
3
- *
4
- * Detects and validates `.zivis/project.json` files that bind a project
5
- * directory to a specific ZIVIS session/org. This prevents accidentally
6
- * using the wrong org's MCP connection in a project.
7
- *
8
- * The binding file is optional — if absent, the server starts normally.
9
- * If present, the configured ZIVIS_SESSION must match the binding's
10
- * session field or the server refuses to start.
11
- */
12
1
  import type { ProjectBinding, ZivisConfig } from "./types.js";
13
- /**
14
- * Walk up from `cwd` looking for `.zivis/project.json`.
15
- * Returns the parsed binding or null if not found.
16
- */
17
2
  export declare function detectProjectBinding(cwd: string): {
18
3
  binding: ProjectBinding;
19
4
  filePath: string;
20
5
  } | null;
21
- /**
22
- * Validate that the project binding matches the current MCP session.
23
- * Exits with code 1 on mismatch.
24
- */
6
+ export declare function resolveConfigFromBinding(cwd?: string): ZivisConfig;
7
+ export declare function resolveMcpSessionForWorkspace(incoming: ZivisConfig, workspacePath: string, detected: ReturnType<typeof detectProjectBinding>, fromBinding: ZivisConfig): string;
25
8
  export declare function validateProjectBinding(binding: ProjectBinding, filePath: string, config: ZivisConfig): void;
@@ -1,22 +1,8 @@
1
- /**
2
- * Project Binding
3
- *
4
- * Detects and validates `.zivis/project.json` files that bind a project
5
- * directory to a specific ZIVIS session/org. This prevents accidentally
6
- * using the wrong org's MCP connection in a project.
7
- *
8
- * The binding file is optional — if absent, the server starts normally.
9
- * If present, the configured ZIVIS_SESSION must match the binding's
10
- * session field or the server refuses to start.
11
- */
12
1
  import * as fs from "node:fs";
13
2
  import * as path from "node:path";
3
+ import { DEFAULT_CONFIG } from "./types.js";
14
4
  const BINDING_DIR = ".zivis";
15
5
  const BINDING_FILE = "project.json";
16
- /**
17
- * Walk up from `cwd` looking for `.zivis/project.json`.
18
- * Returns the parsed binding or null if not found.
19
- */
20
6
  export function detectProjectBinding(cwd) {
21
7
  let dir = path.resolve(cwd);
22
8
  const root = path.parse(dir).root;
@@ -41,12 +27,44 @@ export function detectProjectBinding(cwd) {
41
27
  }
42
28
  return null;
43
29
  }
44
- /**
45
- * Validate that the project binding matches the current MCP session.
46
- * Exits with code 1 on mismatch.
47
- */
30
+ export function resolveConfigFromBinding(cwd) {
31
+ const detected = detectProjectBinding(cwd ?? process.cwd());
32
+ if (!detected)
33
+ return DEFAULT_CONFIG;
34
+ const { binding } = detected;
35
+ return {
36
+ ...DEFAULT_CONFIG,
37
+ ...(binding.session ? { session: binding.session } : {}),
38
+ ...(binding.apiBaseUrl ? { apiBaseUrl: binding.apiBaseUrl } : {}),
39
+ ...(binding.oauthApiUrl ? { oauthApiUrl: binding.oauthApiUrl } : {}),
40
+ ...(binding.oauthClientId ? { oauthClientId: binding.oauthClientId } : {}),
41
+ ...(binding.keychainPrefix ? { keychainPrefix: binding.keychainPrefix } : {}),
42
+ ...(binding.configDir ? { configDir: binding.configDir } : {}),
43
+ };
44
+ }
45
+ export function resolveMcpSessionForWorkspace(incoming, workspacePath, detected, fromBinding) {
46
+ const envSession = process.env.ZIVIS_SESSION?.trim();
47
+ if (envSession !== undefined && envSession !== "") {
48
+ if (envSession === "default" &&
49
+ detected?.binding.session &&
50
+ detected.binding.session !== "default") {
51
+ return detected.binding.session;
52
+ }
53
+ return envSession;
54
+ }
55
+ if (detected?.binding.session) {
56
+ return detected.binding.session;
57
+ }
58
+ if (incoming.session !== undefined && incoming.session !== "") {
59
+ return incoming.session;
60
+ }
61
+ if (fromBinding.session) {
62
+ return fromBinding.session;
63
+ }
64
+ return "default";
65
+ }
48
66
  export function validateProjectBinding(binding, filePath, config) {
49
- const currentSession = config.session || "default";
67
+ const currentSession = config.session ?? "default";
50
68
  const expectedSession = binding.session;
51
69
  if (currentSession !== expectedSession) {
52
70
  const orgLabel = binding.orgName
@@ -64,4 +82,3 @@ export function validateProjectBinding(binding, filePath, config) {
64
82
  const orgLabel = binding.orgName ? ` (${binding.orgName})` : "";
65
83
  console.error(`[zivis] Project binding verified: session "${expectedSession}"${orgLabel}`);
66
84
  }
67
- //# sourceMappingURL=project-binding.js.map
@@ -0,0 +1,2 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerAuditDependenciesPrompt(server: McpServer): void;
@@ -0,0 +1,47 @@
1
+ export function registerAuditDependenciesPrompt(server) {
2
+ server.registerPrompt("audit-dependencies", {
3
+ description: "Check the open source libraries this project depends on for security risks. No account setup needed.",
4
+ argsSchema: {},
5
+ }, async () => ({
6
+ messages: [
7
+ {
8
+ role: "user",
9
+ content: {
10
+ type: "text",
11
+ text: `I want to check whether the open source libraries I'm using are safe.
12
+
13
+ Please do the following:
14
+
15
+ 1. Look at the dependency files in this project. In priority order, check:
16
+ - package.json (look for the "dependencies" and "devDependencies" keys)
17
+ - requirements.txt or pyproject.toml
18
+ - go.mod
19
+ - Any other manifest files you can see
20
+
21
+ 2. From those files, find all external dependencies that have a GitHub repository.
22
+ - Skip internal packages (those starting with "@my-company/" or similar private namespaces).
23
+ - Skip built-in packages (e.g. node built-ins like "fs", "path").
24
+
25
+ 3. For each external dependency that has a public GitHub repo, call \`zivis_check_repo_trust\`
26
+ with the owner/repo string (e.g. "openai/openai-node").
27
+
28
+ 4. After checking each one, give me a summary table with columns:
29
+ - Package name
30
+ - Trust grade (A+ through F)
31
+ - Risk level (Safe / Low risk / Moderate / High / Critical)
32
+ - Any critical or high findings (one line each)
33
+
34
+ 5. Flag any package with grade C or below and explain in plain English why it's risky.
35
+
36
+ 6. At the end, suggest the two highest-priority actions to take based on the results.
37
+
38
+ Ground rules:
39
+ - Process dependencies one at a time so I can follow along.
40
+ - If a package doesn't have a GitHub repo, skip it and say "(no GitHub repo found)".
41
+ - Don't make up trust data — only use what zivis_check_repo_trust returns.
42
+ - Speak in plain English. "High risk" is better than "critical severity threat vector".`,
43
+ },
44
+ },
45
+ ],
46
+ }));
47
+ }
@@ -0,0 +1,2 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerGettingStartedPrompt(server: McpServer): void;
@@ -0,0 +1,37 @@
1
+ export function registerGettingStartedPrompt(server) {
2
+ server.registerPrompt("getting-started", {
3
+ description: "Walk me through ZIVIS for this project. Use this if you're new or unsure what to test.",
4
+ argsSchema: {},
5
+ }, async () => ({
6
+ messages: [
7
+ {
8
+ role: "user",
9
+ content: {
10
+ type: "text",
11
+ text: `I want to use ZIVIS for security on this project but I'm not sure where to start.
12
+
13
+ Please do the following, in order:
14
+
15
+ 1. Call \`zivis_check_project\` (no arguments) to confirm the project is connected correctly.
16
+ - If it returns any problems, explain them in plain English and tell me the exact terminal command to run to fix them. Stop here and wait for me.
17
+ - If it's OK, continue to step 2.
18
+
19
+ 2. Call \`zivis_get_started\` (no arguments).
20
+
21
+ 3. Present the \`recommended_next_steps\` from the response as a numbered list.
22
+ - Use the \`label\` as the item text.
23
+ - Add one sentence from the \`why\` field below each item.
24
+ - Do NOT invent additional steps or add security advice of your own.
25
+
26
+ 4. Ask me which number I want to do. Wait for my answer before calling anything else.
27
+
28
+ Ground rules for this conversation:
29
+ - I'm a developer, not a security person. Speak plainly.
30
+ - Avoid these words unless I use them first: "actor", "attack vector", "threat model", "STRIDE", "kill chain", "TTPs".
31
+ - Use plain alternatives: "tester", "how someone might break in", "security plan", "types of attacks".
32
+ - If I seem unsure which option to pick, suggest the one flagged as \`if_user_unsure\` in the response.`,
33
+ },
34
+ },
35
+ ],
36
+ }));
37
+ }
@@ -0,0 +1,2 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerAllPrompts(server: McpServer): void;
@@ -0,0 +1,6 @@
1
+ import { registerGettingStartedPrompt } from "./getting-started.js";
2
+ import { registerAuditDependenciesPrompt } from "./audit-dependencies.js";
3
+ export function registerAllPrompts(server) {
4
+ registerGettingStartedPrompt(server);
5
+ registerAuditDependenciesPrompt(server);
6
+ }
@@ -0,0 +1,30 @@
1
+ export interface RedactionFinding {
2
+ rule: string;
3
+ path: string;
4
+ }
5
+ export interface RedactionReport {
6
+ redacted: boolean;
7
+ count: number;
8
+ byRule: Record<string, number>;
9
+ findings: RedactionFinding[];
10
+ }
11
+ interface RedactRule {
12
+ id: string;
13
+ regex: RegExp;
14
+ secretGroup?: number;
15
+ }
16
+ export declare const REDACTION_RULES: readonly RedactRule[];
17
+ export declare function redactString(input: string, report?: RedactionReport, path?: string): {
18
+ text: string;
19
+ report: RedactionReport;
20
+ };
21
+ export declare const SENSITIVE_KEY_NAMES: ReadonlySet<string>;
22
+ export interface RedactOptions {
23
+ maxDepth?: number;
24
+ }
25
+ export declare function redactValue<T>(value: T, opts?: RedactOptions): {
26
+ value: T;
27
+ report: RedactionReport;
28
+ };
29
+ export declare function redactEvidence<T>(value: T): T;
30
+ export {};
package/dist/redact.js ADDED
@@ -0,0 +1,164 @@
1
+ function emptyReport() {
2
+ return { redacted: false, count: 0, byRule: {}, findings: [] };
3
+ }
4
+ function record(report, rule, path) {
5
+ report.redacted = true;
6
+ report.count += 1;
7
+ report.byRule[rule] = (report.byRule[rule] ?? 0) + 1;
8
+ report.findings.push({ rule, path });
9
+ }
10
+ const MASK = (id) => `[REDACTED:${id}]`;
11
+ export const REDACTION_RULES = [
12
+ {
13
+ id: "auth-header",
14
+ regex: /^([ \t]*(?:authorization|proxy-authorization|www-authenticate|cookie|set-cookie|x-api-key|x-apikey|x-auth-token|x-access-token|x-session-token|x-refresh-token|x-amz-security-token|api-key|apikey)[ \t]*:[ \t]*)(.+)$/gim,
15
+ secretGroup: 2,
16
+ },
17
+ { id: "bearer-token", regex: /\b(Bearer[ \t]+)([A-Za-z0-9._~+/=-]{8,})/gi, secretGroup: 2 },
18
+ { id: "basic-auth", regex: /\b(Basic[ \t]+)([A-Za-z0-9+/=]{8,})/gi, secretGroup: 2 },
19
+ {
20
+ id: "private-key",
21
+ regex: /-----BEGIN (?:RSA |EC |DSA |OPENSSH |PGP |ENCRYPTED )?PRIVATE KEY(?: BLOCK)?-----[\s\S]*?-----END (?:RSA |EC |DSA |OPENSSH |PGP |ENCRYPTED )?PRIVATE KEY(?: BLOCK)?-----/g,
22
+ },
23
+ {
24
+ id: "private-key",
25
+ regex: /-----BEGIN (?:RSA |EC |DSA |OPENSSH |PGP |ENCRYPTED )?PRIVATE KEY(?: BLOCK)?-----/g,
26
+ },
27
+ { id: "jwt", regex: /\beyJ[A-Za-z0-9_-]{5,}\.eyJ[A-Za-z0-9_-]{5,}\.[A-Za-z0-9_-]{5,}/g },
28
+ { id: "aws-access-key-id", regex: /\b(?:A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}\b/g },
29
+ {
30
+ id: "aws-secret-access-key",
31
+ regex: /(aws_?secret_?access_?key["' ]*[=:]["' ]*)([A-Za-z0-9/+=]{40})/gi,
32
+ secretGroup: 2,
33
+ },
34
+ {
35
+ id: "azure-storage-key",
36
+ regex: /(AccountKey=)([A-Za-z0-9+/=]{40,})/gi,
37
+ secretGroup: 2,
38
+ },
39
+ { id: "google-api-key", regex: /\bAIza[0-9A-Za-z_-]{35}\b/g },
40
+ { id: "github-token", regex: /\bgh[pousr]_[A-Za-z0-9_]{36,}\b/g },
41
+ { id: "slack-token", regex: /\bxox[baprs]-[0-9A-Za-z-]{10,}/g },
42
+ { id: "slack-webhook", regex: /https:\/\/hooks\.slack\.com\/services\/T[A-Z0-9]+\/B[A-Z0-9]+\/[A-Za-z0-9]+/g },
43
+ { id: "stripe-key", regex: /\b(?:sk|rk)_(?:live|test)_[A-Za-z0-9]{16,}\b/g },
44
+ { id: "sendgrid-key", regex: /\bSG\.[A-Za-z0-9_-]{22}\.[A-Za-z0-9_-]{43}\b/g },
45
+ { id: "npm-token", regex: /\bnpm_[A-Za-z0-9]{36}\b/g },
46
+ { id: "anthropic-key", regex: /\bsk-ant-[A-Za-z0-9_-]{20,}\b/g },
47
+ { id: "openai-key", regex: /\bsk-(?:proj-)?[A-Za-z0-9_-]{20,}\b/g },
48
+ {
49
+ id: "connection-string-password",
50
+ regex: /\b((?:postgres(?:ql)?|mysql|mongodb(?:\+srv)?|redis|rediss|amqps?|https?):\/\/[^:@/\s]+:)([^@/\s]+)(@)/gi,
51
+ secretGroup: 2,
52
+ },
53
+ {
54
+ id: "generic-secret-assignment",
55
+ regex: /\b(password|passwd|pwd|secret|client[_-]?secret|api[_-]?key|apikey|access[_-]?token|refresh[_-]?token|auth[_-]?token|session[_-]?token|private[_-]?key|passphrase)\b(["' ]*[=:]["' ]*)([^\s"',;&})]{6,})/gi,
56
+ secretGroup: 3,
57
+ },
58
+ ];
59
+ export function redactString(input, report = emptyReport(), path = "") {
60
+ if (typeof input !== "string" || input.length === 0) {
61
+ return { text: input, report };
62
+ }
63
+ let text = input;
64
+ for (const rule of REDACTION_RULES) {
65
+ if (rule.secretGroup === undefined) {
66
+ text = text.replace(rule.regex, () => {
67
+ record(report, rule.id, path);
68
+ return MASK(rule.id);
69
+ });
70
+ }
71
+ else {
72
+ const g = rule.secretGroup;
73
+ text = text.replace(rule.regex, (match, ...groups) => {
74
+ const secret = groups[g - 1];
75
+ if (secret === undefined || secret === "")
76
+ return match;
77
+ record(report, rule.id, path);
78
+ const idx = match.lastIndexOf(String(secret));
79
+ if (idx < 0)
80
+ return MASK(rule.id);
81
+ return match.slice(0, idx) + MASK(rule.id) + match.slice(idx + String(secret).length);
82
+ });
83
+ }
84
+ }
85
+ return { text, report };
86
+ }
87
+ export const SENSITIVE_KEY_NAMES = new Set([
88
+ "authorization",
89
+ "proxyauthorization",
90
+ "cookie",
91
+ "setcookie",
92
+ "xapikey",
93
+ "xauthtoken",
94
+ "xaccesstoken",
95
+ "xsessiontoken",
96
+ "xrefreshtoken",
97
+ "xamzsecuritytoken",
98
+ "apikey",
99
+ "apitoken",
100
+ "password",
101
+ "passwd",
102
+ "pwd",
103
+ "passphrase",
104
+ "secret",
105
+ "clientsecret",
106
+ "secretkey",
107
+ "token",
108
+ "accesstoken",
109
+ "refreshtoken",
110
+ "idtoken",
111
+ "authtoken",
112
+ "sessiontoken",
113
+ "sessionid",
114
+ "session",
115
+ "privatekey",
116
+ "credential",
117
+ "credentials",
118
+ "bearer",
119
+ "auth",
120
+ ].map((k) => k.replace(/[-_]/g, "")));
121
+ function normalizeKey(key) {
122
+ return key.toLowerCase().replace(/[-_]/g, "");
123
+ }
124
+ export function redactValue(value, opts = {}) {
125
+ const report = emptyReport();
126
+ const maxDepth = opts.maxDepth ?? 64;
127
+ const seen = new WeakSet();
128
+ const walk = (node, path, depth, underSensitiveKey) => {
129
+ if (node === null || node === undefined)
130
+ return node;
131
+ if (typeof node === "string") {
132
+ if (underSensitiveKey) {
133
+ if (node.length > 0) {
134
+ record(report, "sensitive-key", path);
135
+ return MASK("sensitive-key");
136
+ }
137
+ return node;
138
+ }
139
+ return redactString(node, report, path).text;
140
+ }
141
+ if (typeof node !== "object")
142
+ return node;
143
+ if (seen.has(node))
144
+ return "[CYCLE]";
145
+ if (depth >= maxDepth)
146
+ return node;
147
+ seen.add(node);
148
+ if (Array.isArray(node)) {
149
+ return node.map((item, i) => walk(item, `${path}[${i}]`, depth + 1, underSensitiveKey));
150
+ }
151
+ const out = {};
152
+ for (const [key, v] of Object.entries(node)) {
153
+ const childPath = path ? `${path}.${key}` : key;
154
+ const sensitive = underSensitiveKey || SENSITIVE_KEY_NAMES.has(normalizeKey(key));
155
+ out[key] = walk(v, childPath, depth + 1, sensitive);
156
+ }
157
+ return out;
158
+ };
159
+ const redacted = walk(value, "", 0, false);
160
+ return { value: redacted, report };
161
+ }
162
+ export function redactEvidence(value) {
163
+ return redactValue(value).value;
164
+ }
@@ -1,7 +1,3 @@
1
- /**
2
- * Default `application_id` tool arguments from `.zivis/project.json` when the
3
- * user omits the parameter (optional `applicationId` on ProjectBinding).
4
- */
5
1
  export declare function resolveApplicationId(explicit: string | undefined, cwd?: string): string | undefined;
6
2
  export declare function requireApplicationId(explicit: string | undefined, cwd?: string): {
7
3
  ok: true;
@@ -1,7 +1,3 @@
1
- /**
2
- * Default `application_id` tool arguments from `.zivis/project.json` when the
3
- * user omits the parameter (optional `applicationId` on ProjectBinding).
4
- */
5
1
  import { detectProjectBinding } from "./project-binding.js";
6
2
  export function resolveApplicationId(explicit, cwd = process.cwd()) {
7
3
  const t = explicit?.trim();
@@ -18,4 +14,3 @@ export function requireApplicationId(explicit, cwd = process.cwd()) {
18
14
  message: "application_id is required, or set applicationId in .zivis/project.json for this workspace.",
19
15
  };
20
16
  }
21
- //# sourceMappingURL=resolve-application-id.js.map
@@ -1,23 +1,3 @@
1
- /**
2
- * Response Sanitization — Prompt Injection Defense
3
- *
4
- * Sanitizes API response data before returning it to the AI assistant.
5
- * Finding content (titles, descriptions, code snippets, remediation text)
6
- * is untrusted data from automated scanners and external vulnerability
7
- * databases. This layer strips common injection patterns.
8
- *
9
- * Defense layers:
10
- * 1. Strip non-printable / control characters
11
- * 2. Truncate field lengths
12
- * 3. Strip common LLM prompt injection patterns
13
- * 4. Encode suspicious formatting
14
- */
15
- /**
16
- * Sanitize a single string field
17
- */
1
+ export declare function sanitizeInboundText(value: string | undefined, maxLength: number): string | undefined;
18
2
  export declare function sanitizeField(value: string, fieldName?: string): string;
19
- /**
20
- * Recursively sanitize all string fields in an object.
21
- * Handles nested objects and arrays.
22
- */
23
3
  export declare function sanitizeResponse<T>(data: T): T;