@clear-capabilities/agentic-security-scanner 0.185.0 → 0.186.2

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 (174) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/bin/agentic-security.js +66 -18
  3. package/dist/1128.index.js +25 -21
  4. package/dist/{5817.index.js → 1602.index.js} +378 -29
  5. package/dist/2584.index.js +1 -1
  6. package/dist/4171.index.js +2 -2
  7. package/dist/{0b301d45b231f144a1b4.json → 4d06c8944ae121d7085c.json} +8 -8
  8. package/dist/5752.index.js +466 -0
  9. package/dist/7405.index.js +1 -1
  10. package/dist/8158.index.js +1713 -0
  11. package/dist/8798.index.js +1 -1
  12. package/dist/9382.index.js +2 -2
  13. package/dist/9560.index.js +1 -1
  14. package/dist/9579.index.js +1 -1
  15. package/dist/agentic-security.mjs +29 -29
  16. package/dist/agentic-security.mjs.sha256 +1 -1
  17. package/package.json +8 -8
  18. package/src/dataflow/CLAUDE.md +6 -3
  19. package/src/dataflow/access-paths.js +12 -2
  20. package/src/dataflow/demand-query.js +279 -40
  21. package/src/dataflow/dep-fingerprint.js +1 -1
  22. package/src/dataflow/exploit-prover.js +6 -2
  23. package/src/dataflow/ir-cache.js +268 -0
  24. package/src/dataflow/privacy-taint.js +7 -0
  25. package/src/engine.js +62 -5
  26. package/src/ir/CLAUDE.md +4 -0
  27. package/src/ir/callgraph.js +36 -8
  28. package/src/ir/index.js +18 -4
  29. package/src/ir/parser-js.js +10 -0
  30. package/src/language/CLAUDE.md +13 -0
  31. package/src/language/nix-option-types.js +170 -0
  32. package/src/language/nix-script-taint.js +46 -3
  33. package/src/language/nix-secrets.js +20 -2
  34. package/src/lineage/CLAUDE.md +2 -1
  35. package/src/lineage/smt-orchestrator.js +47 -11
  36. package/src/lineage/smt-z3-backend.js +294 -0
  37. package/src/posture/CLAUDE.md +5 -1
  38. package/src/posture/business-logic.js +16 -7
  39. package/src/posture/dag-commands.js +442 -0
  40. package/src/posture/finding-defaults.js +19 -0
  41. package/src/posture/git-history.js +91 -1
  42. package/src/posture/proof-fabric/cli.js +1 -1
  43. package/src/posture/proof-fabric/container.js +2 -2
  44. package/src/posture/proof-fabric/generate-haskell.js +205 -0
  45. package/src/posture/proof-fabric/generate.js +6 -3
  46. package/src/posture/proof-fabric/reproducer.js +4 -2
  47. package/src/posture/proof-fabric/runner.js +4 -4
  48. package/src/sast/CLAUDE.md +2 -0
  49. package/src/sast/_call-args.js +70 -0
  50. package/src/sast/init-scope.js +87 -0
  51. package/src/sast/listen-bind-address.js +49 -0
  52. package/src/sast/redirect-target.js +106 -0
  53. package/src/sast/reflected-input.js +76 -0
  54. package/src/sast/send-file-root.js +27 -0
  55. package/src/sast/sensitive-data-logging.js +38 -1
  56. package/dist/119.index.js +0 -197
  57. package/dist/128.index.js +0 -129
  58. package/dist/1293.index.js +0 -5689
  59. package/dist/1336.index.js +0 -16331
  60. package/dist/1351.index.js +0 -133
  61. package/dist/1387.index.js +0 -271
  62. package/dist/1437.index.js +0 -23
  63. package/dist/1445.index.js +0 -110
  64. package/dist/1505.index.js +0 -151
  65. package/dist/1557.index.js +0 -293
  66. package/dist/1621.index.js +0 -311
  67. package/dist/1751.index.js +0 -160
  68. package/dist/1765.index.js +0 -727
  69. package/dist/1861.index.js +0 -690
  70. package/dist/1906.index.js +0 -433
  71. package/dist/208.index.js +0 -1631
  72. package/dist/2223.index.js +0 -159
  73. package/dist/2238.index.js +0 -295
  74. package/dist/2530.index.js +0 -152
  75. package/dist/2565.index.js +0 -116
  76. package/dist/2574.index.js +0 -127
  77. package/dist/2620.index.js +0 -345
  78. package/dist/2773.index.js +0 -98
  79. package/dist/2775.index.js +0 -32
  80. package/dist/2966.index.js +0 -171
  81. package/dist/2972.index.js +0 -87
  82. package/dist/2991.index.js +0 -131
  83. package/dist/3063.index.js +0 -833
  84. package/dist/3075.index.js +0 -227
  85. package/dist/3121.index.js +0 -297
  86. package/dist/3314.index.js +0 -263
  87. package/dist/3480.index.js +0 -1822
  88. package/dist/3481.index.js +0 -24
  89. package/dist/3506.index.js +0 -268
  90. package/dist/3533.index.js +0 -591
  91. package/dist/3653.index.js +0 -450
  92. package/dist/3740.index.js +0 -722
  93. package/dist/3822.index.js +0 -131
  94. package/dist/3868.index.js +0 -292
  95. package/dist/3918.index.js +0 -192
  96. package/dist/4090.index.js +0 -288
  97. package/dist/4113.index.js +0 -1286
  98. package/dist/4121.index.js +0 -1190
  99. package/dist/4142.index.js +0 -690
  100. package/dist/4168.index.js +0 -509
  101. package/dist/4281.index.js +0 -993
  102. package/dist/4336.index.js +0 -436
  103. package/dist/4387.index.js +0 -532
  104. package/dist/4413.index.js +0 -302
  105. package/dist/4476.index.js +0 -4510
  106. package/dist/4491.index.js +0 -133
  107. package/dist/4538.index.js +0 -185
  108. package/dist/4684.index.js +0 -319
  109. package/dist/4740.index.js +0 -165
  110. package/dist/4780.index.js +0 -209
  111. package/dist/4802.index.js +0 -225
  112. package/dist/4812.index.js +0 -379
  113. package/dist/4835.index.js +0 -126
  114. package/dist/494.index.js +0 -226
  115. package/dist/4991.index.js +0 -549
  116. package/dist/5199.index.js +0 -305
  117. package/dist/5216.index.js +0 -109
  118. package/dist/5439.index.js +0 -301
  119. package/dist/5443.index.js +0 -97
  120. package/dist/5496.index.js +0 -377
  121. package/dist/5738.index.js +0 -240
  122. package/dist/5801.index.js +0 -588
  123. package/dist/5858.index.js +0 -223
  124. package/dist/5933.index.js +0 -143
  125. package/dist/601.index.js +0 -23
  126. package/dist/6173.index.js +0 -273
  127. package/dist/6291.index.js +0 -1871
  128. package/dist/6312.index.js +0 -666
  129. package/dist/634.index.js +0 -16182
  130. package/dist/644.index.js +0 -87
  131. package/dist/6508.index.js +0 -283
  132. package/dist/6560.index.js +0 -645
  133. package/dist/6576.index.js +0 -422
  134. package/dist/6579.index.js +0 -271
  135. package/dist/6655.index.js +0 -3221
  136. package/dist/6745.index.js +0 -305
  137. package/dist/6818.index.js +0 -21642
  138. package/dist/6932.index.js +0 -1190
  139. package/dist/6972.index.js +0 -167
  140. package/dist/6995.index.js +0 -163
  141. package/dist/7249.index.js +0 -191
  142. package/dist/7372.index.js +0 -1197
  143. package/dist/7546.index.js +0 -541
  144. package/dist/76.index.js +0 -448
  145. package/dist/7879.index.js +0 -163
  146. package/dist/8025.index.js +0 -130
  147. package/dist/8054.index.js +0 -248
  148. package/dist/808.index.js +0 -1330
  149. package/dist/8097.index.js +0 -201
  150. package/dist/8126.index.js +0 -191
  151. package/dist/8178.index.js +0 -78
  152. package/dist/8382.index.js +0 -93
  153. package/dist/8408.index.js +0 -261
  154. package/dist/8540.index.js +0 -174
  155. package/dist/8635.index.js +0 -802
  156. package/dist/8688.index.js +0 -410
  157. package/dist/8699.index.js +0 -779
  158. package/dist/8891.index.js +0 -457
  159. package/dist/8916.index.js +0 -885
  160. package/dist/9146.index.js +0 -170
  161. package/dist/9168.index.js +0 -841
  162. package/dist/9292.index.js +0 -369
  163. package/dist/9422.index.js +0 -866
  164. package/dist/9440.index.js +0 -453
  165. package/dist/9479.index.js +0 -152
  166. package/dist/9481.index.js +0 -220
  167. package/dist/9539.index.js +0 -100
  168. package/dist/9547.index.js +0 -103
  169. package/dist/9692.index.js +0 -90
  170. package/dist/9800.index.js +0 -462
  171. package/dist/9899.index.js +0 -138
  172. package/dist/9981.index.js +0 -206
  173. package/dist/999.index.js +0 -117
  174. package/dist/9999.index.js +0 -1698
