@clear-capabilities/agentic-security-scanner 0.172.0 → 0.173.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 (202) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/bin/agentic-security.js +37 -0
  3. package/dist/119.index.js +197 -0
  4. package/dist/128.index.js +129 -0
  5. package/dist/1293.index.js +5689 -0
  6. package/dist/1336.index.js +101 -101
  7. package/dist/1351.index.js +133 -0
  8. package/dist/1387.index.js +271 -0
  9. package/dist/1437.index.js +23 -0
  10. package/dist/1445.index.js +110 -0
  11. package/dist/1505.index.js +151 -0
  12. package/dist/1557.index.js +293 -0
  13. package/dist/1621.index.js +311 -0
  14. package/dist/1751.index.js +160 -0
  15. package/dist/1765.index.js +727 -0
  16. package/dist/1861.index.js +690 -0
  17. package/dist/1898.index.js +116 -0
  18. package/dist/1906.index.js +433 -0
  19. package/dist/1920.index.js +1 -291
  20. package/dist/208.index.js +1631 -0
  21. package/dist/2199.index.js +0 -239
  22. package/dist/2223.index.js +159 -0
  23. package/dist/2530.index.js +152 -0
  24. package/dist/2565.index.js +116 -0
  25. package/dist/2574.index.js +127 -0
  26. package/dist/2620.index.js +345 -0
  27. package/dist/2773.index.js +98 -0
  28. package/dist/2775.index.js +32 -0
  29. package/dist/2966.index.js +171 -0
  30. package/dist/2972.index.js +87 -0
  31. package/dist/2991.index.js +131 -0
  32. package/dist/3063.index.js +833 -0
  33. package/dist/3075.index.js +227 -0
  34. package/dist/3121.index.js +297 -0
  35. package/dist/3314.index.js +263 -0
  36. package/dist/3480.index.js +1822 -0
  37. package/dist/3481.index.js +24 -0
  38. package/dist/3506.index.js +268 -0
  39. package/dist/3533.index.js +591 -0
  40. package/dist/3653.index.js +450 -0
  41. package/dist/3822.index.js +131 -0
  42. package/dist/3868.index.js +292 -0
  43. package/dist/3917.index.js +152 -0
  44. package/dist/3918.index.js +192 -0
  45. package/dist/4090.index.js +288 -0
  46. package/dist/4121.index.js +1190 -0
  47. package/dist/4142.index.js +0 -239
  48. package/dist/4336.index.js +436 -0
  49. package/dist/4387.index.js +532 -0
  50. package/dist/4413.index.js +302 -0
  51. package/dist/4476.index.js +4510 -0
  52. package/dist/4491.index.js +133 -0
  53. package/dist/4538.index.js +185 -0
  54. package/dist/4684.index.js +319 -0
  55. package/dist/4740.index.js +165 -0
  56. package/dist/4780.index.js +209 -0
  57. package/dist/4802.index.js +225 -0
  58. package/dist/4812.index.js +379 -0
  59. package/dist/4835.index.js +126 -0
  60. package/dist/494.index.js +226 -0
  61. package/dist/4991.index.js +549 -0
  62. package/dist/5199.index.js +305 -0
  63. package/dist/5216.index.js +109 -0
  64. package/dist/5439.index.js +301 -0
  65. package/dist/5443.index.js +97 -0
  66. package/dist/5496.index.js +377 -0
  67. package/dist/550.index.js +2 -1
  68. package/dist/5801.index.js +588 -0
  69. package/dist/5858.index.js +223 -0
  70. package/dist/5933.index.js +143 -0
  71. package/dist/601.index.js +23 -0
  72. package/dist/6173.index.js +273 -0
  73. package/dist/6291.index.js +1871 -0
  74. package/dist/6312.index.js +666 -0
  75. package/dist/634.index.js +16182 -0
  76. package/dist/644.index.js +87 -0
  77. package/dist/6508.index.js +283 -0
  78. package/dist/6560.index.js +645 -0
  79. package/dist/6576.index.js +422 -0
  80. package/dist/6579.index.js +271 -0
  81. package/dist/6745.index.js +305 -0
  82. package/dist/6818.index.js +21642 -0
  83. package/dist/6972.index.js +167 -0
  84. package/dist/6995.index.js +163 -0
  85. package/dist/7249.index.js +191 -0
  86. package/dist/7372.index.js +1197 -0
  87. package/dist/7405.index.js +23 -6
  88. package/dist/7546.index.js +541 -0
  89. package/dist/76.index.js +448 -0
  90. package/dist/7879.index.js +163 -0
  91. package/dist/8025.index.js +130 -0
  92. package/dist/8054.index.js +248 -0
  93. package/dist/8097.index.js +201 -0
  94. package/dist/8126.index.js +191 -0
  95. package/dist/8178.index.js +78 -0
  96. package/dist/818.index.js +212 -0
  97. package/dist/8382.index.js +93 -0
  98. package/dist/8408.index.js +261 -0
  99. package/dist/8540.index.js +174 -0
  100. package/dist/8635.index.js +802 -0
  101. package/dist/8688.index.js +410 -0
  102. package/dist/8699.index.js +779 -0
  103. package/dist/8891.index.js +457 -0
  104. package/dist/8916.index.js +885 -0
  105. package/dist/9146.index.js +170 -0
  106. package/dist/9168.index.js +841 -0
  107. package/dist/9292.index.js +369 -0
  108. package/dist/9382.index.js +338 -48
  109. package/dist/9422.index.js +866 -0
  110. package/dist/9440.index.js +453 -0
  111. package/dist/9479.index.js +152 -0
  112. package/dist/9481.index.js +220 -0
  113. package/dist/9539.index.js +100 -0
  114. package/dist/9547.index.js +103 -0
  115. package/dist/9560.index.js +41 -61
  116. package/dist/9692.index.js +90 -0
  117. package/dist/9800.index.js +213 -1
  118. package/dist/9899.index.js +138 -0
  119. package/dist/9981.index.js +206 -0
  120. package/dist/999.index.js +117 -0
  121. package/dist/agentic-security.mjs +28 -28
  122. package/dist/agentic-security.mjs.sha256 +1 -1
  123. package/package.json +31 -6
  124. package/src/context-intelligence/CLAUDE.md +4 -0
  125. package/src/context-intelligence/adapters/haskell-hie.js +28 -1
  126. package/src/context-intelligence/candidates.js +2 -1
  127. package/src/context-intelligence/canonical.js +25 -0
  128. package/src/context-intelligence/capabilities.js +2 -1
  129. package/src/context-intelligence/cli.js +16 -10
  130. package/src/context-intelligence/config.js +4 -1
  131. package/src/context-intelligence/controls.js +108 -10
  132. package/src/context-intelligence/counterexample.js +200 -0
  133. package/src/context-intelligence/cross-route.js +111 -0
  134. package/src/context-intelligence/entrypoints.js +2 -2
  135. package/src/context-intelligence/evaluation/index.js +11 -4
  136. package/src/context-intelligence/evaluation/scripted-reader.js +12 -2
  137. package/src/context-intelligence/findings.js +166 -0
  138. package/src/context-intelligence/invariants.js +197 -0
  139. package/src/context-intelligence/queue.js +6 -1
  140. package/src/context-intelligence/reachability.js +10 -4
  141. package/src/context-intelligence/review.js +129 -16
  142. package/src/dataflow/access-paths.js +11 -0
  143. package/src/dataflow/analysis-limits.js +66 -0
  144. package/src/dataflow/engine.js +272 -20
  145. package/src/dataflow/service-edges.js +174 -0
  146. package/src/dataflow/summaries.js +7 -1
  147. package/src/discovery/judge.js +2 -1
  148. package/src/engine.js +82 -14
  149. package/src/fix/apply-fix-service.js +55 -8
  150. package/src/fix/batch-journal.js +84 -0
  151. package/src/fix/exploit-replay.js +51 -0
  152. package/src/fix/footprint.js +65 -0
  153. package/src/fix/patch-policy.js +49 -0
  154. package/src/fix/secret-persistence.js +39 -0
  155. package/src/fix/test-commands.js +84 -0
  156. package/src/fix/verification-adapters.js +97 -0
  157. package/src/fix/verification-record.js +243 -0
  158. package/src/fix/verify-patch.js +89 -0
  159. package/src/ir/CLAUDE.md +5 -0
  160. package/src/ir/callgraph.js +23 -1
  161. package/src/ir/module-resolver.js +315 -0
  162. package/src/ir/parser-js.js +21 -2
  163. package/src/ir/semantic-graph.js +245 -0
  164. package/src/lineage/build-attested-correlation.js +63 -0
  165. package/src/lineage/deployment-identity.js +76 -0
  166. package/src/mcp/tools.js +13 -34
  167. package/src/pipeline/canonical-output.js +64 -0
  168. package/src/pipeline/detector-runner.js +7 -0
  169. package/src/pipeline/scan-health.js +14 -0
  170. package/src/pipeline/supervised-analyzers.js +125 -0
  171. package/src/pipeline/supervised-child.js +17 -0
  172. package/src/pipeline/telemetry.js +79 -0
  173. package/src/posture/accuracy-scorecard.js +98 -9
  174. package/src/posture/artifact-registry.js +5 -0
  175. package/src/posture/assurance/evidence-registry.js +215 -0
  176. package/src/posture/assurance/release-package-verify.js +135 -0
  177. package/src/posture/assurance/release-package.js +118 -0
  178. package/src/posture/assurance/release-verdict.js +94 -0
  179. package/src/posture/assurance/waiver.js +200 -0
  180. package/src/posture/compliance-truth.js +100 -0
  181. package/src/posture/evaluation/scan-child.js +3 -1
  182. package/src/posture/evaluation/why-missed.js +3 -1
  183. package/src/posture/exploitability-evidence.js +141 -0
  184. package/src/posture/fix-verify.js +4 -2
  185. package/src/posture/fleet/exposure-ranking.js +115 -0
  186. package/src/posture/fleet/service-chain-graph.js +150 -0
  187. package/src/posture/graph-reconciliation.js +154 -0
  188. package/src/posture/provenance/coverage.js +103 -0
  189. package/src/posture/provenance/git-evidence.js +84 -0
  190. package/src/posture/provenance/origin-resolver.js +7 -1
  191. package/src/posture/provenance/predicate-replay.js +14 -4
  192. package/src/posture/runtime-correlation.js +61 -15
  193. package/src/posture/runtime-explanation.js +116 -0
  194. package/src/posture/runtime-trace-ingest.js +194 -0
  195. package/src/posture/scan-checkpoint.js +38 -10
  196. package/src/posture/waf-ingest.js +7 -2
  197. package/src/report/index.js +4 -0
  198. package/src/report/oscal.js +38 -0
  199. package/src/report/perspectives.js +150 -0
  200. package/src/sast/_comment-strip.js +8 -1
  201. package/src/sast/ruby.js +26 -0
  202. package/src/util/string-memo.js +38 -0
