@clear-capabilities/agentic-security-scanner 0.74.0

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 (331) hide show
  1. package/CHANGELOG.md +1580 -0
  2. package/bin/.agentic-security/findings.json +1577 -0
  3. package/bin/.agentic-security/last-scan.json +1577 -0
  4. package/bin/.agentic-security/last-scan.json.sig +1 -0
  5. package/bin/.agentic-security/scan-history.json +465 -0
  6. package/bin/.agentic-security/streak.json +25 -0
  7. package/bin/agentic-security-audit.js +198 -0
  8. package/bin/agentic-security-consistency.js +80 -0
  9. package/bin/agentic-security-diff.js +136 -0
  10. package/bin/agentic-security-lsp.js +12 -0
  11. package/bin/agentic-security-mcp.js +40 -0
  12. package/bin/agentic-security-rule.js +153 -0
  13. package/bin/agentic-security.js +1683 -0
  14. package/dist/117.index.js +207 -0
  15. package/dist/178.index.js +250 -0
  16. package/dist/218.index.js +793 -0
  17. package/dist/227.index.js +192 -0
  18. package/dist/301.index.js +167 -0
  19. package/dist/384.index.js +18 -0
  20. package/dist/476.index.js +126 -0
  21. package/dist/513.index.js +373 -0
  22. package/dist/520.index.js +13 -0
  23. package/dist/601.index.js +1038 -0
  24. package/dist/634.index.js +1892 -0
  25. package/dist/637.index.js +216 -0
  26. package/dist/660.index.js +131 -0
  27. package/dist/675.index.js +451 -0
  28. package/dist/826.index.js +188 -0
  29. package/dist/830.index.js +133 -0
  30. package/dist/agentic-security.mjs +272 -0
  31. package/dist/agentic-security.mjs.sha256 +1 -0
  32. package/dist/calibration-seed.json +27 -0
  33. package/package.json +77 -0
  34. package/src/.agentic-security/findings.json +80844 -0
  35. package/src/.agentic-security/last-scan.json +80844 -0
  36. package/src/.agentic-security/last-scan.json.sig +1 -0
  37. package/src/.agentic-security/scan-history.json +8408 -0
  38. package/src/.agentic-security/streak.json +26 -0
  39. package/src/badge.js +188 -0
  40. package/src/compare.js +203 -0
  41. package/src/dataflow/.agentic-security/findings.json +3487 -0
  42. package/src/dataflow/.agentic-security/last-scan.json +3487 -0
  43. package/src/dataflow/.agentic-security/last-scan.json.sig +1 -0
  44. package/src/dataflow/.agentic-security/scan-history.json +735 -0
  45. package/src/dataflow/.agentic-security/streak.json +24 -0
  46. package/src/dataflow/CLAUDE.md +38 -0
  47. package/src/dataflow/access-paths.js +172 -0
  48. package/src/dataflow/async-sequencing.js +177 -0
  49. package/src/dataflow/backward.js +201 -0
  50. package/src/dataflow/catalog-expanded.js +485 -0
  51. package/src/dataflow/catalog.js +659 -0
  52. package/src/dataflow/cross-repo.js +219 -0
  53. package/src/dataflow/engine.js +588 -0
  54. package/src/dataflow/exception-flow.js +116 -0
  55. package/src/dataflow/exploit-prover.js +187 -0
  56. package/src/dataflow/higher-order.js +221 -0
  57. package/src/dataflow/ifds.js +347 -0
  58. package/src/dataflow/implicit-flow.js +129 -0
  59. package/src/dataflow/incremental.js +229 -0
  60. package/src/dataflow/index.js +181 -0
  61. package/src/dataflow/numeric-domain.js +192 -0
  62. package/src/dataflow/path-feasibility.js +114 -0
  63. package/src/dataflow/points-to.js +337 -0
  64. package/src/dataflow/polyglot.js +190 -0
  65. package/src/dataflow/proven-clean.js +159 -0
  66. package/src/dataflow/receiver-context.js +76 -0
  67. package/src/dataflow/sanitizer-proof.js +154 -0
  68. package/src/dataflow/soft-taint.js +140 -0
  69. package/src/dataflow/string-domain.js +234 -0
  70. package/src/dataflow/stub-aware-filter.js +100 -0
  71. package/src/dataflow/summaries.js +132 -0
  72. package/src/dataflow/symbolic-exec.js +238 -0
  73. package/src/dataflow/tabulation.js +135 -0
  74. package/src/engine.js +7763 -0
  75. package/src/history-scan.js +229 -0
  76. package/src/index.js +3 -0
  77. package/src/integrations/.agentic-security/findings.json +1504 -0
  78. package/src/integrations/.agentic-security/last-scan.json +1504 -0
  79. package/src/integrations/.agentic-security/scan-history.json +40 -0
  80. package/src/integrations/.agentic-security/streak.json +21 -0
  81. package/src/integrations/index.js +321 -0
  82. package/src/integrations/tickets.js +200 -0
  83. package/src/ir/.agentic-security/findings.json +3036 -0
  84. package/src/ir/.agentic-security/last-scan.json +3036 -0
  85. package/src/ir/.agentic-security/last-scan.json.sig +1 -0
  86. package/src/ir/.agentic-security/scan-history.json +364 -0
  87. package/src/ir/.agentic-security/streak.json +23 -0
  88. package/src/ir/CLAUDE.md +172 -0
  89. package/src/ir/callgraph.js +73 -0
  90. package/src/ir/class-hierarchy.js +195 -0
  91. package/src/ir/index.js +152 -0
  92. package/src/ir/parser-cs.js +260 -0
  93. package/src/ir/parser-java.js +286 -0
  94. package/src/ir/parser-js.js +413 -0
  95. package/src/ir/parser-kt.js +258 -0
  96. package/src/ir/parser-py-cst.js +136 -0
  97. package/src/ir/parser-py.helper.py +501 -0
  98. package/src/ir/parser-py.js +312 -0
  99. package/src/ir/ssa.js +315 -0
  100. package/src/ir/type-stubs.js +288 -0
  101. package/src/leaderboard.js +152 -0
  102. package/src/llm-validator/.agentic-security/findings.json +1891 -0
  103. package/src/llm-validator/.agentic-security/last-scan.json +1891 -0
  104. package/src/llm-validator/.agentic-security/last-scan.json.sig +1 -0
  105. package/src/llm-validator/.agentic-security/scan-history.json +168 -0
  106. package/src/llm-validator/.agentic-security/streak.json +20 -0
  107. package/src/llm-validator/consistency.js +141 -0
  108. package/src/llm-validator/index.js +437 -0
  109. package/src/lsp/.agentic-security/findings.json +28 -0
  110. package/src/lsp/.agentic-security/last-scan.json +28 -0
  111. package/src/lsp/.agentic-security/scan-history.json +79 -0
  112. package/src/lsp/.agentic-security/streak.json +22 -0
  113. package/src/lsp/server.js +275 -0
  114. package/src/mcp/.agentic-security/findings.json +8358 -0
  115. package/src/mcp/.agentic-security/last-scan.json +8358 -0
  116. package/src/mcp/.agentic-security/last-scan.json.sig +1 -0
  117. package/src/mcp/.agentic-security/scan-history.json +1125 -0
  118. package/src/mcp/.agentic-security/streak.json +22 -0
  119. package/src/mcp/CLAUDE.md +54 -0
  120. package/src/mcp/audit.js +136 -0
  121. package/src/mcp/redact.js +75 -0
  122. package/src/mcp/server.js +158 -0
  123. package/src/mcp/stdio.js +83 -0
  124. package/src/mcp/tools.js +940 -0
  125. package/src/mcp/validate.js +49 -0
  126. package/src/personality.js +164 -0
  127. package/src/poc-video.js +239 -0
  128. package/src/posture/.agentic-security/findings.json +51239 -0
  129. package/src/posture/.agentic-security/last-scan.json +51239 -0
  130. package/src/posture/.agentic-security/last-scan.json.sig +1 -0
  131. package/src/posture/.agentic-security/scan-history.json +5557 -0
  132. package/src/posture/.agentic-security/streak.json +24 -0
  133. package/src/posture/CLAUDE.md +42 -0
  134. package/src/posture/adversarial-self-test.js +114 -0
  135. package/src/posture/adversary-agent.js +204 -0
  136. package/src/posture/agents-memory.js +135 -0
  137. package/src/posture/ai-code-fingerprint.js +171 -0
  138. package/src/posture/aibom.js +284 -0
  139. package/src/posture/api-inventory.js +96 -0
  140. package/src/posture/attack-playbooks.js +305 -0
  141. package/src/posture/auditor-agent.js +115 -0
  142. package/src/posture/auth-posture-import.js +135 -0
  143. package/src/posture/baseline-compare.js +114 -0
  144. package/src/posture/blast-radius.js +836 -0
  145. package/src/posture/bounty-prediction.js +141 -0
  146. package/src/posture/business-logic.js +239 -0
  147. package/src/posture/calibration-drift.js +93 -0
  148. package/src/posture/calibration-seed.json +27 -0
  149. package/src/posture/calibration.js +204 -0
  150. package/src/posture/clustering.js +75 -0
  151. package/src/posture/concurrency-checker.js +265 -0
  152. package/src/posture/confidence.js +65 -0
  153. package/src/posture/container-runtime.js +149 -0
  154. package/src/posture/counterfactual.js +109 -0
  155. package/src/posture/cross-lang-graphql.js +165 -0
  156. package/src/posture/cross-lang-grpc.js +166 -0
  157. package/src/posture/cross-lang-meta.js +101 -0
  158. package/src/posture/cross-lang-openapi.js +187 -0
  159. package/src/posture/cross-lang-orm.js +153 -0
  160. package/src/posture/cross-lang-queues.js +210 -0
  161. package/src/posture/crown-jewels.js +110 -0
  162. package/src/posture/custom-rules.js +361 -0
  163. package/src/posture/cve-alert-daemon.js +433 -0
  164. package/src/posture/cve-lookup.js +129 -0
  165. package/src/posture/dead-code.js +430 -0
  166. package/src/posture/defender-agent.js +158 -0
  167. package/src/posture/deploy-platform.js +204 -0
  168. package/src/posture/detector-fuzz.js +61 -0
  169. package/src/posture/deterministic.js +99 -0
  170. package/src/posture/drift.js +165 -0
  171. package/src/posture/epss.js +156 -0
  172. package/src/posture/exploitability-probability.js +212 -0
  173. package/src/posture/exploitability.js +121 -0
  174. package/src/posture/feature-flags.js +110 -0
  175. package/src/posture/finding-defaults.js +132 -0
  176. package/src/posture/fix-history.js +411 -0
  177. package/src/posture/fix-plan.js +121 -0
  178. package/src/posture/fix-verify-loop.js +157 -0
  179. package/src/posture/fix-verify.js +130 -0
  180. package/src/posture/flow-narration.js +105 -0
  181. package/src/posture/grader-calibration.js +156 -0
  182. package/src/posture/harness-discovery.js +113 -0
  183. package/src/posture/holdout-eval.js +144 -0
  184. package/src/posture/iac-reachability.js +163 -0
  185. package/src/posture/iam-policy.js +128 -0
  186. package/src/posture/integrity.js +97 -0
  187. package/src/posture/learning.js +166 -0
  188. package/src/posture/license-policy.js +109 -0
  189. package/src/posture/llm-redteam-prompts.js +418 -0
  190. package/src/posture/llm-redteam.js +303 -0
  191. package/src/posture/material-change.js +163 -0
  192. package/src/posture/mitigation-composite.js +55 -0
  193. package/src/posture/mttr.js +91 -0
  194. package/src/posture/network-policy-import.js +126 -0
  195. package/src/posture/path-predicates.js +99 -0
  196. package/src/posture/persona-prioritization.js +153 -0
  197. package/src/posture/poc-cwe-map.js +51 -0
  198. package/src/posture/poc-generator.js +500 -0
  199. package/src/posture/policy-gate.js +174 -0
  200. package/src/posture/pre-incident-archaeology.js +110 -0
  201. package/src/posture/profile.js +93 -0
  202. package/src/posture/reachability-filter.js +42 -0
  203. package/src/posture/regression-test-gen.js +200 -0
  204. package/src/posture/reverse-blast-radius.js +110 -0
  205. package/src/posture/router.js +109 -0
  206. package/src/posture/rule-overrides.js +198 -0
  207. package/src/posture/rule-pack-signing.js +209 -0
  208. package/src/posture/rule-packs.js +143 -0
  209. package/src/posture/rule-synthesis.js +108 -0
  210. package/src/posture/ruleset-version.js +71 -0
  211. package/src/posture/sbom.js +129 -0
  212. package/src/posture/schema-aware-bridge.js +207 -0
  213. package/src/posture/security-trend.js +87 -0
  214. package/src/posture/semantic-clone.js +114 -0
  215. package/src/posture/specification-mining.js +170 -0
  216. package/src/posture/stable-id.js +75 -0
  217. package/src/posture/stack-playbook.js +229 -0
  218. package/src/posture/streak.js +249 -0
  219. package/src/posture/suppressions.js +135 -0
  220. package/src/posture/telemetry-ingest.js +112 -0
  221. package/src/posture/threat-model.js +145 -0
  222. package/src/posture/three-agent-pipeline.js +74 -0
  223. package/src/posture/triage.js +146 -0
  224. package/src/posture/trust-boundary-diagram.js +115 -0
  225. package/src/posture/type-narrowing.js +129 -0
  226. package/src/posture/validator-metrics.js +179 -0
  227. package/src/posture/verifier-ephemeral.js +118 -0
  228. package/src/posture/verifier-target.js +147 -0
  229. package/src/posture/verifier.js +257 -0
  230. package/src/posture/version.js +75 -0
  231. package/src/posture/waf-ingest.js +200 -0
  232. package/src/posture/why-fired.js +141 -0
  233. package/src/pr-comment.js +172 -0
  234. package/src/pr-delta.js +198 -0
  235. package/src/report/.agentic-security/findings.json +79 -0
  236. package/src/report/.agentic-security/last-scan.json +79 -0
  237. package/src/report/.agentic-security/last-scan.json.sig +1 -0
  238. package/src/report/.agentic-security/scan-history.json +332 -0
  239. package/src/report/.agentic-security/streak.json +23 -0
  240. package/src/report/index.js +1136 -0
  241. package/src/report/mascot.js +42 -0
  242. package/src/runScan.js +141 -0
  243. package/src/sast/.agentic-security/findings.json +5051 -0
  244. package/src/sast/.agentic-security/last-scan.json +5051 -0
  245. package/src/sast/.agentic-security/last-scan.json.sig +1 -0
  246. package/src/sast/.agentic-security/scan-history.json +788 -0
  247. package/src/sast/.agentic-security/streak.json +23 -0
  248. package/src/sast/CLAUDE.md +39 -0
  249. package/src/sast/_comment-strip.js +46 -0
  250. package/src/sast/agent-tool-escalation.js +131 -0
  251. package/src/sast/auth-provider.js +171 -0
  252. package/src/sast/authz.js +236 -0
  253. package/src/sast/bench-shape/.agentic-security/findings.json +28 -0
  254. package/src/sast/bench-shape/.agentic-security/last-scan.json +28 -0
  255. package/src/sast/bench-shape/.agentic-security/scan-history.json +24 -0
  256. package/src/sast/bench-shape/.agentic-security/streak.json +22 -0
  257. package/src/sast/bench-shape/index.js +62 -0
  258. package/src/sast/claude-hook-injection.js +199 -0
  259. package/src/sast/claude-md-prompt-injection.js +170 -0
  260. package/src/sast/claude-settings.js +165 -0
  261. package/src/sast/client-side.js +149 -0
  262. package/src/sast/cpp-bench-extras.js +122 -0
  263. package/src/sast/cpp-dataflow.js +430 -0
  264. package/src/sast/cpp.js +248 -0
  265. package/src/sast/csharp.js +152 -0
  266. package/src/sast/csrf.js +82 -0
  267. package/src/sast/dart-flutter.js +173 -0
  268. package/src/sast/db-rls.js +147 -0
  269. package/src/sast/db-taint.js +215 -0
  270. package/src/sast/defi-deep.js +242 -0
  271. package/src/sast/deserialization-gadgets.js +113 -0
  272. package/src/sast/django-hardening.js +230 -0
  273. package/src/sast/env-hygiene.js +125 -0
  274. package/src/sast/fastapi-hardening.js +145 -0
  275. package/src/sast/go-extended.js +84 -0
  276. package/src/sast/host-header.js +106 -0
  277. package/src/sast/index.js +17 -0
  278. package/src/sast/java-ast-folding.js +561 -0
  279. package/src/sast/java-bench-extras.js +708 -0
  280. package/src/sast/java-collection-passthrough.js +178 -0
  281. package/src/sast/java-constant-fold.js +244 -0
  282. package/src/sast/java-deserialization.js +125 -0
  283. package/src/sast/jndi.js +104 -0
  284. package/src/sast/juliet-shape.js +324 -0
  285. package/src/sast/jwt-exp.js +104 -0
  286. package/src/sast/kotlin.js +82 -0
  287. package/src/sast/laravel-hardening.js +198 -0
  288. package/src/sast/ldap-injection.js +100 -0
  289. package/src/sast/llm-owasp.js +465 -0
  290. package/src/sast/llm-stored-prompt.js +103 -0
  291. package/src/sast/llm-trading-agent.js +161 -0
  292. package/src/sast/llm.js +308 -0
  293. package/src/sast/logic.js +140 -0
  294. package/src/sast/mass-assignment.js +101 -0
  295. package/src/sast/mcp-audit.js +242 -0
  296. package/src/sast/mobile-manifest.js +195 -0
  297. package/src/sast/model-load.js +164 -0
  298. package/src/sast/mutation-xss.js +87 -0
  299. package/src/sast/nosql-injection.js +82 -0
  300. package/src/sast/open-redirect.js +119 -0
  301. package/src/sast/php.js +91 -0
  302. package/src/sast/pipeline.js +122 -0
  303. package/src/sast/primary-cwe-java.js +155 -0
  304. package/src/sast/prompt-firewall.js +151 -0
  305. package/src/sast/prompt-template.js +157 -0
  306. package/src/sast/prototype-pollution.js +112 -0
  307. package/src/sast/python-sinks.js +195 -0
  308. package/src/sast/quarkus-hardening.js +102 -0
  309. package/src/sast/rag-poisoning.js +118 -0
  310. package/src/sast/rate-limit.js +128 -0
  311. package/src/sast/response-splitting.js +138 -0
  312. package/src/sast/ruby.js +108 -0
  313. package/src/sast/rust.js +105 -0
  314. package/src/sast/solidity.js +167 -0
  315. package/src/sast/springboot-hardening.js +186 -0
  316. package/src/sast/ssrf-cloud-metadata.js +80 -0
  317. package/src/sast/ssti.js +116 -0
  318. package/src/sast/swift.js +162 -0
  319. package/src/sast/toctou.js +95 -0
  320. package/src/sast/webhook.js +101 -0
  321. package/src/sast/xpath-injection.js +51 -0
  322. package/src/sast/xxe.js +140 -0
  323. package/src/sast/zip-slip.js +200 -0
  324. package/src/sca/base-images.json +45 -0
  325. package/src/sca/container.js +107 -0
  326. package/src/sca/dep-confusion.js +134 -0
  327. package/src/sca/index.js +6 -0
  328. package/src/sca/popular-packages.json +41 -0
  329. package/src/sca/sarif-ingest.js +187 -0
  330. package/src/sca/vuln-function-hints.json +89 -0
  331. package/src/secrets/index.js +4 -0
