@clear-capabilities/agentic-security-scanner 0.172.1 → 0.174.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 (201) hide show
  1. package/CHANGELOG.md +26 -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/1351.index.js +133 -0
  7. package/dist/1387.index.js +271 -0
  8. package/dist/1437.index.js +23 -0
  9. package/dist/1445.index.js +110 -0
  10. package/dist/1505.index.js +151 -0
  11. package/dist/1557.index.js +293 -0
  12. package/dist/1621.index.js +311 -0
  13. package/dist/1751.index.js +160 -0
  14. package/dist/1765.index.js +727 -0
  15. package/dist/1861.index.js +690 -0
  16. package/dist/1898.index.js +116 -0
  17. package/dist/1906.index.js +433 -0
  18. package/dist/1920.index.js +1 -291
  19. package/dist/208.index.js +1631 -0
  20. package/dist/2199.index.js +0 -239
  21. package/dist/2223.index.js +159 -0
  22. package/dist/2530.index.js +152 -0
  23. package/dist/2565.index.js +116 -0
  24. package/dist/2574.index.js +127 -0
  25. package/dist/2620.index.js +345 -0
  26. package/dist/2773.index.js +98 -0
  27. package/dist/2775.index.js +32 -0
  28. package/dist/2966.index.js +171 -0
  29. package/dist/2972.index.js +87 -0
  30. package/dist/2991.index.js +131 -0
  31. package/dist/3063.index.js +833 -0
  32. package/dist/3075.index.js +227 -0
  33. package/dist/3121.index.js +297 -0
  34. package/dist/3314.index.js +263 -0
  35. package/dist/3480.index.js +1822 -0
  36. package/dist/3481.index.js +24 -0
  37. package/dist/3506.index.js +268 -0
  38. package/dist/3533.index.js +591 -0
  39. package/dist/3653.index.js +450 -0
  40. package/dist/3822.index.js +131 -0
  41. package/dist/3868.index.js +292 -0
  42. package/dist/3917.index.js +152 -0
  43. package/dist/3918.index.js +192 -0
  44. package/dist/4090.index.js +288 -0
  45. package/dist/4121.index.js +1190 -0
  46. package/dist/4142.index.js +0 -239
  47. package/dist/4336.index.js +436 -0
  48. package/dist/4387.index.js +532 -0
  49. package/dist/4413.index.js +302 -0
  50. package/dist/4476.index.js +4510 -0
  51. package/dist/4491.index.js +133 -0
  52. package/dist/4538.index.js +185 -0
  53. package/dist/4684.index.js +319 -0
  54. package/dist/4740.index.js +165 -0
  55. package/dist/4780.index.js +209 -0
  56. package/dist/4802.index.js +225 -0
  57. package/dist/4812.index.js +379 -0
  58. package/dist/4835.index.js +126 -0
  59. package/dist/494.index.js +226 -0
  60. package/dist/4991.index.js +549 -0
  61. package/dist/5199.index.js +305 -0
  62. package/dist/5216.index.js +109 -0
  63. package/dist/5439.index.js +301 -0
  64. package/dist/5443.index.js +97 -0
  65. package/dist/5496.index.js +377 -0
  66. package/dist/550.index.js +2 -1
  67. package/dist/5801.index.js +588 -0
  68. package/dist/5858.index.js +223 -0
  69. package/dist/5933.index.js +143 -0
  70. package/dist/601.index.js +23 -0
  71. package/dist/6173.index.js +273 -0
  72. package/dist/6291.index.js +1871 -0
  73. package/dist/6312.index.js +666 -0
  74. package/dist/634.index.js +16182 -0
  75. package/dist/644.index.js +87 -0
  76. package/dist/6508.index.js +283 -0
  77. package/dist/6560.index.js +645 -0
  78. package/dist/6576.index.js +422 -0
  79. package/dist/6579.index.js +271 -0
  80. package/dist/6745.index.js +305 -0
  81. package/dist/6818.index.js +21642 -0
  82. package/dist/6972.index.js +167 -0
  83. package/dist/6995.index.js +163 -0
  84. package/dist/7249.index.js +191 -0
  85. package/dist/7372.index.js +1197 -0
  86. package/dist/7546.index.js +541 -0
  87. package/dist/76.index.js +448 -0
  88. package/dist/7879.index.js +163 -0
  89. package/dist/8025.index.js +130 -0
  90. package/dist/8054.index.js +248 -0
  91. package/dist/8097.index.js +201 -0
  92. package/dist/8126.index.js +191 -0
  93. package/dist/8178.index.js +78 -0
  94. package/dist/818.index.js +212 -0
  95. package/dist/8382.index.js +93 -0
  96. package/dist/8408.index.js +261 -0
  97. package/dist/8540.index.js +174 -0
  98. package/dist/8635.index.js +802 -0
  99. package/dist/8688.index.js +410 -0
  100. package/dist/8699.index.js +779 -0
  101. package/dist/8891.index.js +457 -0
  102. package/dist/8916.index.js +885 -0
  103. package/dist/9146.index.js +170 -0
  104. package/dist/9168.index.js +841 -0
  105. package/dist/9292.index.js +369 -0
  106. package/dist/9382.index.js +135 -11
  107. package/dist/9422.index.js +866 -0
  108. package/dist/9440.index.js +453 -0
  109. package/dist/9479.index.js +152 -0
  110. package/dist/9481.index.js +220 -0
  111. package/dist/9539.index.js +100 -0
  112. package/dist/9547.index.js +103 -0
  113. package/dist/9560.index.js +41 -61
  114. package/dist/9692.index.js +90 -0
  115. package/dist/9800.index.js +213 -1
  116. package/dist/9899.index.js +138 -0
  117. package/dist/9981.index.js +206 -0
  118. package/dist/999.index.js +117 -0
  119. package/dist/agentic-security.mjs +27 -27
  120. package/dist/agentic-security.mjs.sha256 +1 -1
  121. package/package.json +31 -6
  122. package/src/context-intelligence/candidates.js +2 -1
  123. package/src/context-intelligence/capabilities.js +2 -1
  124. package/src/context-intelligence/cli.js +2 -0
  125. package/src/context-intelligence/config.js +3 -1
  126. package/src/context-intelligence/controls.js +49 -1
  127. package/src/context-intelligence/counterexample.js +200 -0
  128. package/src/context-intelligence/cross-route.js +111 -0
  129. package/src/context-intelligence/findings.js +166 -0
  130. package/src/context-intelligence/invariants.js +197 -0
  131. package/src/context-intelligence/queue.js +6 -1
  132. package/src/context-intelligence/reachability.js +2 -2
  133. package/src/context-intelligence/review.js +68 -4
  134. package/src/dataflow/access-paths.js +11 -0
  135. package/src/dataflow/analysis-limits.js +66 -0
  136. package/src/dataflow/engine.js +282 -24
  137. package/src/dataflow/service-edges.js +174 -0
  138. package/src/dataflow/summaries.js +7 -1
  139. package/src/discovery/judge.js +2 -1
  140. package/src/engine.js +82 -14
  141. package/src/fix/apply-fix-service.js +55 -8
  142. package/src/fix/batch-journal.js +84 -0
  143. package/src/fix/exploit-replay.js +51 -0
  144. package/src/fix/footprint.js +65 -0
  145. package/src/fix/patch-policy.js +49 -0
  146. package/src/fix/secret-persistence.js +39 -0
  147. package/src/fix/test-commands.js +84 -0
  148. package/src/fix/verification-adapters.js +97 -0
  149. package/src/fix/verification-record.js +243 -0
  150. package/src/fix/verify-patch.js +89 -0
  151. package/src/ir/CLAUDE.md +5 -0
  152. package/src/ir/callgraph.js +23 -1
  153. package/src/ir/module-resolver.js +315 -0
  154. package/src/ir/parser-js.js +21 -2
  155. package/src/ir/semantic-graph.js +245 -0
  156. package/src/language/haskell-findings.js +2 -0
  157. package/src/language/haskell-guards.js +1 -1
  158. package/src/language/haskell-ir.js +3 -1
  159. package/src/language/haskell-models.js +94 -0
  160. package/src/language/haskell-security-rules.js +20 -0
  161. package/src/language/nixos-hardening.js +72 -0
  162. package/src/lineage/build-attested-correlation.js +63 -0
  163. package/src/lineage/deployment-identity.js +76 -0
  164. package/src/mcp/tools.js +13 -34
  165. package/src/pipeline/canonical-output.js +64 -0
  166. package/src/pipeline/detector-runner.js +7 -0
  167. package/src/pipeline/scan-health.js +14 -0
  168. package/src/pipeline/supervised-analyzers.js +125 -0
  169. package/src/pipeline/supervised-child.js +17 -0
  170. package/src/pipeline/telemetry.js +79 -0
  171. package/src/posture/accuracy-scorecard.js +98 -9
  172. package/src/posture/artifact-registry.js +5 -0
  173. package/src/posture/assurance/evidence-registry.js +215 -0
  174. package/src/posture/assurance/release-package-verify.js +135 -0
  175. package/src/posture/assurance/release-package.js +118 -0
  176. package/src/posture/assurance/release-verdict.js +94 -0
  177. package/src/posture/assurance/waiver.js +200 -0
  178. package/src/posture/compliance-truth.js +100 -0
  179. package/src/posture/evaluation/scan-child.js +3 -1
  180. package/src/posture/evaluation/why-missed.js +3 -1
  181. package/src/posture/exploitability-evidence.js +141 -0
  182. package/src/posture/fix-verify.js +4 -2
  183. package/src/posture/fleet/exposure-ranking.js +115 -0
  184. package/src/posture/fleet/service-chain-graph.js +150 -0
  185. package/src/posture/graph-reconciliation.js +154 -0
  186. package/src/posture/provenance/coverage.js +103 -0
  187. package/src/posture/provenance/git-evidence.js +84 -0
  188. package/src/posture/provenance/origin-resolver.js +7 -1
  189. package/src/posture/provenance/predicate-replay.js +14 -4
  190. package/src/posture/runtime-correlation.js +61 -15
  191. package/src/posture/runtime-explanation.js +116 -0
  192. package/src/posture/runtime-trace-ingest.js +194 -0
  193. package/src/posture/scan-checkpoint.js +38 -10
  194. package/src/posture/waf-ingest.js +7 -2
  195. package/src/report/index.js +4 -0
  196. package/src/report/oscal.js +38 -0
  197. package/src/report/perspectives.js +150 -0
  198. package/src/sast/_comment-strip.js +8 -1
  199. package/src/sast/ruby.js +26 -0
  200. package/src/sast/zip-slip.js +79 -0
  201. package/src/util/string-memo.js +38 -0
