@clear-capabilities/agentic-security-scanner 0.172.1 → 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 (194) hide show
  1. package/CHANGELOG.md +15 -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 +28 -3
  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 +272 -20
  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/lineage/build-attested-correlation.js +63 -0
  157. package/src/lineage/deployment-identity.js +76 -0
  158. package/src/mcp/tools.js +13 -34
  159. package/src/pipeline/canonical-output.js +64 -0
  160. package/src/pipeline/detector-runner.js +7 -0
  161. package/src/pipeline/scan-health.js +14 -0
  162. package/src/pipeline/supervised-analyzers.js +125 -0
  163. package/src/pipeline/supervised-child.js +17 -0
  164. package/src/pipeline/telemetry.js +79 -0
  165. package/src/posture/accuracy-scorecard.js +98 -9
  166. package/src/posture/artifact-registry.js +5 -0
  167. package/src/posture/assurance/evidence-registry.js +215 -0
  168. package/src/posture/assurance/release-package-verify.js +135 -0
  169. package/src/posture/assurance/release-package.js +118 -0
  170. package/src/posture/assurance/release-verdict.js +94 -0
  171. package/src/posture/assurance/waiver.js +200 -0
  172. package/src/posture/compliance-truth.js +100 -0
  173. package/src/posture/evaluation/scan-child.js +3 -1
  174. package/src/posture/evaluation/why-missed.js +3 -1
  175. package/src/posture/exploitability-evidence.js +141 -0
  176. package/src/posture/fix-verify.js +4 -2
  177. package/src/posture/fleet/exposure-ranking.js +115 -0
  178. package/src/posture/fleet/service-chain-graph.js +150 -0
  179. package/src/posture/graph-reconciliation.js +154 -0
  180. package/src/posture/provenance/coverage.js +103 -0
  181. package/src/posture/provenance/git-evidence.js +84 -0
  182. package/src/posture/provenance/origin-resolver.js +7 -1
  183. package/src/posture/provenance/predicate-replay.js +14 -4
  184. package/src/posture/runtime-correlation.js +61 -15
  185. package/src/posture/runtime-explanation.js +116 -0
  186. package/src/posture/runtime-trace-ingest.js +194 -0
  187. package/src/posture/scan-checkpoint.js +38 -10
  188. package/src/posture/waf-ingest.js +7 -2
  189. package/src/report/index.js +4 -0
  190. package/src/report/oscal.js +38 -0
  191. package/src/report/perspectives.js +150 -0
  192. package/src/sast/_comment-strip.js +8 -1
  193. package/src/sast/ruby.js +26 -0
  194. package/src/util/string-memo.js +38 -0