@@ -0,0 +1,192 @@
1
+ export const id = 227;
2
+ export const ids = [227];
3
+ export const modules = {
4
+
5
+ /***/ 7227:
6
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
7
+
8
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
9
+ /* harmony export */ evaluatePolicy: () => (/* binding */ evaluatePolicy)
10
+ /* harmony export */ });
11
+ /* unused harmony export _internals */
12
+ /* harmony import */ var node_fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3024);
13
+ /* harmony import */ var node_child_process__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1421);
14
+ // Policy-as-code gate (FR-SDLC-9).
15
+ //
16
+ // Today's CI gate is `--fail-on <severity>`. That's coarse. Customers want
17
+ // to write nuanced rules: "fail if any sql-injection finding has
18
+ // confidence ≥ 0.8 AND the file is under src/api/", or "fail if total
19
+ // exploitability score across critical findings exceeds 5".
20
+ //
21
+ // We support two modes:
22
+ //
23
+ // 1. EXTERNAL OPA: if the `opa` binary is on PATH and `--policy <file.rego>`
24
+ // is supplied, we shell out to `opa eval -d <file> -i <findings.json>
25
+ // "data.<package>.deny"`. This is the right answer for customers who
26
+ // already use OPA elsewhere.
27
+ //
28
+ // 2. EMBEDDED MINI: when no opa binary is available, fall back to a tiny
29
+ // DSL that's a strict subset of rego. Rules read top-level
30
+ // `package`/`deny` blocks; each `deny` is a JS-evaluable expression
31
+ // over findings[]. This lets the v1 ship without an external binary
32
+ // dep while documenting the upgrade path.
33
+
34
+
35
+
36
+
37
+ // ─── External OPA ─────────────────────────────────────────────────────────
38
+
39
+ function _haveOpa() {
40
+ try {
41
+ const r = (0,node_child_process__WEBPACK_IMPORTED_MODULE_1__.spawnSync)('opa', ['version'], { stdio: 'ignore', timeout: 3000 });
42
+ return r.status === 0;
43
+ } catch { return false; }
44
+ }
45
+
46
+ function _runOpa(policyFile, findingsJsonPath, packageName) {
47
+ const r = (0,node_child_process__WEBPACK_IMPORTED_MODULE_1__.spawnSync)('opa', [
48
+ 'eval', '-d', policyFile, '-i', findingsJsonPath,
49
+ `data.${packageName}.deny`,
50
+ ], { encoding: 'utf8', timeout: 10_000 });
51
+ if (r.error) return { ok: false, reason: `opa-error:${r.error.code || r.error.message}` };
52
+ if (r.status !== 0) return { ok: false, reason: `opa-exit:${r.status}`, stderr: r.stderr };
53
+ try {
54
+ const parsed = JSON.parse(r.stdout);
55
+ const result = parsed.result?.[0]?.expressions?.[0]?.value;
56
+ return { ok: true, denials: Array.isArray(result) ? result : [] };
57
+ } catch (e) {
58
+ return { ok: false, reason: `opa-output-parse:${e.message}` };
59
+ }
60
+ }
61
+
62
+ // ─── Embedded mini DSL ────────────────────────────────────────────────────
63
+ //
64
+ // Rego is too big to reimplement. We support a tiny shape:
65
+ //
66
+ // # POLICY: agentic-security policy-gate v1
67
+ // deny[msg] {
68
+ // finding := input.findings[_]
69
+ // finding.severity == "critical"
70
+ // msg := sprintf("critical finding: %v at %v", [finding.vuln, finding.file])
71
+ // }
72
+ //
73
+ // Parser strategy: extract each `deny[msg] { ... }` block; translate the
74
+ // body to a JS predicate. The grammar we accept is:
75
+ //
76
+ // - `<lhs> == <value>` / `<lhs> != <value>` / `<lhs> > <num>` / `<lhs> < <num>`
77
+ // - `<lhs>` references `finding.<field>` or `input.<field>`
78
+ // - `msg := "..."` or `msg := sprintf("...", [args])` — the msg literal
79
+ // - newlines + `;` as separators
80
+ //
81
+ // Anything more complex requires the external OPA binary.
82
+
83
+ function _parseEmbedded(policyText) {
84
+ const blocks = [];
85
+ // Match each `deny[NAME] { ... }` block (or `deny { ... }`).
86
+ const blockRe = /\bdeny(?:\s*\[\s*(\w+)\s*\])?\s*\{([\s\S]*?)\}/g;
87
+ let m;
88
+ while ((m = blockRe.exec(policyText))) {
89
+ const body = m[2];
90
+ const conditions = [];
91
+ let msgExpr = `"policy violation"`;
92
+ for (const line of body.split(/[\n;]/)) {
93
+ const ln = line.trim();
94
+ if (!ln || ln.startsWith('#')) continue;
95
+ // Assignment: `<id> := <expr>`
96
+ const asn = ln.match(/^(\w+)\s*:=\s*(.+)$/);
97
+ if (asn && asn[1] !== 'msg') continue; // skip non-msg assignments
98
+ if (asn && asn[1] === 'msg') { msgExpr = asn[2].trim(); continue; }
99
+ // Comparison: `finding.<field> <op> <value>`
100
+ const cmp = ln.match(/^(finding|input)\.([a-zA-Z_][\w.]*)\s*(==|!=|<=|>=|<|>)\s*(.+)$/);
101
+ if (!cmp) continue;
102
+ const [, scope, field, op, valueRaw] = cmp;
103
+ let value = valueRaw.trim();
104
+ if (/^".*"$/.test(value)) value = JSON.stringify(value.slice(1, -1));
105
+ conditions.push({ scope, field, op, value });
106
+ }
107
+ blocks.push({ conditions, msgExpr });
108
+ }
109
+ return blocks;
110
+ }
111
+
112
+ function _evalBlock(block, finding) {
113
+ for (const c of block.conditions) {
114
+ const lhs = _resolvePath(finding, c.field);
115
+ let rhs;
116
+ try { rhs = JSON.parse(c.value); }
117
+ catch { rhs = c.value.replace(/^"|"$/g, ''); }
118
+ if (c.op === '==' && lhs !== rhs) return null;
119
+ if (c.op === '!=' && lhs === rhs) return null;
120
+ if (c.op === '>' && !(Number(lhs) > Number(rhs))) return null;
121
+ if (c.op === '<' && !(Number(lhs) < Number(rhs))) return null;
122
+ if (c.op === '>=' && !(Number(lhs) >= Number(rhs))) return null;
123
+ if (c.op === '<=' && !(Number(lhs) <= Number(rhs))) return null;
124
+ }
125
+ return _renderMsg(block.msgExpr, finding);
126
+ }
127
+
128
+ function _resolvePath(obj, dotPath) {
129
+ return dotPath.split('.').reduce((o, k) => (o == null ? undefined : o[k]), obj);
130
+ }
131
+
132
+ function _renderMsg(expr, finding) {
133
+ // Strip outer quotes if string literal.
134
+ const m = expr.match(/^["'](.+)["']$/);
135
+ if (m) return m[1];
136
+ // sprintf shape: sprintf("...", [a, b])
137
+ const sf = expr.match(/^sprintf\s*\(\s*"([^"]+)"\s*,\s*\[(.+)\]\s*\)$/);
138
+ if (sf) {
139
+ const fmt = sf[1];
140
+ const args = sf[2].split(',').map(s => _resolvePath(finding, s.trim().replace(/^finding\./, '')));
141
+ let i = 0;
142
+ return fmt.replace(/%v/g, () => String(args[i++] ?? ''));
143
+ }
144
+ return expr;
145
+ }
146
+
147
+ function _runEmbedded(policyText, findings) {
148
+ const blocks = _parseEmbedded(policyText);
149
+ const denials = [];
150
+ for (const f of findings) {
151
+ for (const b of blocks) {
152
+ const msg = _evalBlock(b, f);
153
+ if (msg) denials.push(msg);
154
+ }
155
+ }
156
+ return { ok: true, denials };
157
+ }
158
+
159
+ // ─── Public API ────────────────────────────────────────────────────────────
160
+
161
+ /**
162
+ * Evaluate a policy file against the findings list.
163
+ * Returns { ok, denials, runner } — denials is an array of human-readable
164
+ * strings (one per violation). When denials.length > 0, the gate fails.
165
+ */
166
+ function evaluatePolicy(policyPath, findings, opts = {}) {
167
+ if (!policyPath || !node_fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(policyPath)) {
168
+ return { ok: false, reason: 'policy-file-missing' };
169
+ }
170
+ const policyText = node_fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync(policyPath, 'utf8');
171
+ const useExternal = !opts.embeddedOnly && _haveOpa();
172
+ if (useExternal) {
173
+ // Write findings to a temp file the opa binary reads.
174
+ const tmp = `/tmp/as-policy-${Date.now()}.json`;
175
+ node_fs__WEBPACK_IMPORTED_MODULE_0__.writeFileSync(tmp, JSON.stringify({ findings }));
176
+ const pkgMatch = policyText.match(/^\s*package\s+([\w.]+)/m);
177
+ const pkg = pkgMatch ? pkgMatch[1] : 'main';
178
+ const r = _runOpa(policyPath, tmp, pkg);
179
+ try { node_fs__WEBPACK_IMPORTED_MODULE_0__.unlinkSync(tmp); } catch {}
180
+ if (r.ok) return { ...r, runner: 'opa' };
181
+ // Fall through to embedded on opa error.
182
+ }
183
+ const r = _runEmbedded(policyText, findings);
184
+ return { ...r, runner: 'embedded' };
185
+ }
186
+
187
+ const _internals = { _parseEmbedded, _evalBlock, _runEmbedded };
188
+
189
+
190
+ /***/ })
191
+
192
+ };
@@ -0,0 +1,167 @@
1
+ export const id = 301;
2
+ export const ids = [301];
3
+ export const modules = {
4
+
5
+ /***/ 1301:
6
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
7
+
8
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
9
+ /* harmony export */ describeTarget: () => (/* binding */ describeTarget),
10
+ /* harmony export */ loadTargetManifest: () => (/* binding */ loadTargetManifest),
11
+ /* harmony export */ validateTarget: () => (/* binding */ validateTarget)
12
+ /* harmony export */ });
13
+ /* unused harmony export _internals */
14
+ /* harmony import */ var node_fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3024);
15
+ /* harmony import */ var node_path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6760);
16
+ // Verifier target harness (FR-LIVE-HARNESS).
17
+ //
18
+ // Customer projects describe how to bring up the app they want the verifier
19
+ // to execute PoCs against. The manifest lives at
20
+ // `.agentic-security/verifier-target.yaml` and the verifier reads it before
21
+ // running `--live` mode. v1 supports two manifest shapes:
22
+ //
23
+ // shape: docker-compose
24
+ // compose: docker-compose.yml
25
+ // service: web
26
+ // port: 3000
27
+ // wait-for: http://localhost:3000/healthz
28
+ //
29
+ // ─── or ───
30
+ //
31
+ // shape: command
32
+ // start: npm run dev
33
+ // port: 3000
34
+ // wait-for: http://localhost:3000/healthz
35
+ // stop: pkill -f "npm run dev"
36
+ //
37
+ // We DO NOT execute the manifest in this module — that's the verifier
38
+ // sandbox's job (and the customer's explicit opt-in via --live). This
39
+ // module parses, validates, and surfaces a structured object the verifier
40
+ // can act on (or refuse to act on).
41
+
42
+
43
+
44
+
45
+ const MANIFEST_PATH = node_path__WEBPACK_IMPORTED_MODULE_1__.join('.agentic-security', 'verifier-target.yaml');
46
+
47
+ // Minimal YAML subset parser — keep parity with the polyglot bench parser,
48
+ // scoped to the small set of keys this manifest uses. Standalone here to
49
+ // avoid a runtime dep.
50
+ function _parse(text) {
51
+ const out = {};
52
+ for (const raw of String(text || '').split(/\r?\n/)) {
53
+ const line = raw.replace(/#.*$/, '').trim();
54
+ if (!line) continue;
55
+ const m = line.match(/^([\w-]+)\s*:\s*(.*)$/);
56
+ if (!m) continue;
57
+ const [, key, val] = m;
58
+ out[key] = _coerce(val);
59
+ }
60
+ return out;
61
+ }
62
+
63
+ function _coerce(v) {
64
+ if (v === undefined || v === null) return null;
65
+ v = String(v).trim();
66
+ if (/^".*"$/.test(v)) return v.slice(1, -1);
67
+ if (/^'.*'$/.test(v)) return v.slice(1, -1);
68
+ if (/^-?\d+$/.test(v)) return parseInt(v, 10);
69
+ return v;
70
+ }
71
+
72
+ /**
73
+ * Read the verifier-target manifest from scanRoot. Returns:
74
+ * { ok: true, target } — successfully parsed and validated
75
+ * { ok: false, reason } — manifest missing or invalid
76
+ *
77
+ * Never throws.
78
+ */
79
+ function loadTargetManifest(scanRoot) {
80
+ const fp = node_path__WEBPACK_IMPORTED_MODULE_1__.join(scanRoot || process.cwd(), MANIFEST_PATH);
81
+ if (!node_fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(fp)) return { ok: false, reason: 'no-manifest' };
82
+ let raw;
83
+ try { raw = node_fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync(fp, 'utf8'); }
84
+ catch (e) { return { ok: false, reason: `read-error:${e.message}` }; }
85
+ const parsed = _parse(raw);
86
+ const shape = parsed.shape;
87
+ if (shape !== 'docker-compose' && shape !== 'command') {
88
+ return { ok: false, reason: `unknown-shape:${shape || 'missing'}` };
89
+ }
90
+ if (shape === 'docker-compose') {
91
+ if (!parsed.compose || !parsed.service) {
92
+ return { ok: false, reason: 'docker-compose-shape-needs-compose-and-service' };
93
+ }
94
+ }
95
+ if (shape === 'command') {
96
+ if (!parsed.start) {
97
+ return { ok: false, reason: 'command-shape-needs-start' };
98
+ }
99
+ }
100
+ const target = {
101
+ shape,
102
+ compose: parsed.compose || null,
103
+ service: parsed.service || null,
104
+ start: parsed.start || null,
105
+ stop: parsed.stop || null,
106
+ port: parsed.port || null,
107
+ waitFor: parsed['wait-for'] || parsed.waitFor || null,
108
+ url: parsed.url || (parsed.port ? `http://localhost:${parsed.port}` : null),
109
+ };
110
+ return { ok: true, target };
111
+ }
112
+
113
+ /**
114
+ * Render a quick summary for human consumption (CLI output, logs).
115
+ */
116
+ function describeTarget(target) {
117
+ if (!target) return '(none)';
118
+ if (target.shape === 'docker-compose') {
119
+ return `docker-compose service ${target.service} from ${target.compose} on ${target.url || `:${target.port}`}`;
120
+ }
121
+ if (target.shape === 'command') {
122
+ return `command "${target.start}" on ${target.url || `:${target.port}`}`;
123
+ }
124
+ return `unknown-shape ${target.shape}`;
125
+ }
126
+
127
+ /**
128
+ * Pre-flight safety check: refuse to bring up a target whose start command
129
+ * looks dangerous. Curated allowlist of common shapes; everything else
130
+ * requires AGENTIC_SECURITY_VERIFY_TARGET_OK=1 to opt in explicitly.
131
+ */
132
+ function validateTarget(target) {
133
+ if (!target) return { ok: false, reason: 'no-target' };
134
+ if (target.shape === 'docker-compose') {
135
+ // docker-compose is safe-ish by design.
136
+ return { ok: true };
137
+ }
138
+ if (target.shape === 'command') {
139
+ const SAFE_HINTS = [
140
+ /^npm\s+(?:run\s+)?(?:dev|start|serve)/,
141
+ /^yarn\s+(?:dev|start|serve)/,
142
+ /^pnpm\s+(?:run\s+)?(?:dev|start|serve)/,
143
+ /^node\s+/,
144
+ /^python(?:\d?)\s+-m\s+/,
145
+ /^python(?:\d?)\s+\S+\.py/,
146
+ /^uvicorn\s+/,
147
+ /^gunicorn\s+/,
148
+ /^flask\s+run/,
149
+ /^go\s+run\s+/,
150
+ /^java\s+-jar\s+/,
151
+ /^cargo\s+run/,
152
+ ];
153
+ if (process.env.AGENTIC_SECURITY_VERIFY_TARGET_OK === '1') return { ok: true, escaped: true };
154
+ if (!SAFE_HINTS.some(re => re.test(target.start))) {
155
+ return { ok: false, reason: `start-command-not-in-safe-allowlist (set AGENTIC_SECURITY_VERIFY_TARGET_OK=1 to override)` };
156
+ }
157
+ return { ok: true };
158
+ }
159
+ return { ok: false, reason: `unknown-shape:${target.shape}` };
160
+ }
161
+
162
+ const _internals = { MANIFEST_PATH };
163
+
164
+
165
+ /***/ })
166
+
167
+ };
@@ -0,0 +1,18 @@
1
+ export const id = 384;
2
+ export const ids = [384];
3
+ export const modules = {
4
+
5
+ /***/ 4384:
6
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
7
+
8
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
9
+ /* harmony export */ scanCredentials: () => (/* reexport safe */ _engine_js__WEBPACK_IMPORTED_MODULE_0__.Sv)
10
+ /* harmony export */ });
11
+ /* harmony import */ var _engine_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3291);
12
+ // Secrets submodule view of the engine — credential + entropy + TODO scanning.
13
+
14
+
15
+
16
+ /***/ })
17
+
18
+ };
@@ -0,0 +1,126 @@
1
+ export const id = 476;
2
+ export const ids = [476];
3
+ export const modules = {
4
+
5
+ /***/ 8476:
6
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
7
+
8
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
9
+ /* harmony export */ synthesizeRules: () => (/* binding */ synthesizeRules)
10
+ /* harmony export */ });
11
+ /* unused harmony export _internals */
12
+ /* harmony import */ var node_fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3024);
13
+ /* harmony import */ var node_path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6760);
14
+ // Auto-rule synthesis from repeated FPs (FR-LEARN-6).
15
+ //
16
+ // Reads `.agentic-security/triage-feedback.json` (populated by the /triage
17
+ // slash command). When 5+ findings sharing a similar shape get marked FP,
18
+ // propose a YAML suppression rule and write it to
19
+ // `.agentic-security/rules-proposed/auto-<timestamp>.yml`. The operator
20
+ // reviews and either drops it into `rules/` (active) or deletes it.
21
+ //
22
+ // Honest scope:
23
+ // - We propose, we don't auto-activate. The customer decides.
24
+ // - Similar-shape = same (rule_id or vuln-family) AND same file glob root.
25
+ // - Threshold = 5 occurrences by default (env override).
26
+
27
+
28
+
29
+
30
+ const TRIAGE_PATH = node_path__WEBPACK_IMPORTED_MODULE_1__.join('.agentic-security', 'triage-feedback.json');
31
+ const PROPOSED_DIR = node_path__WEBPACK_IMPORTED_MODULE_1__.join('.agentic-security', 'rules-proposed');
32
+
33
+ const DEFAULT_FP_THRESHOLD = 5;
34
+
35
+ function _readTriage(scanRoot) {
36
+ const fp = node_path__WEBPACK_IMPORTED_MODULE_1__.join(scanRoot || process.cwd(), TRIAGE_PATH);
37
+ if (!node_fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(fp)) return null;
38
+ try { return JSON.parse(node_fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync(fp, 'utf8')); } catch { return null; }
39
+ }
40
+
41
+ function _shapeKey(entry) {
42
+ // Group by rule/family + the dir prefix (first two path segments) so we
43
+ // suggest rules scoped to the same module — never project-wide.
44
+ const fam = entry.family || entry.cwe || entry.vuln || 'unknown';
45
+ const file = entry.file || '';
46
+ const dir = file.split('/').slice(0, 2).join('/') || '.';
47
+ return `${fam}::${dir}`;
48
+ }
49
+
50
+ function _summarizeGroup(entries) {
51
+ const e0 = entries[0];
52
+ return {
53
+ family: e0.family || null,
54
+ rule: e0.cwe || e0.vuln || 'unknown',
55
+ dirGlob: (e0.file || '').split('/').slice(0, 2).join('/') + '/**',
56
+ count: entries.length,
57
+ examples: entries.slice(0, 3).map(e => `${e.file}:${e.line}`),
58
+ };
59
+ }
60
+
61
+ function _yamlProposal(group) {
62
+ const ruleId = `auto-suppress-${group.family || group.rule}-${Date.now().toString(36)}`;
63
+ return `# Auto-synthesised suppression proposal (FR-LEARN-6).
64
+ # Generated from ${group.count} false-positive verdicts on ${group.family || group.rule}
65
+ # in ${group.dirGlob}.
66
+ #
67
+ # Examples:
68
+ ${group.examples.map(e => '# - ' + e).join('\n')}
69
+ #
70
+ # Review carefully BEFORE moving into rules/. This is a PROPOSAL.
71
+
72
+ - id: ${ruleId}
73
+ title: "Auto-suppress: ${group.family || group.rule}"
74
+ description: "Repeated FP verdicts in ${group.dirGlob}"
75
+ shadow: true # never blocks CI; safe by default
76
+ match:
77
+ family: ${group.family || group.rule}
78
+ paths:
79
+ - "${group.dirGlob}"
80
+ action: suppress
81
+ `;
82
+ }
83
+
84
+ /**
85
+ * Public entry: scan the triage history and emit a proposal YAML for any
86
+ * group with ≥ threshold FP verdicts. Returns the list of proposals written.
87
+ */
88
+ function synthesizeRules(scanRoot, opts = {}) {
89
+ const threshold = parseInt(opts.threshold || process.env.AGENTIC_SECURITY_RULE_SYNTHESIS_THRESHOLD || String(DEFAULT_FP_THRESHOLD), 10);
90
+ const triage = _readTriage(scanRoot);
91
+ if (!triage) return [];
92
+ // triage format (per v0.46): { verdicts: [{file, line, vuln, family, verdict, ...}] }
93
+ const verdicts = triage.verdicts || [];
94
+ const fps = verdicts.filter(v => v.verdict === 'fp' || v.verdict === 'false-positive');
95
+ if (!fps.length) return [];
96
+ const groups = new Map();
97
+ for (const e of fps) {
98
+ const k = _shapeKey(e);
99
+ if (!groups.has(k)) groups.set(k, []);
100
+ groups.get(k).push(e);
101
+ }
102
+ const proposals = [];
103
+ const dir = node_path__WEBPACK_IMPORTED_MODULE_1__.join(scanRoot || process.cwd(), PROPOSED_DIR);
104
+ for (const [, group] of groups) {
105
+ if (group.length < threshold) continue;
106
+ const summary = _summarizeGroup(group);
107
+ const yaml = _yamlProposal(summary);
108
+ const name = `auto-${(summary.family || summary.rule).replace(/[^a-zA-Z0-9_-]/g, '-')}-${Date.now().toString(36)}.yml`;
109
+ const fp = node_path__WEBPACK_IMPORTED_MODULE_1__.join(dir, name);
110
+ if (!opts.dryRun) {
111
+ try {
112
+ node_fs__WEBPACK_IMPORTED_MODULE_0__.mkdirSync(dir, { recursive: true });
113
+ node_fs__WEBPACK_IMPORTED_MODULE_0__.writeFileSync(fp, yaml);
114
+ } catch { /* non-fatal */ }
115
+ }
116
+ proposals.push({ ...summary, file: fp, yaml });
117
+ }
118
+ return proposals;
119
+ }
120
+
121
+ const _internals = { DEFAULT_FP_THRESHOLD, TRIAGE_PATH, PROPOSED_DIR };
122
+
123
+
124
+ /***/ })
125
+
126
+ };