@@ -0,0 +1,191 @@
1
+ export const id = 8126;
2
+ export const ids = [8126];
3
+ export const modules = {
4
+
5
+ /***/ 18126:
6
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
7
+
8
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
9
+ /* harmony export */ createCascadePool: () => (/* binding */ createCascadePool)
10
+ /* harmony export */ });
11
+ /* unused harmony export DEFAULT_GRACE_MS */
12
+ /* harmony import */ var node_worker_threads__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(75919);
13
+ /* harmony import */ var node_path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(76760);
14
+ /* harmony import */ var node_url__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(73136);
15
+ // FR-202 phase 3b (D-0050): a pool of long-lived workers, each running engine.js's
16
+ // _runFileCascade for many files over its lifetime, instead of the one-shot-per-call
17
+ // model runWithDeadline/analyzer-supervisor.js uses (which is correct for FR-202's
18
+ // primitive-level proof but would force whole-project setup — _buildProjectIndex,
19
+ // _buildGlobalJavaTaintedMethodIndex, _loadCustomRules — to redo per FILE, an O(n^2)
20
+ // cost across a scan). Each worker performs that setup ONCE at creation via
21
+ // _initCascadeWorkerState, then answers task messages over its lifetime.
22
+ //
23
+ // A task that exceeds its deadline+grace gets its OWN worker terminated (genuinely
24
+ // preemptive, mirroring analyzer-supervisor.js's worker.terminate() precedent) and a
25
+ // fresh replacement worker is spawned to keep the pool at full size for later files —
26
+ // one hung file costs one worker restart, not the whole scan.
27
+
28
+
29
+
30
+
31
+ // `new Worker()` needs a REAL file on disk -- once ncc bundles this module's code
32
+ // into a dist/ chunk, `import.meta.url` resolves to that chunk's location (dist/),
33
+ // not to src/pipeline/, so a naive path.join(HERE, 'cascade-worker.js') would look
34
+ // for a file that was never copied there. src/ always ships as a sibling of dist/
35
+ // (see package.json's "files"), in both a dev checkout and the published npm
36
+ // package, so fall back to the real, unbundled worker script in that case.
37
+ function _resolveDefaultWorkerScript() {
38
+ const hereDir = node_path__WEBPACK_IMPORTED_MODULE_1__.dirname((0,node_url__WEBPACK_IMPORTED_MODULE_2__.fileURLToPath)(import.meta.url));
39
+ if (node_path__WEBPACK_IMPORTED_MODULE_1__.basename(hereDir) === 'pipeline') return node_path__WEBPACK_IMPORTED_MODULE_1__.join(hereDir, 'cascade-worker.js');
40
+ return node_path__WEBPACK_IMPORTED_MODULE_1__.join(hereDir, '..', 'src', 'pipeline', 'cascade-worker.js');
41
+ }
42
+ const DEFAULT_WORKER_SCRIPT = _resolveDefaultWorkerScript();
43
+ const DEFAULT_GRACE_MS = 500;
44
+
45
+ function spawnReadyWorker({ workerScript, modulePath, fileContents, scanRoot }) {
46
+ return new Promise((resolve, reject) => {
47
+ let settled = false;
48
+ const worker = new node_worker_threads__WEBPACK_IMPORTED_MODULE_0__.Worker(workerScript, { workerData: { modulePath, fileContents, scanRoot } });
49
+ const finish = (fn, value) => {
50
+ if (settled) return;
51
+ settled = true;
52
+ worker.off('message', onMessage);
53
+ worker.off('error', onError);
54
+ fn(value);
55
+ };
56
+ const onMessage = (msg) => {
57
+ if (!msg) return;
58
+ if (msg.type === 'ready') finish(resolve, worker);
59
+ else if (msg.type === 'init-error') { worker.terminate().catch(() => {}); finish(reject, new Error(msg.error)); }
60
+ };
61
+ const onError = (err) => { worker.terminate().catch(() => {}); finish(reject, err); };
62
+ worker.on('message', onMessage);
63
+ worker.on('error', onError);
64
+ });
65
+ }
66
+
67
+ /**
68
+ * @param {object} opts
69
+ * @param {Record<string,string>} opts.fileContents - broadcast once to every worker at creation.
70
+ * @param {string|null} opts.scanRoot
71
+ * @param {number} [opts.poolSize=4]
72
+ * @param {string} opts.modulePath - absolute path to the engine.js each worker imports.
73
+ * @param {string} [opts.workerScript] - defaults to cascade-worker.js next to this file.
74
+ * @param {number} [opts.graceMs]
75
+ */
76
+ function createCascadePool(opts = {}) {
77
+ const {
78
+ fileContents = {},
79
+ scanRoot = null,
80
+ poolSize = 4,
81
+ workerScript = DEFAULT_WORKER_SCRIPT,
82
+ modulePath,
83
+ graceMs = DEFAULT_GRACE_MS,
84
+ } = opts;
85
+ if (!modulePath) throw new Error('createCascadePool requires opts.modulePath');
86
+ if (!(Number.isInteger(poolSize) && poolSize > 0)) throw new Error('createCascadePool requires opts.poolSize to be a positive integer');
87
+
88
+ const idle = [];
89
+ const pendingIdle = [];
90
+ const allWorkers = new Set();
91
+ let nextTaskId = 1;
92
+ let closed = false;
93
+ let spawnFailureCount = 0;
94
+ let lastSpawnError = null;
95
+
96
+ function spawnAndRegister() {
97
+ return spawnReadyWorker({ workerScript, modulePath, fileContents, scanRoot }).then((w) => {
98
+ allWorkers.add(w);
99
+ return w;
100
+ });
101
+ }
102
+
103
+ // Background respawn after a killed worker (see runFile's timeout branch)
104
+ // is deliberately fire-and-forget -- the timed-out task has already
105
+ // resolved and nothing is waiting on this promise -- but a swallowed
106
+ // failure here would otherwise shrink the pool invisibly (e.g. thread
107
+ // exhaustion making every future respawn fail silently forever). Track
108
+ // it instead of a bare `.catch(() => {})`.
109
+ function respawnInBackground() {
110
+ spawnAndRegister().then(releaseWorker).catch((err) => {
111
+ spawnFailureCount += 1;
112
+ lastSpawnError = err;
113
+ });
114
+ }
115
+
116
+ function releaseWorker(w) {
117
+ if (closed) { allWorkers.delete(w); w.terminate().catch(() => {}); return; }
118
+ if (pendingIdle.length) pendingIdle.shift()(w);
119
+ else idle.push(w);
120
+ }
121
+
122
+ function acquireWorker() {
123
+ if (idle.length) return Promise.resolve(idle.pop());
124
+ return new Promise((resolve) => pendingIdle.push(resolve));
125
+ }
126
+
127
+ const ready = Promise.all(
128
+ Array.from({ length: poolSize }, () => spawnAndRegister().then(releaseWorker))
129
+ );
130
+
131
+ /**
132
+ * Run one file's cascade on a pooled worker. Resolves with
133
+ * {ok:true, result} | {ok:false, error} | {ok:false, timedOut:true, timeoutMs, graceMs}.
134
+ * Never rejects.
135
+ */
136
+ async function runFile(p, c, taskScanRoot, detectorErrors, taskOpts = {}) {
137
+ await ready;
138
+ if (closed) return { ok: false, error: 'pool is closed' };
139
+ const timeoutMs = taskOpts.timeoutMs;
140
+ const worker = await acquireWorker();
141
+ const id = nextTaskId++;
142
+ return new Promise((resolve) => {
143
+ let settled = false;
144
+ let killTimer = null;
145
+ const onMessage = (msg) => {
146
+ if (settled || !msg || msg.id !== id) return;
147
+ settled = true;
148
+ if (killTimer) clearTimeout(killTimer);
149
+ worker.off('message', onMessage);
150
+ releaseWorker(worker);
151
+ resolve(msg.ok ? { ok: true, result: msg.result } : { ok: false, error: msg.error });
152
+ };
153
+ worker.on('message', onMessage);
154
+ if (Number.isFinite(timeoutMs) && timeoutMs > 0) {
155
+ killTimer = setTimeout(() => {
156
+ if (settled) return;
157
+ settled = true;
158
+ worker.off('message', onMessage);
159
+ allWorkers.delete(worker);
160
+ worker.terminate().catch(() => {});
161
+ if (!closed) respawnInBackground();
162
+ resolve({ ok: false, timedOut: true, timeoutMs, graceMs });
163
+ }, timeoutMs + graceMs);
164
+ killTimer.unref?.();
165
+ }
166
+ worker.postMessage({ type: 'task', id, p, c, scanRoot: taskScanRoot, detectorErrors });
167
+ });
168
+ }
169
+
170
+ async function shutdown() {
171
+ closed = true;
172
+ await ready.catch(() => {});
173
+ for (const w of allWorkers) await w.terminate().catch(() => {});
174
+ allWorkers.clear();
175
+ idle.length = 0;
176
+ }
177
+
178
+ return {
179
+ runFile,
180
+ shutdown,
181
+ ready,
182
+ DEFAULT_GRACE_MS: graceMs,
183
+ getSpawnFailureCount: () => spawnFailureCount,
184
+ getLastSpawnError: () => lastSpawnError,
185
+ };
186
+ }
187
+
188
+
189
+ /***/ })
190
+
191
+ };
@@ -0,0 +1,78 @@
1
+ export const id = 8178;
2
+ export const ids = [8178];
3
+ export const modules = {
4
+
5
+ /***/ 48178:
6
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
7
+
8
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
9
+ /* harmony export */ exportFlowsCSV: () => (/* binding */ exportFlowsCSV)
10
+ /* harmony export */ });
11
+ /* harmony import */ var _protection_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(59114);
12
+ // export-csv.js — Milestone 4, sub-project JSON/CSV export.
13
+ //
14
+ // One row per FLOW (not node, not edge — the closest analogue in this
15
+ // domain to report/index.js's own toCSV's "one row per finding", per this
16
+ // sub-project's own scoping doc decision 3). Node/edge CSV exports are
17
+ // deferred, named explicitly in that doc, not attempted here.
18
+
19
+
20
+
21
+ // Same escaping convention as report/index.js's own toCSV — quote only
22
+ // when a comma/quote/newline is present, double embedded quotes.
23
+ function esc(v) {
24
+ if (v == null) return '';
25
+ const s = String(v);
26
+ return /[",\n]/.test(s) ? '"' + s.replace(/"/g, '""') + '"' : s;
27
+ }
28
+
29
+ // Join character for a flow's multiple `dataClasses` values in one CSV
30
+ // cell: `;`, not `,`. Chosen (this module's own decision, not prescribed
31
+ // by the plan) because `,` is CSV's own delimiter — joining multiple
32
+ // classes with it would put a raw delimiter inside a single logical cell
33
+ // value, forcing outer quoting for the ordinary multi-class case (e.g. a
34
+ // field classified both PCI and PII). `;` never collides with the CSV
35
+ // grammar, so the common case ("PCI;PII") never needs quoting at all.
36
+ // `esc()` still quotes correctly if a comma ends up in cell content for
37
+ // any other reason (see export-csv.test.js's own escaping test) — this
38
+ // choice only avoids manufacturing that case in the common path.
39
+ const DATA_CLASSES_JOIN = ';';
40
+
41
+ function _dataClassesForFlow(flow, dataElementsById) {
42
+ const classes = new Set();
43
+ for (const deId of flow.dataElementIds ?? []) {
44
+ const de = dataElementsById.get(deId);
45
+ for (const c of de?.dataClasses ?? []) classes.add(c);
46
+ }
47
+ return [...classes].sort();
48
+ }
49
+
50
+ function _dimensionVerdict(flow, edgesById, dimension) {
51
+ const verdicts = (flow.edgeIds ?? [])
52
+ .map((id) => edgesById.get(id)?.protection?.[dimension]?.verdict)
53
+ .filter(Boolean);
54
+ return (0,_protection_js__WEBPACK_IMPORTED_MODULE_0__/* .aggregateVerdicts */ .SX)(verdicts);
55
+ }
56
+
57
+ function exportFlowsCSV(graph) {
58
+ const dataElementsById = new Map((graph.dataElements ?? []).map((d) => [d.id, d]));
59
+ const edgesById = new Map((graph.edges ?? []).map((e) => [e.id, e]));
60
+ const header = ['id', 'source', 'sink', 'dataClasses', 'transitVerdict', 'atRestVerdict', 'handlingVerdict', 'policyVerdict', 'coverageStatus'];
61
+ const rows = [header.join(',')];
62
+ for (const flow of graph.flows ?? []) {
63
+ rows.push([
64
+ esc(flow.id), esc(flow.source), esc(flow.sink),
65
+ esc(_dataClassesForFlow(flow, dataElementsById).join(DATA_CLASSES_JOIN)),
66
+ esc(_dimensionVerdict(flow, edgesById, 'transit')),
67
+ esc(_dimensionVerdict(flow, edgesById, 'atRest')),
68
+ esc(_dimensionVerdict(flow, edgesById, 'handling')),
69
+ esc(flow.policyVerdict), esc(flow.coverageStatus),
70
+ ].join(','));
71
+ }
72
+ return rows.join('\n');
73
+ }
74
+
75
+
76
+ /***/ })
77
+
78
+ };
package/dist/818.index.js CHANGED
@@ -88,6 +88,218 @@ function formatFixProof(r) {
88
88
  }