@@ -0,0 +1,457 @@
1
+ export const id = 8891;
2
+ export const ids = [8891,5216];
3
+ export const modules = {
4
+
5
+ /***/ 68891:
6
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
7
+
8
+ __webpack_require__.r(__webpack_exports__);
9
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
10
+ /* harmony export */ cmdProof: () => (/* binding */ cmdProof),
11
+ /* harmony export */ cmdProve: () => (/* binding */ cmdProve),
12
+ /* harmony export */ loadReproducerFor: () => (/* binding */ loadReproducerFor)
13
+ /* harmony export */ });
14
+ /* harmony import */ var node_fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(73024);
15
+ /* harmony import */ var node_os__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(48161);
16
+ /* harmony import */ var node_path__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(76760);
17
+ /* harmony import */ var _state_dir_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(69259);
18
+ /* harmony import */ var _orchestrator_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(84817);
19
+ /* harmony import */ var _store_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(25216);
20
+ /* harmony import */ var _runner_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(1595);
21
+ /* harmony import */ var _reproducer_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(82034);
22
+ // CLI surface for the proof fabric: `proof show|replay|doctor`, `triage exploit|validate`. Non-interactive by design: no
23
+ // command reads stdin, every run is bounded by the policy timeouts, and a missing reproducer is a typed exit code, not a
24
+ // prompt. Exit codes: 0 confirmed/ok, 1 not confirmed (any reason), 4 usage/precondition.
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+ function loadFinding(root, id) {
36
+ const p = (0,_state_dir_js__WEBPACK_IMPORTED_MODULE_3__.statePath)(root, 'last-scan.json');
37
+ if (!node_fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(p)) return null;
38
+ const last = JSON.parse(node_fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync(p, 'utf8'));
39
+ return (last.findings || []).find((f) => f.id === id || f.stableId === id) ?? null;
40
+ }
41
+
42
+ function loadReproducerFor(root, id, flagPath) { return loadReproducer(root, id, flagPath); }
43
+
44
+ function loadReproducer(root, id, flagPath) {
45
+ const candidates = [flagPath && node_path__WEBPACK_IMPORTED_MODULE_2__.resolve(String(flagPath)), (0,_state_dir_js__WEBPACK_IMPORTED_MODULE_3__.statePath)(root, 'reproducers', `${(0,_store_js__WEBPACK_IMPORTED_MODULE_5__.findingKey)(id)}.json`)].filter(Boolean);
46
+ for (const c of candidates) {
47
+ try { return { reproducer: JSON.parse(node_fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync(c, 'utf8')), file: c }; } catch { /* next */ }
48
+ }
49
+ return null;
50
+ }
51
+
52
+ function formatResult(r) {
53
+ const env = r.environment ? `${r.environment.mode} (${r.environment.assurance} assurance)` : 'none';
54
+ return [
55
+ `Finding: ${r.findingId}`,
56
+ `Evidence: ${r.state}`,
57
+ `Oracle: ${r.oracle}`,
58
+ `Reproductions: ${r.attempts?.successes ?? 0}/${r.attempts?.run ?? 0} (required ${r.attempts?.required})`,
59
+ `Independent replay: ${r.independentReplay?.status ?? 'not-run'}`,
60
+ `Environment: ${env}`,
61
+ `Completeness: ${r.completeness}`,
62
+ `Duration: ${(r.timing.proofMs / 1000).toFixed(1)}s`,
63
+ ...(r.degradation?.length ? [`Degraded: ${r.degradation.join(', ')}`] : []),
64
+ ...(r.note ? [`Note: ${r.note}`] : []),
65
+ ].join('\n');
66
+ }
67
+
68
+ async function cmdProve(args, root, { json = false } = {}) {
69
+ const id = String(args._[2] ?? '');
70
+ if (!id) { console.error('usage: triage exploit <finding-id> --prove [--reproducer file] [--attempts N] [--required N]'); return 4; }
71
+ const finding = loadFinding(root, id);
72
+ if (!finding) { console.error(`Finding ${id} not found in last scan.`); return 4; }
73
+ const loaded = loadReproducer(root, id, args.flags.reproducer);
74
+ if (!loaded) { console.error(`No reproducer for ${id}. Supply one with --reproducer <file> or place it at .agentic-security/reproducers/. Nothing was executed.`); return 4; }
75
+ const errs = (0,_reproducer_js__WEBPACK_IMPORTED_MODULE_7__/* .validateReproducer */ .mC)(loaded.reproducer);
76
+ if (errs.length) { console.error(`Invalid reproducer: ${errs.join('; ')}`); return 4; }
77
+ const policy = {};
78
+ if (args.flags.attempts) policy.attempts = Number(args.flags.attempts);
79
+ if (args.flags.required) policy.required = Number(args.flags.required);
80
+ if (args.flags.timeout) policy.timeoutMs = Number(args.flags.timeout) * 1000;
81
+ if (args.flags['require-container']) policy.requireContainer = true;
82
+ const ac = new AbortController();
83
+ const onSig = () => ac.abort();
84
+ process.once('SIGINT', onSig);
85
+ let result;
86
+ try { result = await (0,_orchestrator_js__WEBPACK_IMPORTED_MODULE_4__/* .proveFinding */ .kO)({ finding, reproducer: loaded.reproducer, revision: args.flags.revision ?? null, policy, signal: ac.signal }); } finally { process.off('SIGINT', onSig); }
87
+ const saved = (0,_store_js__WEBPACK_IMPORTED_MODULE_5__.saveProof)(root, { ...result, reproducer: loaded.reproducer });
88
+ // Printed output gets the same secret-scrubbing pass as what is persisted (defense in depth: a free-text reason/note
89
+ // field that captured something from stdout/stderr should never reach a terminal unredacted either).
90
+ if (json || args.flags.json) console.log(JSON.stringify((0,_store_js__WEBPACK_IMPORTED_MODULE_5__.scrubDeep)({ ...result, stored: saved.ok ? saved.file : null }), null, 2));
91
+ else { console.log(formatResult(result)); if (!saved.ok) console.log(`(proof not stored: ${saved.reason})`); }
92
+ return result.state === 'EXPLOIT_CONFIRMED' ? 0 : 1;
93
+ }
94
+
95
+ async function cmdProof(args, root) {
96
+ const sub = args._[1];
97
+ if (sub === 'doctor') return doctor(args);
98
+ const id = String(args._[2] ?? '');
99
+ if (!id) { console.error('usage: proof show <finding-id> | proof replay <finding-id> | proof doctor'); return 4; }
100
+ if (sub === 'show') {
101
+ const all = (0,_store_js__WEBPACK_IMPORTED_MODULE_5__.listProofs)(root, id);
102
+ if (!all.length) { console.error(`No stored proof for ${id}.`); return 4; }
103
+ const latest = all.find((p) => p.record);
104
+ if (all.some((p) => p.tampered)) console.error(`WARNING: ${all.filter((p) => p.tampered).length} stored record(s) failed their integrity check and are not trusted.`);
105
+ const good = all.find((p) => p.record && !p.tampered);
106
+ if (!good) { console.error('No intact proof record.'); return 1; }
107
+ if (args.flags.json) console.log(JSON.stringify(good.record, null, 2)); else console.log(formatResult(good.record));
108
+ void latest;
109
+ return 0;
110
+ }
111
+ if (sub === 'replay') {
112
+ const stored = (0,_store_js__WEBPACK_IMPORTED_MODULE_5__.latestProof)(root, id);
113
+ if (!stored?.record?.reproducer) { console.error(`No stored reproducer for ${id}.`); return 4; }
114
+ const tmpDir = node_fs__WEBPACK_IMPORTED_MODULE_0__.mkdtempSync(node_path__WEBPACK_IMPORTED_MODULE_2__.join(node_os__WEBPACK_IMPORTED_MODULE_1__.tmpdir(), 'proof-replay-'));
115
+ const tmp = node_path__WEBPACK_IMPORTED_MODULE_2__.join(tmpDir, 'reproducer.json');
116
+ node_fs__WEBPACK_IMPORTED_MODULE_0__.writeFileSync(tmp, JSON.stringify(stored.record.reproducer));
117
+ args.flags.reproducer = tmp;
118
+ args._ = ['triage', 'exploit', id];
119
+ try { return await cmdProve(args, root); } finally { node_fs__WEBPACK_IMPORTED_MODULE_0__.rmSync(tmpDir, { recursive: true, force: true }); }
120
+ }
121
+ console.error('usage: proof show|replay <finding-id> | proof doctor');
122
+ return 4;
123
+ }
124
+
125
+ function doctor(args) {
126
+ const tools = (0,_runner_js__WEBPACK_IMPORTED_MODULE_6__/* .hostTools */ .qV)();
127
+ const rows = _reproducer_js__WEBPACK_IMPORTED_MODULE_7__/* .LANGUAGES */ .Yj.map((l) => ({ lang: l, ...(0,_runner_js__WEBPACK_IMPORTED_MODULE_6__/* .languageSupport */ .ql)(l, tools) }));
128
+ const envs = ['javascript', 'python'].map((l) => ({ lang: l, ...(0,_runner_js__WEBPACK_IMPORTED_MODULE_6__/* .selectEnvironment */ .aP)({ lang: l }) }));
129
+ if (args.flags.json) { console.log(JSON.stringify({ tools, languages: rows, environments: envs }, null, 2)); return 0; }
130
+ console.log('Proof fabric doctor');
131
+ for (const r of rows) console.log(` ${r.lang.padEnd(11)} ${r.supported ? 'supported' : `unsupported (${r.reason})`}`);
132
+ for (const e of envs) console.log(` environment for ${e.lang}: ${e.mode}, ${e.assurance} assurance${e.reason ? ` (${e.reason})` : ''}${e.containerSkipped ? `; container skipped: ${e.containerSkipped}` : ''}`);
133
+ const usable = envs.some((e) => e.mode !== 'unavailable');
134
+ if (!usable) console.log(' RESULT: no execution environment available; proofs will report blocked, never clean.');
135
+ return usable ? 0 : 1;
136
+ }
137
+
138
+
139
+ /***/ }),
140
+
141
+ /***/ 84817:
142
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
143
+
144
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
145
+ /* harmony export */ kO: () => (/* binding */ proveFinding)
146
+ /* harmony export */ });
147
+ /* unused harmony exports independentVerify, applySeverityPolicy, _newRunId */
148
+ /* harmony import */ var node_crypto__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(77598);
149
+ /* harmony import */ var _states_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(58355);
150
+ /* harmony import */ var _runner_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1595);
151
+ /* harmony import */ var _reproducer_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(82034);
152
+ /* harmony import */ var _proof_tier_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(24555);
153
+ // Proof orchestration: finding + revision + reproducer + policy -> structured evidence.
154
+ //
155
+ // Rules that make this safe to trust:
156
+ // * The model may propose a reproducer and select an oracle. The oracle (oracles.js) judges. Never a model.
157
+ // * An attempt that did not complete (timeout, build failure, blocked, unsupported, error) is NOT a negative and NOT a
158
+ // positive: it is degraded evidence, it never advances the state, and it makes the result INCOMPLETE.
159
+ // * EXPLOIT_CONFIRMED needs `required` successes in `attempts` completed attempts AND a pass from an independent
160
+ // verifier that receives only {revision, reproducer, findingId, oracle} in a fresh environment.
161
+ // * "Not reproduced" is reported as such; it is never reported as safe.
162
+
163
+
164
+
165
+
166
+
167
+
168
+ const PROOF_POLICY_DEFAULTS = Object.freeze({ attempts: 3, required: 3, independentReplay: true, timeoutMs: 20_000, cpus: 1, memoryMb: 512, network: 'none', requireContainer: false });
169
+ const RESULT_SCHEMA = 'agentic-security/proof-result';
170
+
171
+ function normalizePolicy(p = {}) {
172
+ const x = { ...PROOF_POLICY_DEFAULTS, ...p };
173
+ x.attempts = Math.max(1, Math.min(10, Math.trunc(Number(x.attempts)) || PROOF_POLICY_DEFAULTS.attempts));
174
+ x.required = Math.max(1, Math.min(x.attempts, Math.trunc(Number(x.required)) || x.attempts));
175
+ x.timeoutMs = Math.max(1000, Math.min(120_000, Number(x.timeoutMs) || PROOF_POLICY_DEFAULTS.timeoutMs));
176
+ return x;
177
+ }
178
+
179
+ 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 });
180
+
181
+ /**
182
+ * Independent verifier. Takes a verifierView ONLY; any extra property (a model's reasoning, prior results) is rejected so
183
+ * the isolation of its inputs is checkable rather than a convention.
184
+ */
185
+ async function independentVerify(view, opts = {}) {
186
+ const allowed = new Set(['revision', 'reproducer', 'findingId', 'oracle']);
187
+ const extra = Object.keys(view || {}).filter((k) => !allowed.has(k));
188
+ if (extra.length) return { status: 'rejected', reason: `verifier input must be exactly revision, reproducer, findingId, oracle; got extra: ${extra.join(', ')}` };
189
+ const attempt = await (opts.attemptFn ?? _runner_js__WEBPACK_IMPORTED_MODULE_2__/* .runAttempt */ .Tm)(structuredClone(view.reproducer), { ...opts, preferContainer: opts.preferContainer });
190
+ return { status: attempt.status === 'completed' ? (attempt.oracle?.fired ? 'confirmed' : 'not-reproduced') : 'incomplete', attempt: summarize(attempt), environment: attempt.environment ?? null };
191
+ }
192
+
193
+ /**
194
+ * @param {object} a
195
+ * @param {object} a.finding the finding (id/stableId, severity, proofTier ...)
196
+ * @param {string} [a.revision] commit the proof applies to
197
+ * @param {object} a.reproducer serialized reproducer
198
+ * @param {object} [a.policy]
199
+ * @param {object} [a.deps] test seams: { attemptFn }
200
+ */
201
+ async function proveFinding({ finding, revision = null, reproducer, policy = {}, signal, deps = {}, sourceState = null, sourceRoot = null, overlay = null } = {}) {
202
+ const started = Date.now();
203
+ const pol = normalizePolicy(policy);
204
+ const attemptFn = deps.attemptFn ?? _runner_js__WEBPACK_IMPORTED_MODULE_2__/* .runAttempt */ .Tm;
205
+ const findingId = finding?.stableId ?? finding?.id ?? reproducer?.findingId ?? 'unknown';
206
+ const degradation = [];
207
+ let state = sourceState ?? (0,_states_js__WEBPACK_IMPORTED_MODULE_1__/* .fromProofTier */ .jn)((0,_proof_tier_js__WEBPACK_IMPORTED_MODULE_4__/* .proofTierOf */ .gx)(finding || {}));
208
+ if (state === 'REPRODUCED') state = 'STATICALLY_CORROBORATED'; // an old single-run marker proof must be re-earned here
209
+ const startState = state;
210
+
211
+ const result = (extra) => ({
212
+ 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),
213
+ oracle: reproducer?.oracle?.type ?? null, policy: pol,
214
+ reproducerDigest: reproducer ? safeDigest(reproducer) : null,
215
+ degradation, timing: { proofMs: Date.now() - started }, ...extra,
216
+ });
217
+
218
+ const errs = reproducer ? (0,_reproducer_js__WEBPACK_IMPORTED_MODULE_3__/* .validateReproducer */ .mC)(reproducer) : ['no reproducer supplied'];
219
+ 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' } }); }
220
+
221
+ // A valid reproducer is itself the REPRODUCER_GENERATED rung. Static corroboration is recorded, not required: an exploit
222
+ // that reproduces under an independent oracle is deterministic corroboration in its own right, and a pattern-only finding
223
+ // must not be unable to earn proof merely because the taint engine never saw it. The record says which it was.
224
+ const staticCorroboration = (0,_states_js__WEBPACK_IMPORTED_MODULE_1__/* .stateRank */ .g3)(startState) >= (0,_states_js__WEBPACK_IMPORTED_MODULE_1__/* .stateRank */ .g3)('STATICALLY_CORROBORATED');
225
+ if (!staticCorroboration) degradation.push('no-static-corroboration');
226
+ state = 'REPRODUCER_GENERATED';
227
+
228
+ const attempts = [];
229
+ for (let i = 0; i < pol.attempts; i++) {
230
+ if (signal?.aborted) { degradation.push('cancelled'); break; }
231
+ const a = await attemptFn(structuredClone(reproducer), { limits: { timeoutMs: pol.timeoutMs }, signal, requireContainer: pol.requireContainer, preferContainer: pol.preferContainer, force: pol.force, sourceRoot, overlay });
232
+ attempts.push(a);
233
+ // Stop early once the threshold can no longer be met only if every attempt is a decisive negative; incomplete runs continue.
234
+ }
235
+ const completed = attempts.filter((a) => a.status === 'completed' && !a.oracle?.inconclusive);
236
+ const successes = completed.filter((a) => a.oracle?.fired).length;
237
+ const incomplete = attempts.length - completed.length;
238
+ for (const a of attempts) for (const d of a.degraded || []) if (!degradation.includes(d)) degradation.push(d);
239
+ if (incomplete) degradation.push(`incomplete-attempts:${incomplete}`);
240
+ const env = attempts.find((a) => a.environment)?.environment ?? null;
241
+ const base = {
242
+ environment: env && { mode: env.mode, assurance: env.assurance, backend: env.backend ?? null, note: env.note ?? null },
243
+ build: attempts.some((a) => a.status === 'build-failed') ? 'failed' : attempts.length ? 'ok' : 'not-run',
244
+ attempts: { required: pol.required, run: attempts.length, successes, incomplete, detail: attempts.map(summarize) },
245
+ 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))) },
246
+ };
247
+
248
+ if (successes > 0) {
249
+ const r = (0,_states_js__WEBPACK_IMPORTED_MODULE_1__/* .advance */ .np)(state, 'REPRODUCED'); if (r.ok) state = r.state;
250
+ }
251
+ if (!attempts.length) return result({ ...base, completeness: 'INCOMPLETE', outcome: 'not-run', independentReplay: { status: 'not-run' } });
252
+ if (successes === 0) {
253
+ const decisive = completed.length === attempts.length;
254
+ return result({ ...base, completeness: decisive ? 'FULL' : 'INCOMPLETE', outcome: decisive ? 'not-reproduced' : 'inconclusive', note: 'not reproduced is not proof of safety', independentReplay: { status: 'not-run' } });
255
+ }
256
+ if (successes < pol.required || incomplete) {
257
+ return result({ ...base, completeness: incomplete ? 'INCOMPLETE' : 'DEGRADED', outcome: 'reproduced-below-threshold', independentReplay: { status: 'not-run' } });
258
+ }
259
+
260
+ let independent = { status: 'skipped' };
261
+ if (pol.independentReplay) {
262
+ 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 });
263
+ if (independent.status !== 'confirmed') degradation.push(`independent-replay:${independent.status}`);
264
+ } else degradation.push('independent-replay-disabled');
265
+ if (independent.status === 'confirmed') {
266
+ const r = (0,_states_js__WEBPACK_IMPORTED_MODULE_1__/* .advance */ .np)(state, 'EXPLOIT_CONFIRMED'); if (r.ok) state = r.state;
267
+ }
268
+ const full = state === 'EXPLOIT_CONFIRMED' && base.environment?.assurance !== 'none';
269
+ return result({ ...base, independentReplay: independent, completeness: full ? (base.environment.assurance === 'lower' ? 'DEGRADED' : 'FULL') : 'INCOMPLETE', outcome: full ? 'exploit-confirmed' : 'reproduced-unverified' });
270
+ }
271
+
272
+ const safeDigest = (r) => { try { return (0,_reproducer_js__WEBPACK_IMPORTED_MODULE_3__/* .reproducerDigest */ .we)(r); } catch { return null; } };
273
+
274
+ /** Severity policy: optional, never on by default. Returns the finding unchanged unless the policy asks to demote. */
275
+ function applySeverityPolicy(finding, evidenceState, policy) {
276
+ const req = policy?.criticalRequires;
277
+ if (!Array.isArray(req) || !req.length || finding?.severity !== 'critical') return finding;
278
+ const ok = req.some((s) => stateRankOf(evidenceState ?? 'CANDIDATE') >= stateRankOf(s));
279
+ return ok ? finding : { ...finding, severity: 'high', severityPolicy: { demotedFrom: 'critical', reason: `critical requires ${req.join(' or ')}; evidence state is ${evidenceState ?? 'CANDIDATE'}` } };
280
+ }
281
+ const _newRunId = () => randomBytes(6).toString('hex');
282
+
283
+
284
+ /***/ }),
285
+
286
+ /***/ 58355:
287
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
288
+
289
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
290
+ /* harmony export */ KF: () => (/* binding */ toProofTier),
291
+ /* harmony export */ g3: () => (/* binding */ stateRank),
292
+ /* harmony export */ jn: () => (/* binding */ fromProofTier),
293
+ /* harmony export */ np: () => (/* binding */ advance)
294
+ /* harmony export */ });
295
+ /* unused harmony exports EVIDENCE_STATES, COMPLETENESS */
296
+ // Evidence state ladder for the Universal Exploit Proof Fabric.
297
+ //
298
+ // Evidence state is SEPARATE from severity and confidence. It extends, never replaces, the vocabulary that already
299
+ // exists: `proof-tier.js` (execution-proven / proof-failed / taint-proven / unproven) and the fix-verify legs
300
+ // (`verifiedFull`, `degradedLegs`). `toProofTier` / `fromProofTier` are the explicit bridges.
301
+ //
302
+ // Transitions are guarded: a state can only be reached from the state directly before it (or by dropping back), so no
303
+ // caller can jump a finding to EXPLOIT_CONFIRMED without passing REPRODUCED, or to FIX_VERIFIED without
304
+ // FIX_REPLAY_BLOCKED. A degraded or incomplete run NEVER advances a state.
305
+ const EVIDENCE_STATES = Object.freeze([
306
+ 'CANDIDATE',
307
+ 'STATICALLY_CORROBORATED',
308
+ 'REPRODUCER_GENERATED',
309
+ 'REPRODUCED',
310
+ 'EXPLOIT_CONFIRMED',
311
+ 'FIX_REPLAY_BLOCKED',
312
+ 'FIX_VERIFIED',
313
+ ]);
314
+
315
+ const stateRank = (s) => EVIDENCE_STATES.indexOf(s);
316
+
317
+ const REQUIRES_PREDECESSOR = Object.freeze(Object.fromEntries(EVIDENCE_STATES.map((s, i) => [s, i === 0 ? null : EVIDENCE_STATES[i - 1]])));
318
+
319
+ /**
320
+ * Advance `from` to `to`. Returns { ok, state, reason }. Moving up requires `to` to be exactly the next rung; moving
321
+ * down or staying is always allowed (evidence can be lost, never invented). Unknown states are rejected.
322
+ */
323
+ function advance(from, to) {
324
+ if (!EVIDENCE_STATES.includes(from)) return { ok: false, state: 'CANDIDATE', reason: `unknown current state: ${String(from)}` };
325
+ if (!EVIDENCE_STATES.includes(to)) return { ok: false, state: from, reason: `unknown target state: ${String(to)}` };
326
+ if (stateRank(to) <= stateRank(from)) return { ok: true, state: to, reason: null };
327
+ if (REQUIRES_PREDECESSOR[to] !== from) return { ok: false, state: from, reason: `cannot reach ${to} from ${from}: ${REQUIRES_PREDECESSOR[to]} is required first` };
328
+ return { ok: true, state: to, reason: null };
329
+ }
330
+
331
+ // Bridges to the older vocabulary so existing consumers keep working.
332
+ function toProofTier(state) {
333
+ const r = stateRank(state);
334
+ if (r >= stateRank('EXPLOIT_CONFIRMED')) return 'execution-proven';
335
+ if (r >= stateRank('STATICALLY_CORROBORATED')) return 'taint-proven';
336
+ return 'unproven';
337
+ }
338
+
339
+ function fromProofTier(tier) {
340
+ if (tier === 'taint-proven') return 'STATICALLY_CORROBORATED';
341
+ // execution-proven under the older single-run marker path is one run, not the 3/3 + independent replay the fabric
342
+ // requires, so it maps to REPRODUCED and never to EXPLOIT_CONFIRMED.
343
+ if (tier === 'execution-proven') return 'REPRODUCED';
344
+ return 'CANDIDATE';
345
+ }
346
+
347
+ // Completeness vocabulary shared with fix-verify: FULL only when nothing was skipped.
348
+ const COMPLETENESS = Object.freeze(['FULL', 'DEGRADED', 'INCOMPLETE']);
349
+
350
+
351
+ /***/ }),
352
+
353
+ /***/ 25216:
354
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
355
+
356
+ __webpack_require__.r(__webpack_exports__);
357
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
358
+ /* harmony export */ findingKey: () => (/* binding */ findingKey),
359
+ /* harmony export */ latestProof: () => (/* binding */ latestProof),
360
+ /* harmony export */ listProofs: () => (/* binding */ listProofs),
361
+ /* harmony export */ saveProof: () => (/* binding */ saveProof),
362
+ /* harmony export */ scrubDeep: () => (/* binding */ scrubDeep)
363
+ /* harmony export */ });
364
+ /* harmony import */ var node_fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(73024);
365
+ /* harmony import */ var node_path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(76760);
366
+ /* harmony import */ var _state_dir_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(69259);
367
+ /* harmony import */ var _encryption_provider_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(71425);
368
+ /* harmony import */ var _llm_validator_redact_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(98039);
369
+ /* harmony import */ var _reproducer_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(82034);
370
+ // Proof artifact store: `.agentic-security/proofs/<findingKey>/<recordDigest>.json`.
371
+ //
372
+ // Reuses the existing state machinery rather than adding another: `safeWriteState` (refuses unsafe dirs and symlinks),
373
+ // `maybeEncryptForWrite` / `maybeDecryptForRead` (the `proofs` artifact is registered `confidential`), retention
374
+ // (evidence class) and legal holds (a hold on `proofs` blocks purge). Nothing persisted contains a plaintext credential:
375
+ // records are passed through a recursive secret filter first, and the runner never returns its per-run nonce or secrets.
376
+
377
+
378
+
379
+
380
+
381
+
382
+
383
+ const PROOF_RECORD_SCHEMA = 'agentic-security/proof-record';
384
+ const PROOFS_DIR = 'proofs';
385
+ const MAX_RECORD_BYTES = 512 * 1024;
386
+
387
+ const findingKey = (id) => `${String(id).replace(/[^A-Za-z0-9._-]/g, '_').slice(0, 80)}-${(0,_reproducer_js__WEBPACK_IMPORTED_MODULE_5__/* .sha256 */ .sc)(String(id)).slice(0, 8)}`;
388
+
389
+ // The shared redactor catches key=value shapes; bare tokens need their own pass, so persisted evidence cannot carry one.
390
+ const BARE_SECRET_RES = [
391
+ /\b(?:ghp|gho|ghu|ghs|ghr|github_pat)_[A-Za-z0-9_]{20,}\b/g, /\b(?:AKIA|ASIA)[A-Z0-9]{16}\b/g, /\bsk-[A-Za-z0-9_-]{20,}\b/g,
392
+ /\bxox[abprs]-[A-Za-z0-9-]{10,}\b/g, /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g,
393
+ /-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*?(?:-----END [A-Z ]*PRIVATE KEY-----|$)/g, /\bSECRET-[0-9a-f]{24}-[a-z0-9_-]+\b/g,
394
+ ];
395
+ function scrubString(text) {
396
+ let t = String(text);
397
+ try { t = (0,_llm_validator_redact_js__WEBPACK_IMPORTED_MODULE_4__/* .redactSecrets */ .f)(t).text; } catch { return '[unredactable]'; }
398
+ for (const re of BARE_SECRET_RES) t = t.replace(re, '[REDACTED-SECRET]');
399
+ return t;
400
+ }
401
+
402
+ /** Deep-copy `v` with every string passed through the secret redactor. */
403
+ function scrubDeep(v) {
404
+ if (typeof v === 'string') return scrubString(v);
405
+ if (Array.isArray(v)) return v.map(scrubDeep);
406
+ if (v && typeof v === 'object') return Object.fromEntries(Object.entries(v).map(([k, x]) => [k, scrubDeep(x)]));
407
+ return v;
408
+ }
409
+
410
+ function recordDigest(record) {
411
+ const { recordDigest: _omit, ...rest } = record;
412
+ return (0,_reproducer_js__WEBPACK_IMPORTED_MODULE_5__/* .sha256 */ .sc)((0,_reproducer_js__WEBPACK_IMPORTED_MODULE_5__/* .canonicalize */ .dw)(rest));
413
+ }
414
+
415
+ function saveProof(scanRoot, record) {
416
+ const safe = scrubDeep(record);
417
+ safe.schema = PROOF_RECORD_SCHEMA;
418
+ safe.recordDigest = recordDigest(safe);
419
+ const text = JSON.stringify(safe, null, 2);
420
+ if (Buffer.byteLength(text) > MAX_RECORD_BYTES) return { ok: false, reason: 'proof record exceeds the size limit' };
421
+ if (!(0,_state_dir_js__WEBPACK_IMPORTED_MODULE_2__/* .ensureStateDir */ .xH)(scanRoot)) return { ok: false, reason: 'no safe state directory for this project' };
422
+ const enc = (0,_encryption_provider_js__WEBPACK_IMPORTED_MODULE_3__/* .maybeEncryptForWrite */ .v2)(scanRoot, PROOFS_DIR, text);
423
+ if (!enc.ok) return { ok: false, reason: enc.reason };
424
+ const file = (0,_state_dir_js__WEBPACK_IMPORTED_MODULE_2__.statePath)(scanRoot, PROOFS_DIR, findingKey(record.findingId), `${safe.recordDigest}.json`);
425
+ if (!(0,_state_dir_js__WEBPACK_IMPORTED_MODULE_2__.safeWriteState)(file, enc.content)) return { ok: false, reason: 'state write refused' };
426
+ return { ok: true, file, digest: safe.recordDigest, encrypted: enc.encrypted };
427
+ }
428
+
429
+ function readRecord(file) {
430
+ const text = (0,_encryption_provider_js__WEBPACK_IMPORTED_MODULE_3__.maybeDecryptForRead)(node_fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync(file, 'utf8'));
431
+ const rec = JSON.parse(text);
432
+ // A record whose content no longer matches its own digest was modified after it was written.
433
+ if (rec.recordDigest !== recordDigest(rec)) return { tampered: true, record: rec };
434
+ return { tampered: false, record: rec };
435
+ }
436
+
437
+ /** Newest-first records for a finding. Tampered records are returned flagged, never silently dropped or trusted. */
438
+ function listProofs(scanRoot, findingId) {
439
+ const dir = (0,_state_dir_js__WEBPACK_IMPORTED_MODULE_2__.statePath)(scanRoot, PROOFS_DIR, findingKey(findingId));
440
+ let names = [];
441
+ try { names = node_fs__WEBPACK_IMPORTED_MODULE_0__.readdirSync(dir).filter((n) => n.endsWith('.json')); } catch { return []; }
442
+ const out = [];
443
+ for (const n of names) {
444
+ const f = node_path__WEBPACK_IMPORTED_MODULE_1__.join(dir, n);
445
+ try { const { tampered, record } = readRecord(f); out.push({ file: f, tampered, record, mtime: node_fs__WEBPACK_IMPORTED_MODULE_0__.statSync(f).mtimeMs }); } catch { out.push({ file: f, tampered: true, record: null, mtime: 0 }); }
446
+ }
447
+ return out.sort((a, b) => b.mtime - a.mtime);
448
+ }
449
+
450
+ function latestProof(scanRoot, findingId) {
451
+ return listProofs(scanRoot, findingId).find((p) => p.record) ?? null;
452
+ }
453
+
454
+
455
+ /***/ })
456
+
457
+ };