@@ -1,305 +0,0 @@
1
- export const id = 6745;
2
- export const ids = [6745];
3
- export const modules = {
4
-
5
- /***/ 96745:
6
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
7
-
8
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
9
- /* harmony export */ formatFixProof: () => (/* binding */ formatFixProof),
10
- /* harmony export */ verifyFixWithProof: () => (/* binding */ verifyFixWithProof)
11
- /* harmony export */ });
12
- /* harmony import */ var _states_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(58355);
13
- /* harmony import */ var _orchestrator_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(84817);
14
- /* harmony import */ var _runner_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1595);
15
- /* harmony import */ var _reproducer_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(82034);
16
- // Verified remediation, extended with exploit replay. This EXTENDS the fix-verify vocabulary (`verifiedFull`,
17
- // `degradedLegs`); it does not define a competing meaning of "verified".
18
- //
19
- // 1. pre-patch: the original exploit must be EXPLOIT_CONFIRMED (3/3 + independent replay) on the unpatched code;
20
- // 2. the candidate patch is overlaid on the imported sources and the SAME exploit is replayed;
21
- // 3. the patched replay must COMPLETE in every attempt and the oracle must not fire in any: BLOCKED.
22
- // An attempt that did not complete (timeout, build failure, no environment) is inconclusive, never "blocked";
23
- // 4. static legs (re-scan, lint, tests, honesty) come from `verifyFix`, passed in so they are not re-implemented;
24
- // 5. FIX_VERIFIED only when 1-4 hold and the static verification had no degraded leg.
25
-
26
-
27
-
28
-
29
-
30
- async function verifyFixWithProof({ finding, reproducer, files, scanRoot, revision = null, policy = {}, staticVerification = null, siblings = null, signal, deps = {} } = {}) {
31
- const t0 = Date.now();
32
- const attemptFn = deps.attemptFn ?? _runner_js__WEBPACK_IMPORTED_MODULE_2__/* .runAttempt */ .Tm;
33
- const patchHash = (0,_reproducer_js__WEBPACK_IMPORTED_MODULE_3__/* .sha256 */ .sc)((0,_reproducer_js__WEBPACK_IMPORTED_MODULE_3__/* .canonicalize */ .dw)(files || {}));
34
- const legs = { prePatch: null, postPatch: null, regression: staticVerification ? { ok: !!staticVerification.ok, verifiedFull: !!staticVerification.verifiedFull } : { status: 'not-run' }, rescan: staticVerification?.rescan ?? { status: 'not-run' } };
35
- const out = (extra) => ({ schema: 'agentic-security/fix-proof', version: 1, findingId: finding?.stableId ?? finding?.id ?? null, patchHash, reproducerDigest: (0,_reproducer_js__WEBPACK_IMPORTED_MODULE_3__/* .reproducerDigest */ .we)(reproducer), legs, durationMs: Date.now() - t0, ...extra });
36
-
37
- const pre = await (0,_orchestrator_js__WEBPACK_IMPORTED_MODULE_1__/* .proveFinding */ .kO)({ finding, revision, reproducer, policy, signal, deps, sourceRoot: scanRoot });
38
- legs.prePatch = { state: pre.state, outcome: pre.outcome, completeness: pre.completeness };
39
- if (pre.state !== 'EXPLOIT_CONFIRMED') {
40
- return out({ state: pre.state, verified: false, completeness: 'INCOMPLETE', incompleteStep: 'pre-patch-exploit', reason: `the original exploit was not confirmed before the patch (${pre.outcome}); a fix cannot be proven against an exploit that does not reproduce` });
41
- }
42
-
43
- const attempts = Math.max(1, Math.min(10, policy.attempts ?? 3));
44
- const results = [];
45
- for (let i = 0; i < attempts; i++) {
46
- if (signal?.aborted) break;
47
- results.push(await attemptFn(structuredClone(reproducer), { limits: { timeoutMs: policy.timeoutMs }, signal, sourceRoot: scanRoot, overlay: files, requireContainer: policy.requireContainer, force: policy.force }));
48
- }
49
- const completed = results.filter((r) => r.status === 'completed' && !r.oracle?.inconclusive);
50
- const fired = completed.filter((r) => r.oracle?.fired).length;
51
- legs.postPatch = { attempts: results.length, completed: completed.length, exploitSucceeded: fired, statuses: results.map((r) => r.status) };
52
-
53
- if (fired > 0) return out({ state: 'EXPLOIT_CONFIRMED', verified: false, completeness: 'FULL', incompleteStep: 'post-patch-exploit', reason: 'the exploit still succeeds against the patched code' });
54
- if (completed.length < results.length || results.length === 0) {
55
- return out({ state: 'EXPLOIT_CONFIRMED', verified: false, completeness: 'INCOMPLETE', incompleteStep: 'post-patch-replay', reason: 'the patched replay did not complete in every attempt, so the patch is not shown to block the exploit' });
56
- }
57
- let state = (0,_states_js__WEBPACK_IMPORTED_MODULE_0__/* .advance */ .np)('EXPLOIT_CONFIRMED', 'FIX_REPLAY_BLOCKED').state;
58
-
59
- const degraded = [];
60
- if (!staticVerification) degraded.push('static-verification-not-run');
61
- else {
62
- if (!staticVerification.ok) return out({ state, verified: false, completeness: 'FULL', incompleteStep: 'static-verification', reason: `exploit blocked, but static verification failed: ${staticVerification.rescan?.reason || 'a leg failed'}` });
63
- for (const d of staticVerification.degradedLegs || []) degraded.push(d);
64
- }
65
- const lowAssurance = pre.environment?.assurance === 'lower';
66
- if (lowAssurance) degraded.push('lower-assurance-local-confinement');
67
- const siblingCount = Array.isArray(siblings) ? siblings.length : null;
68
- if (siblingCount === null) degraded.push('sibling-search-not-run');
69
- else if (siblingCount > 0) degraded.push(`sibling-exposures:${siblingCount}`);
70
-
71
- const full = degraded.length === 0;
72
- // Same split as fix-verify: `ok` (nothing that ran failed) earns FIX_VERIFIED; `completeness` says whether anything was skipped.
73
- if (staticVerification && staticVerification.ok) state = (0,_states_js__WEBPACK_IMPORTED_MODULE_0__/* .advance */ .np)(state, 'FIX_VERIFIED').state;
74
- return out({ state, verified: state === 'FIX_VERIFIED', completeness: full ? 'FULL' : 'DEGRADED', degradedLegs: degraded, siblings: siblings ?? null });
75
- }
76
-
77
- function formatFixProof(r) {
78
- const L = r.legs || {};
79
- return [
80
- `Pre-patch exploit: ${L.prePatch?.state === 'EXPLOIT_CONFIRMED' ? 'PASS' : 'NOT CONFIRMED'}`,
81
- `Post-patch exploit: ${!L.postPatch ? 'NOT RUN' : L.postPatch.exploitSucceeded > 0 ? 'STILL SUCCEEDS' : L.postPatch.completed === L.postPatch.attempts ? 'BLOCKED' : 'INCONCLUSIVE'}`,
82
- `Regression tests: ${L.regression?.status === 'not-run' ? 'not run' : L.regression?.verifiedFull ? 'PASS' : L.regression?.ok ? 'PASS (degraded)' : 'FAIL'}`,
83
- `Security rescan: ${L.rescan?.ok === true ? 'PASS' : L.rescan?.status === 'not-run' ? 'not run' : 'FAIL'}`,
84
- `Completeness: ${r.completeness}${r.degradedLegs?.length ? ` (${r.degradedLegs.join('; ')})` : ''}`,
85
- '',
86
- `Evidence: ${r.state}${r.verified ? '' : ` (not verified: ${r.reason || r.incompleteStep || 'degraded'})`}`,
87
- ].join('\n');
88
- }
89
-
90
-
91
- /***/ }),
92
-
93
- /***/ 84817:
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__(58355);
102
- /* harmony import */ var _runner_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1595);
103
- /* harmony import */ var _reproducer_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(82034);
104
- /* harmony import */ var _proof_tier_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(24555);
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
- /***/ 58355:
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
-
303
- /***/ })
304
-
305
- };