89
89
 
90
90
 
91
+ /***/ }),
92
+
93
+ /***/ 3740:
94
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
95
+
96
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
97
+ /* harmony export */ kO: () => (/* binding */ proveFinding)
98
+ /* harmony export */ });
99
+ /* unused harmony exports independentVerify, applySeverityPolicy, _newRunId */
100
+ /* harmony import */ var node_crypto__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(77598);
101
+ /* harmony import */ var _states_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(12090);
102
+ /* harmony import */ var _runner_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2998);
103
+ /* harmony import */ var _reproducer_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(37055);
104
+ /* harmony import */ var _proof_tier_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(40216);
105
+ // Proof orchestration: finding + revision + reproducer + policy -> structured evidence.
106
+ //
107
+ // Rules that make this safe to trust:
108
+ // * The model may propose a reproducer and select an oracle. The oracle (oracles.js) judges. Never a model.
109
+ // * An attempt that did not complete (timeout, build failure, blocked, unsupported, error) is NOT a negative and NOT a
110
+ // positive: it is degraded evidence, it never advances the state, and it makes the result INCOMPLETE.
111
+ // * EXPLOIT_CONFIRMED needs `required` successes in `attempts` completed attempts AND a pass from an independent
112
+ // verifier that receives only {revision, reproducer, findingId, oracle} in a fresh environment.
113
+ // * "Not reproduced" is reported as such; it is never reported as safe.
114
+
115
+
116
+
117
+
118
+
119
+
120
+ const PROOF_POLICY_DEFAULTS = Object.freeze({ attempts: 3, required: 3, independentReplay: true, timeoutMs: 20_000, cpus: 1, memoryMb: 512, network: 'none', requireContainer: false });
121
+ const RESULT_SCHEMA = 'agentic-security/proof-result';
122
+
123
+ function normalizePolicy(p = {}) {
124
+ const x = { ...PROOF_POLICY_DEFAULTS, ...p };
125
+ x.attempts = Math.max(1, Math.min(10, Math.trunc(Number(x.attempts)) || PROOF_POLICY_DEFAULTS.attempts));
126
+ x.required = Math.max(1, Math.min(x.attempts, Math.trunc(Number(x.required)) || x.attempts));
127
+ x.timeoutMs = Math.max(1000, Math.min(120_000, Number(x.timeoutMs) || PROOF_POLICY_DEFAULTS.timeoutMs));
128
+ return x;
129
+ }
130
+
131
+ const summarize = (a) => ({ status: a.status, fired: a.oracle?.fired === true, inconclusive: a.oracle?.inconclusive === true, reason: a.oracle?.reason ?? a.reasons?.[0] ?? null, durationMs: a.durationMs, degraded: a.degraded });
132
+
133
+ /**
134
+ * Independent verifier. Takes a verifierView ONLY; any extra property (a model's reasoning, prior results) is rejected so
135
+ * the isolation of its inputs is checkable rather than a convention.
136
+ */
137
+ async function independentVerify(view, opts = {}) {
138
+ const allowed = new Set(['revision', 'reproducer', 'findingId', 'oracle']);
139
+ const extra = Object.keys(view || {}).filter((k) => !allowed.has(k));
140
+ if (extra.length) return { status: 'rejected', reason: `verifier input must be exactly revision, reproducer, findingId, oracle; got extra: ${extra.join(', ')}` };
141
+ const attempt = await (opts.attemptFn ?? _runner_js__WEBPACK_IMPORTED_MODULE_2__/* .runAttempt */ .Tm)(structuredClone(view.reproducer), { ...opts, preferContainer: opts.preferContainer });
142
+ return { status: attempt.status === 'completed' ? (attempt.oracle?.fired ? 'confirmed' : 'not-reproduced') : 'incomplete', attempt: summarize(attempt), environment: attempt.environment ?? null };
143
+ }
144
+
145
+ /**
146
+ * @param {object} a
147
+ * @param {object} a.finding the finding (id/stableId, severity, proofTier ...)
148
+ * @param {string} [a.revision] commit the proof applies to
149
+ * @param {object} a.reproducer serialized reproducer
150
+ * @param {object} [a.policy]
151
+ * @param {object} [a.deps] test seams: { attemptFn }
152
+ */
153
+ async function proveFinding({ finding, revision = null, reproducer, policy = {}, signal, deps = {}, sourceState = null, sourceRoot = null, overlay = null } = {}) {
154
+ const started = Date.now();
155
+ const pol = normalizePolicy(policy);
156
+ const attemptFn = deps.attemptFn ?? _runner_js__WEBPACK_IMPORTED_MODULE_2__/* .runAttempt */ .Tm;
157
+ const findingId = finding?.stableId ?? finding?.id ?? reproducer?.findingId ?? 'unknown';
158
+ const degradation = [];
159
+ let state = sourceState ?? (0,_states_js__WEBPACK_IMPORTED_MODULE_1__/* .fromProofTier */ .jn)((0,_proof_tier_js__WEBPACK_IMPORTED_MODULE_4__/* .proofTierOf */ .gx)(finding || {}));
160
+ if (state === 'REPRODUCED') state = 'STATICALLY_CORROBORATED'; // an old single-run marker proof must be re-earned here
161
+ const startState = state;
162
+
163
+ const result = (extra) => ({
164
+ schema: RESULT_SCHEMA, version: 1, findingId, revision, startState, state, staticCorroboration: (0,_states_js__WEBPACK_IMPORTED_MODULE_1__/* .stateRank */ .g3)(startState) >= 1, tier: (0,_states_js__WEBPACK_IMPORTED_MODULE_1__/* .toProofTier */ .KF)(state),
165
+ oracle: reproducer?.oracle?.type ?? null, policy: pol,
166
+ reproducerDigest: reproducer ? safeDigest(reproducer) : null,
167
+ degradation, timing: { proofMs: Date.now() - started }, ...extra,
168
+ });
169
+
170
+ const errs = reproducer ? (0,_reproducer_js__WEBPACK_IMPORTED_MODULE_3__/* .validateReproducer */ .mC)(reproducer) : ['no reproducer supplied'];
171
+ if (errs.length) { degradation.push('invalid-reproducer'); return result({ completeness: 'INCOMPLETE', outcome: 'invalid-reproducer', reasons: errs, attempts: { required: pol.required, run: 0, successes: 0, incomplete: 0 }, independentReplay: { status: 'not-run' } }); }
172
+
173
+ // A valid reproducer is itself the REPRODUCER_GENERATED rung. Static corroboration is recorded, not required: an exploit
174
+ // that reproduces under an independent oracle is deterministic corroboration in its own right, and a pattern-only finding
175
+ // must not be unable to earn proof merely because the taint engine never saw it. The record says which it was.
176
+ const staticCorroboration = (0,_states_js__WEBPACK_IMPORTED_MODULE_1__/* .stateRank */ .g3)(startState) >= (0,_states_js__WEBPACK_IMPORTED_MODULE_1__/* .stateRank */ .g3)('STATICALLY_CORROBORATED');
177
+ if (!staticCorroboration) degradation.push('no-static-corroboration');
178
+ state = 'REPRODUCER_GENERATED';
179
+
180
+ const attempts = [];
181
+ for (let i = 0; i < pol.attempts; i++) {
182
+ if (signal?.aborted) { degradation.push('cancelled'); break; }
183
+ const a = await attemptFn(structuredClone(reproducer), { limits: { timeoutMs: pol.timeoutMs }, signal, requireContainer: pol.requireContainer, preferContainer: pol.preferContainer, force: pol.force, sourceRoot, overlay });
184
+ attempts.push(a);
185
+ // Stop early once the threshold can no longer be met only if every attempt is a decisive negative; incomplete runs continue.
186
+ }
187
+ const completed = attempts.filter((a) => a.status === 'completed' && !a.oracle?.inconclusive);
188
+ const successes = completed.filter((a) => a.oracle?.fired).length;
189
+ const incomplete = attempts.length - completed.length;
190
+ for (const a of attempts) for (const d of a.degraded || []) if (!degradation.includes(d)) degradation.push(d);
191
+ if (incomplete) degradation.push(`incomplete-attempts:${incomplete}`);
192
+ const env = attempts.find((a) => a.environment)?.environment ?? null;
193
+ const base = {
194
+ environment: env && { mode: env.mode, assurance: env.assurance, backend: env.backend ?? null, note: env.note ?? null },
195
+ build: attempts.some((a) => a.status === 'build-failed') ? 'failed' : attempts.length ? 'ok' : 'not-run',
196
+ attempts: { required: pol.required, run: attempts.length, successes, incomplete, detail: attempts.map(summarize) },
197
+ artifactHashes: { reproducer: safeDigest(reproducer), observations: (0,_reproducer_js__WEBPACK_IMPORTED_MODULE_3__/* .sha256 */ .sc)((0,_reproducer_js__WEBPACK_IMPORTED_MODULE_3__/* .canonicalize */ .dw)(attempts.map((a) => a.observation ?? null))) },
198
+ };
199
+
200
+ if (successes > 0) {
201
+ const r = (0,_states_js__WEBPACK_IMPORTED_MODULE_1__/* .advance */ .np)(state, 'REPRODUCED'); if (r.ok) state = r.state;
202
+ }
203
+ if (!attempts.length) return result({ ...base, completeness: 'INCOMPLETE', outcome: 'not-run', independentReplay: { status: 'not-run' } });
204
+ if (successes === 0) {
205
+ const decisive = completed.length === attempts.length;
206
+ return result({ ...base, completeness: decisive ? 'FULL' : 'INCOMPLETE', outcome: decisive ? 'not-reproduced' : 'inconclusive', note: 'not reproduced is not proof of safety', independentReplay: { status: 'not-run' } });
207
+ }
208
+ if (successes < pol.required || incomplete) {
209
+ return result({ ...base, completeness: incomplete ? 'INCOMPLETE' : 'DEGRADED', outcome: 'reproduced-below-threshold', independentReplay: { status: 'not-run' } });
210
+ }
211
+
212
+ let independent = { status: 'skipped' };
213
+ if (pol.independentReplay) {
214
+ independent = await independentVerify((0,_reproducer_js__WEBPACK_IMPORTED_MODULE_3__/* .verifierView */ .IW)({ revision, reproducer, findingId, oracle: reproducer.oracle }), { attemptFn, limits: { timeoutMs: pol.timeoutMs }, signal, requireContainer: pol.requireContainer, force: pol.force, sourceRoot, overlay });
215
+ if (independent.status !== 'confirmed') degradation.push(`independent-replay:${independent.status}`);
216
+ } else degradation.push('independent-replay-disabled');
217
+ if (independent.status === 'confirmed') {
218
+ const r = (0,_states_js__WEBPACK_IMPORTED_MODULE_1__/* .advance */ .np)(state, 'EXPLOIT_CONFIRMED'); if (r.ok) state = r.state;
219
+ }
220
+ const full = state === 'EXPLOIT_CONFIRMED' && base.environment?.assurance !== 'none';
221
+ return result({ ...base, independentReplay: independent, completeness: full ? (base.environment.assurance === 'lower' ? 'DEGRADED' : 'FULL') : 'INCOMPLETE', outcome: full ? 'exploit-confirmed' : 'reproduced-unverified' });
222
+ }
223
+
224
+ const safeDigest = (r) => { try { return (0,_reproducer_js__WEBPACK_IMPORTED_MODULE_3__/* .reproducerDigest */ .we)(r); } catch { return null; } };
225
+
226
+ /** Severity policy: optional, never on by default. Returns the finding unchanged unless the policy asks to demote. */
227
+ function applySeverityPolicy(finding, evidenceState, policy) {
228
+ const req = policy?.criticalRequires;
229
+ if (!Array.isArray(req) || !req.length || finding?.severity !== 'critical') return finding;
230
+ const ok = req.some((s) => stateRankOf(evidenceState ?? 'CANDIDATE') >= stateRankOf(s));
231
+ return ok ? finding : { ...finding, severity: 'high', severityPolicy: { demotedFrom: 'critical', reason: `critical requires ${req.join(' or ')}; evidence state is ${evidenceState ?? 'CANDIDATE'}` } };
232
+ }
233
+ const _newRunId = () => randomBytes(6).toString('hex');
234
+
235
+
236
+ /***/ }),
237
+
238
+ /***/ 12090:
239
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
240
+
241
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
242
+ /* harmony export */ KF: () => (/* binding */ toProofTier),
243
+ /* harmony export */ g3: () => (/* binding */ stateRank),
244
+ /* harmony export */ jn: () => (/* binding */ fromProofTier),
245
+ /* harmony export */ np: () => (/* binding */ advance)
246
+ /* harmony export */ });
247
+ /* unused harmony exports EVIDENCE_STATES, COMPLETENESS */
248
+ // Evidence state ladder for the Universal Exploit Proof Fabric.
249
+ //
250
+ // Evidence state is SEPARATE from severity and confidence. It extends, never replaces, the vocabulary that already
251
+ // exists: `proof-tier.js` (execution-proven / proof-failed / taint-proven / unproven) and the fix-verify legs
252
+ // (`verifiedFull`, `degradedLegs`). `toProofTier` / `fromProofTier` are the explicit bridges.
253
+ //
254
+ // Transitions are guarded: a state can only be reached from the state directly before it (or by dropping back), so no
255
+ // caller can jump a finding to EXPLOIT_CONFIRMED without passing REPRODUCED, or to FIX_VERIFIED without
256
+ // FIX_REPLAY_BLOCKED. A degraded or incomplete run NEVER advances a state.
257
+ const EVIDENCE_STATES = Object.freeze([
258
+ 'CANDIDATE',
259
+ 'STATICALLY_CORROBORATED',
260
+ 'REPRODUCER_GENERATED',
261
+ 'REPRODUCED',
262
+ 'EXPLOIT_CONFIRMED',
263
+ 'FIX_REPLAY_BLOCKED',
264
+ 'FIX_VERIFIED',
265
+ ]);
266
+
267
+ const stateRank = (s) => EVIDENCE_STATES.indexOf(s);
268
+
269
+ const REQUIRES_PREDECESSOR = Object.freeze(Object.fromEntries(EVIDENCE_STATES.map((s, i) => [s, i === 0 ? null : EVIDENCE_STATES[i - 1]])));
270
+
271
+ /**
272
+ * Advance `from` to `to`. Returns { ok, state, reason }. Moving up requires `to` to be exactly the next rung; moving
273
+ * down or staying is always allowed (evidence can be lost, never invented). Unknown states are rejected.
274
+ */
275
+ function advance(from, to) {
276
+ if (!EVIDENCE_STATES.includes(from)) return { ok: false, state: 'CANDIDATE', reason: `unknown current state: ${String(from)}` };
277
+ if (!EVIDENCE_STATES.includes(to)) return { ok: false, state: from, reason: `unknown target state: ${String(to)}` };
278
+ if (stateRank(to) <= stateRank(from)) return { ok: true, state: to, reason: null };
279
+ if (REQUIRES_PREDECESSOR[to] !== from) return { ok: false, state: from, reason: `cannot reach ${to} from ${from}: ${REQUIRES_PREDECESSOR[to]} is required first` };
280
+ return { ok: true, state: to, reason: null };
281
+ }
282
+
283
+ // Bridges to the older vocabulary so existing consumers keep working.
284
+ function toProofTier(state) {
285
+ const r = stateRank(state);
286
+ if (r >= stateRank('EXPLOIT_CONFIRMED')) return 'execution-proven';
287
+ if (r >= stateRank('STATICALLY_CORROBORATED')) return 'taint-proven';
288
+ return 'unproven';
289
+ }
290
+
291
+ function fromProofTier(tier) {
292
+ if (tier === 'taint-proven') return 'STATICALLY_CORROBORATED';
293
+ // execution-proven under the older single-run marker path is one run, not the 3/3 + independent replay the fabric
294
+ // requires, so it maps to REPRODUCED and never to EXPLOIT_CONFIRMED.
295
+ if (tier === 'execution-proven') return 'REPRODUCED';
296
+ return 'CANDIDATE';
297
+ }
298
+
299
+ // Completeness vocabulary shared with fix-verify: FULL only when nothing was skipped.
300
+ const COMPLETENESS = Object.freeze(['FULL', 'DEGRADED', 'INCOMPLETE']);
301
+
302
+
91
303
  /***/ })