@@ -0,0 +1,160 @@
1
+ export const id = 1751;
2
+ export const ids = [1751];
3
+ export const modules = {
4
+
5
+ /***/ 71751:
6
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
7
+
8
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
9
+ /* harmony export */ loadFreshLineageGraph: () => (/* binding */ loadFreshLineageGraph),
10
+ /* harmony export */ loadSignedGraph: () => (/* binding */ loadSignedGraph)
11
+ /* harmony export */ });
12
+ /* harmony import */ var node_fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(73024);
13
+ /* harmony import */ var _posture_state_dir_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(69259);
14
+ /* harmony import */ var _posture_integrity_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(37455);
15
+ // graph-loader.js — Milestone 3, sub-project Server, increment 1.
16
+ //
17
+ // Reads and VERIFIES the `.agentic-security/lineage-graph.json` artifact
18
+ // before `explore` is allowed to serve a single byte of it. Reuses
19
+ // `posture/integrity.js`'s `verifyLastScan` DIRECTLY (per the plan and the
20
+ // root CLAUDE.md's own instruction) — this module does not implement any
21
+ // signature comparison of its own. `verifyLastScan` already uses
22
+ // `crypto.timingSafeEqual` internally.
23
+ //
24
+ // Loaded ONCE at server startup (see bin/agentic-security.js's cmdExplore)
25
+ // and held in memory for the life of the process — this is a read-only,
26
+ // single-scan-snapshot server; a change to the graph on disk mid-session is
27
+ // out of scope for this increment (threat-model doc's own "P0 is
28
+ // read-only" framing).
29
+
30
+
31
+
32
+
33
+
34
+ /**
35
+ * @param {string} scanRoot
36
+ * @returns {{ok:true, graph:object} | {ok:false, reason:'missing'|'unsigned'|'tampered'|'malformed', message:string}}
37
+ *
38
+ * Four, and only four, distinct failure reasons — each with its own clear
39
+ * message so an operator knows exactly what to do next:
40
+ * - 'missing' — no lineage-graph.json at all. Run a scan with
41
+ * AGENTIC_SECURITY_LINEAGE_DEEP=1 first.
42
+ * - 'unsigned' — the graph exists but its .sig sibling does not
43
+ * (verifyLastScan returns null). Refuse to serve an
44
+ * unverifiable graph.
45
+ * - 'tampered' — the graph exists and has a .sig, but the signature does
46
+ * not match the body (verifyLastScan returns false). The
47
+ * file was modified after signing, or signed under a
48
+ * different install key.
49
+ * - 'malformed' — the body passed signature verification but is not
50
+ * valid JSON. Should not happen from a normal scan; the
51
+ * file may be corrupted on disk after signing.
52
+ */
53
+ function loadSignedGraph(scanRoot) {
54
+ const graphPath = (0,_posture_state_dir_js__WEBPACK_IMPORTED_MODULE_1__.statePath)(scanRoot, 'lineage-graph.json');
55
+ const sigPath = graphPath + '.sig';
56
+
57
+ if (!node_fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(graphPath)) {
58
+ return {
59
+ ok: false,
60
+ reason: 'missing',
61
+ message: `No lineage graph found at ${graphPath}. Run a scan with AGENTIC_SECURITY_LINEAGE_DEEP=1 first (e.g. \`AGENTIC_SECURITY_LINEAGE_DEEP=1 agentic-security scan\`), then re-run \`agentic-security explore\`.`,
62
+ };
63
+ }
64
+
65
+ let body;
66
+ try {
67
+ body = node_fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync(graphPath, 'utf8');
68
+ } catch (e) {
69
+ return {
70
+ ok: false,
71
+ reason: 'missing',
72
+ message: `Lineage graph found at ${graphPath} but could not be read: ${e && e.message ? e.message : e}.`,
73
+ };
74
+ }
75
+
76
+ const verified = (0,_posture_integrity_js__WEBPACK_IMPORTED_MODULE_2__/* .verifyLastScan */ .Ef)(body, sigPath);
77
+ if (verified === null) {
78
+ return {
79
+ ok: false,
80
+ reason: 'unsigned',
81
+ message: `Lineage graph at ${graphPath} has no signature file (${sigPath} is missing). Refusing to serve an unverifiable graph. Re-run the scan (AGENTIC_SECURITY_LINEAGE_DEEP=1) to regenerate both files together.`,
82
+ };
83
+ }
84
+ if (verified === false) {
85
+ return {
86
+ ok: false,
87
+ reason: 'tampered',
88
+ message: `Lineage graph at ${graphPath} FAILED signature verification — its contents do not match ${sigPath}. The file may have been modified after the scan, or signed under a different install key. Refusing to serve a tampered graph. Re-run the scan to regenerate it.`,
89
+ };
90
+ }
91
+
92
+ let graph;
93
+ try {
94
+ graph = JSON.parse(body);
95
+ } catch (e) {
96
+ return {
97
+ ok: false,
98
+ reason: 'malformed',
99
+ message: `Lineage graph at ${graphPath} passed signature verification but is not valid JSON (${e && e.message ? e.message : e}). This should not happen from a normal scan — the file may be corrupted. Re-run the scan to regenerate it.`,
100
+ };
101
+ }
102
+
103
+ return { ok: true, graph };
104
+ }
105
+
106
+ /**
107
+ * Load .agentic-security/lineage-graph.json ONLY when it is genuinely
108
+ * fresh for THIS scan — never merely because a file happens to exist on
109
+ * disk. Shared by every caller that signs or narrates a graph:-derived
110
+ * compliance claim (M4 sub-project 6c's final whole-branch review found
111
+ * the identical staleness gap independently reachable from
112
+ * `attest --obligations` AND `compliance --walkthrough`, and required
113
+ * this predicate to live in exactly one place rather than being
114
+ * copy-pasted per caller — a safety check that drifts between two
115
+ * near-identical inline copies is worse than one shared bug).
116
+ *
117
+ * `.agentic-security/lineage-graph.json` is only rewritten when a scan
118
+ * actually finishes building a graph (`if (scan.lineageGraph)` in
119
+ * bin/agentic-security.js's persistence code) — an ordinary non-deep
120
+ * rescan, or a deep scan whose lineage build fails, leaves whatever file
121
+ * was there from an earlier successful deep scan untouched. Loading that
122
+ * stale graph and joining it to the CURRENT scan's other data would let a
123
+ * caller assert a graph-derived fact (e.g. "transit protected") about
124
+ * code that has since changed.
125
+ *
126
+ * `enabled: true` in `scan.scanHealth.lineageAnalysis` does NOT by itself
127
+ * mean the build succeeded — engine.js sets it the moment
128
+ * AGENTIC_SECURITY_LINEAGE_DEEP=1 is read, before the build even starts,
129
+ * and leaves it `true` even when the build later throws (only `failure`
130
+ * gets set in that case). `requested && enabled` alone therefore still
131
+ * accepts a stale graph after a failed rebuild — reproduced live via the
132
+ * scan's own already-shipped fault-injection fixture
133
+ * (test/lineage-fault-injection.test.js) before this `failure === null`
134
+ * check was added.
135
+ *
136
+ * @param {string} scanRoot
137
+ * @param {object} scan - the parsed last-scan.json for the CURRENT scan
138
+ * @returns {{graph:object|null, fresh:boolean, loaded:ReturnType<typeof loadSignedGraph>}}
139
+ * `fresh` is true only when a signed graph loaded successfully AND this
140
+ * scan's own scanHealth confirms lineage analysis was requested,
141
+ * enabled, and did not fail. `graph` is `loaded.graph` when fresh, else
142
+ * `null` — never the stale file, even when one exists on disk.
143
+ * `loaded` is the raw `loadSignedGraph` result, so a caller can still
144
+ * distinguish "no file at all" from "a file exists but isn't fresh" for
145
+ * its own disclosure message.
146
+ */
147
+ function loadFreshLineageGraph(scanRoot, scan) {
148
+ const la = scan?.scanHealth?.lineageAnalysis;
149
+ const requested = la?.requested === true;
150
+ const enabled = la?.enabled === true;
151
+ const failure = la?.failure ?? null;
152
+ const loaded = loadSignedGraph(scanRoot);
153
+ const fresh = loaded.ok && requested && enabled && failure === null;
154
+ return { graph: fresh ? loaded.graph : null, fresh, loaded };
155
+ }
156
+
157
+
158
+ /***/ })
159
+
160
+ };