92
304
 
93
305
  };
@@ -0,0 +1,93 @@
1
+ export const id = 8382;
2
+ export const ids = [8382];
3
+ export const modules = {
4
+
5
+ /***/ 78382:
6
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
7
+
8
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
9
+ /* harmony export */ qc: () => (/* binding */ IMPACT_VERSION),
10
+ /* harmony export */ validateImpactAssessment: () => (/* binding */ validateImpactAssessment)
11
+ /* harmony export */ });
12
+ /* unused harmony exports IMPACT_TARGET_KINDS, IMPACT_SCOPE_VALUES, IMPACT_TRACE_KINDS */
13
+ // impact-assessment.js — M5 deliverable #4 (FR-507 §10.10): the
14
+ // ImpactAssessment extension contract — the result of asking "what is
15
+ // reachable from this compromised node/edge/flow/data element, per the
16
+ // graph's own already-scanned evidence." NOT a DataFlowGraph v1 entity,
17
+ // mirrors recipient-profile.js's/scenario.js's own contract shape
18
+ // exactly (structural-only {valid, errors} validator, zero graph
19
+ // access at construction time).
20
+ //
21
+ // See docs/superpowers/plans/2026-09-02-data-flow-explorer-m5-blast-radius-impact-scoping.md
22
+ // for the full design reasoning, including why there is no
23
+ // affectedObligationIds field (ObligationMapping records are built on
24
+ // demand per compliance framework, not stored on the graph) and why
25
+ // `scope` is always 'possible' today (no runtime-corroboration layer
26
+ // exists yet).
27
+
28
+ const IMPACT_VERSION = '1.0.0';
29
+
30
+ const IMPACT_TARGET_KINDS = Object.freeze(['node', 'edge', 'flow', 'dataElement']);
31
+
32
+ // 'possible' is the only value any producer emits today — 'observed'
33
+ // is reserved for a future Digital Twin (M5 #7) increment with a real
34
+ // runtime-corroboration signal. Both are valid schema values now so
35
+ // that increment needs no breaking change to this contract later.
36
+ const IMPACT_SCOPE_VALUES = Object.freeze(['possible', 'observed']);
37
+
38
+ // Discloses WHICH of the two genuinely different traversal semantics
39
+ // produced this record (final-review I2 fix) — `scope` alone cannot
40
+ // distinguish them, since both families emit `scope: 'possible'`.
41
+ // 'topology_reachable': a `node` target's topology-wide showAllPaths
42
+ // BFS — "everything this compromised node could push to." 'flow_
43
+ // restricted': an `edge`/`flow`/`dataElement` target's direct trace
44
+ // over the flows that actually carry it — never the topology-wide BFS.
45
+ // Without this field a JSON consumer cannot tell "exact carrier trace"
46
+ // from "topological presumption" apart, the exact silent-conflation
47
+ // this codebase's own disclosure discipline exists to prevent.
48
+ const IMPACT_TRACE_KINDS = Object.freeze(['topology_reachable', 'flow_restricted']);
49
+
50
+ function _isNonEmptyString(v) { return typeof v === 'string' && v.length > 0; }
51
+ function _isStringArray(v) { return Array.isArray(v) && v.every((x) => typeof x === 'string'); }
52
+
53
+ /**
54
+ * Structural validation only — mirrors validateRecipientProfile's/
55
+ * validateScenario's own {valid, errors} shape and "never throws"
56
+ * contract.
57
+ */
58
+ function validateImpactAssessment(record) {
59
+ const errors = [];
60
+ const err = (p, message) => errors.push({ path: p, message });
61
+ if (!record || typeof record !== 'object' || Array.isArray(record)) {
62
+ err('$', 'ImpactAssessment record must be an object');
63
+ return { valid: false, errors };
64
+ }
65
+ if (!_isNonEmptyString(record.id) || !record.id.startsWith('impact:')) {
66
+ err('$.id', 'id is required and must start with "impact:"');
67
+ }
68
+ if (!_isNonEmptyString(record.version)) err('$.version', 'version is required');
69
+ if (!_isNonEmptyString(record.graphId)) err('$.graphId', 'graphId is required');
70
+ if (!_isNonEmptyString(record.graphDigest)) err('$.graphDigest', 'graphDigest is required');
71
+ if (!_isNonEmptyString(record.targetId)) err('$.targetId', 'targetId is required');
72
+ if (!IMPACT_TARGET_KINDS.includes(record.targetKind)) {
73
+ err('$.targetKind', `targetKind must be one of ${IMPACT_TARGET_KINDS.join('|')}`);
74
+ }
75
+ if (!IMPACT_SCOPE_VALUES.includes(record.scope)) {
76
+ err('$.scope', `scope must be one of ${IMPACT_SCOPE_VALUES.join('|')}`);
77
+ }
78
+ if (!IMPACT_TRACE_KINDS.includes(record.traceKind)) {
79
+ err('$.traceKind', `traceKind must be one of ${IMPACT_TRACE_KINDS.join('|')}`);
80
+ }
81
+ if (!_isStringArray(record.affectedNodeIds ?? [])) err('$.affectedNodeIds', 'affectedNodeIds must be an array of strings');
82
+ if (!_isStringArray(record.affectedEdgeIds ?? [])) err('$.affectedEdgeIds', 'affectedEdgeIds must be an array of strings');
83
+ if (!_isStringArray(record.affectedDataClasses ?? [])) err('$.affectedDataClasses', 'affectedDataClasses must be an array of strings');
84
+ if (!_isStringArray(record.affectedRecipientProfileIds ?? [])) err('$.affectedRecipientProfileIds', 'affectedRecipientProfileIds must be an array of strings');
85
+ if (!_isStringArray(record.coverageLimitations ?? [])) err('$.coverageLimitations', 'coverageLimitations must be an array of strings');
86
+ if (!_isNonEmptyString(record.generatedAt)) err('$.generatedAt', 'generatedAt is required');
87
+ return { valid: errors.length === 0, errors };
88
+ }
89
+
90
+
91
+ /***/ })
92
+
93
+ };