@clear-capabilities/agentic-security-scanner 0.172.0 → 0.173.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/bin/agentic-security.js +37 -0
- package/dist/119.index.js +197 -0
- package/dist/128.index.js +129 -0
- package/dist/1293.index.js +5689 -0
- package/dist/1336.index.js +101 -101
- package/dist/1351.index.js +133 -0
- package/dist/1387.index.js +271 -0
- package/dist/1437.index.js +23 -0
- package/dist/1445.index.js +110 -0
- package/dist/1505.index.js +151 -0
- package/dist/1557.index.js +293 -0
- package/dist/1621.index.js +311 -0
- package/dist/1751.index.js +160 -0
- package/dist/1765.index.js +727 -0
- package/dist/1861.index.js +690 -0
- package/dist/1898.index.js +116 -0
- package/dist/1906.index.js +433 -0
- package/dist/1920.index.js +1 -291
- package/dist/208.index.js +1631 -0
- package/dist/2199.index.js +0 -239
- package/dist/2223.index.js +159 -0
- package/dist/2530.index.js +152 -0
- package/dist/2565.index.js +116 -0
- package/dist/2574.index.js +127 -0
- package/dist/2620.index.js +345 -0
- package/dist/2773.index.js +98 -0
- package/dist/2775.index.js +32 -0
- package/dist/2966.index.js +171 -0
- package/dist/2972.index.js +87 -0
- package/dist/2991.index.js +131 -0
- package/dist/3063.index.js +833 -0
- package/dist/3075.index.js +227 -0
- package/dist/3121.index.js +297 -0
- package/dist/3314.index.js +263 -0
- package/dist/3480.index.js +1822 -0
- package/dist/3481.index.js +24 -0
- package/dist/3506.index.js +268 -0
- package/dist/3533.index.js +591 -0
- package/dist/3653.index.js +450 -0
- package/dist/3822.index.js +131 -0
- package/dist/3868.index.js +292 -0
- package/dist/3917.index.js +152 -0
- package/dist/3918.index.js +192 -0
- package/dist/4090.index.js +288 -0
- package/dist/4121.index.js +1190 -0
- package/dist/4142.index.js +0 -239
- package/dist/4336.index.js +436 -0
- package/dist/4387.index.js +532 -0
- package/dist/4413.index.js +302 -0
- package/dist/4476.index.js +4510 -0
- package/dist/4491.index.js +133 -0
- package/dist/4538.index.js +185 -0
- package/dist/4684.index.js +319 -0
- package/dist/4740.index.js +165 -0
- package/dist/4780.index.js +209 -0
- package/dist/4802.index.js +225 -0
- package/dist/4812.index.js +379 -0
- package/dist/4835.index.js +126 -0
- package/dist/494.index.js +226 -0
- package/dist/4991.index.js +549 -0
- package/dist/5199.index.js +305 -0
- package/dist/5216.index.js +109 -0
- package/dist/5439.index.js +301 -0
- package/dist/5443.index.js +97 -0
- package/dist/5496.index.js +377 -0
- package/dist/550.index.js +2 -1
- package/dist/5801.index.js +588 -0
- package/dist/5858.index.js +223 -0
- package/dist/5933.index.js +143 -0
- package/dist/601.index.js +23 -0
- package/dist/6173.index.js +273 -0
- package/dist/6291.index.js +1871 -0
- package/dist/6312.index.js +666 -0
- package/dist/634.index.js +16182 -0
- package/dist/644.index.js +87 -0
- package/dist/6508.index.js +283 -0
- package/dist/6560.index.js +645 -0
- package/dist/6576.index.js +422 -0
- package/dist/6579.index.js +271 -0
- package/dist/6745.index.js +305 -0
- package/dist/6818.index.js +21642 -0
- package/dist/6972.index.js +167 -0
- package/dist/6995.index.js +163 -0
- package/dist/7249.index.js +191 -0
- package/dist/7372.index.js +1197 -0
- package/dist/7405.index.js +23 -6
- package/dist/7546.index.js +541 -0
- package/dist/76.index.js +448 -0
- package/dist/7879.index.js +163 -0
- package/dist/8025.index.js +130 -0
- package/dist/8054.index.js +248 -0
- package/dist/8097.index.js +201 -0
- package/dist/8126.index.js +191 -0
- package/dist/8178.index.js +78 -0
- package/dist/818.index.js +212 -0
- package/dist/8382.index.js +93 -0
- package/dist/8408.index.js +261 -0
- package/dist/8540.index.js +174 -0
- package/dist/8635.index.js +802 -0
- package/dist/8688.index.js +410 -0
- package/dist/8699.index.js +779 -0
- package/dist/8891.index.js +457 -0
- package/dist/8916.index.js +885 -0
- package/dist/9146.index.js +170 -0
- package/dist/9168.index.js +841 -0
- package/dist/9292.index.js +369 -0
- package/dist/9382.index.js +338 -48
- package/dist/9422.index.js +866 -0
- package/dist/9440.index.js +453 -0
- package/dist/9479.index.js +152 -0
- package/dist/9481.index.js +220 -0
- package/dist/9539.index.js +100 -0
- package/dist/9547.index.js +103 -0
- package/dist/9560.index.js +41 -61
- package/dist/9692.index.js +90 -0
- package/dist/9800.index.js +213 -1
- package/dist/9899.index.js +138 -0
- package/dist/9981.index.js +206 -0
- package/dist/999.index.js +117 -0
- package/dist/agentic-security.mjs +28 -28
- package/dist/agentic-security.mjs.sha256 +1 -1
- package/package.json +31 -6
- package/src/context-intelligence/CLAUDE.md +4 -0
- package/src/context-intelligence/adapters/haskell-hie.js +28 -1
- package/src/context-intelligence/candidates.js +2 -1
- package/src/context-intelligence/canonical.js +25 -0
- package/src/context-intelligence/capabilities.js +2 -1
- package/src/context-intelligence/cli.js +16 -10
- package/src/context-intelligence/config.js +4 -1
- package/src/context-intelligence/controls.js +108 -10
- package/src/context-intelligence/counterexample.js +200 -0
- package/src/context-intelligence/cross-route.js +111 -0
- package/src/context-intelligence/entrypoints.js +2 -2
- package/src/context-intelligence/evaluation/index.js +11 -4
- package/src/context-intelligence/evaluation/scripted-reader.js +12 -2
- package/src/context-intelligence/findings.js +166 -0
- package/src/context-intelligence/invariants.js +197 -0
- package/src/context-intelligence/queue.js +6 -1
- package/src/context-intelligence/reachability.js +10 -4
- package/src/context-intelligence/review.js +129 -16
- package/src/dataflow/access-paths.js +11 -0
- package/src/dataflow/analysis-limits.js +66 -0
- package/src/dataflow/engine.js +272 -20
- package/src/dataflow/service-edges.js +174 -0
- package/src/dataflow/summaries.js +7 -1
- package/src/discovery/judge.js +2 -1
- package/src/engine.js +82 -14
- package/src/fix/apply-fix-service.js +55 -8
- package/src/fix/batch-journal.js +84 -0
- package/src/fix/exploit-replay.js +51 -0
- package/src/fix/footprint.js +65 -0
- package/src/fix/patch-policy.js +49 -0
- package/src/fix/secret-persistence.js +39 -0
- package/src/fix/test-commands.js +84 -0
- package/src/fix/verification-adapters.js +97 -0
- package/src/fix/verification-record.js +243 -0
- package/src/fix/verify-patch.js +89 -0
- package/src/ir/CLAUDE.md +5 -0
- package/src/ir/callgraph.js +23 -1
- package/src/ir/module-resolver.js +315 -0
- package/src/ir/parser-js.js +21 -2
- package/src/ir/semantic-graph.js +245 -0
- package/src/lineage/build-attested-correlation.js +63 -0
- package/src/lineage/deployment-identity.js +76 -0
- package/src/mcp/tools.js +13 -34
- package/src/pipeline/canonical-output.js +64 -0
- package/src/pipeline/detector-runner.js +7 -0
- package/src/pipeline/scan-health.js +14 -0
- package/src/pipeline/supervised-analyzers.js +125 -0
- package/src/pipeline/supervised-child.js +17 -0
- package/src/pipeline/telemetry.js +79 -0
- package/src/posture/accuracy-scorecard.js +98 -9
- package/src/posture/artifact-registry.js +5 -0
- package/src/posture/assurance/evidence-registry.js +215 -0
- package/src/posture/assurance/release-package-verify.js +135 -0
- package/src/posture/assurance/release-package.js +118 -0
- package/src/posture/assurance/release-verdict.js +94 -0
- package/src/posture/assurance/waiver.js +200 -0
- package/src/posture/compliance-truth.js +100 -0
- package/src/posture/evaluation/scan-child.js +3 -1
- package/src/posture/evaluation/why-missed.js +3 -1
- package/src/posture/exploitability-evidence.js +141 -0
- package/src/posture/fix-verify.js +4 -2
- package/src/posture/fleet/exposure-ranking.js +115 -0
- package/src/posture/fleet/service-chain-graph.js +150 -0
- package/src/posture/graph-reconciliation.js +154 -0
- package/src/posture/provenance/coverage.js +103 -0
- package/src/posture/provenance/git-evidence.js +84 -0
- package/src/posture/provenance/origin-resolver.js +7 -1
- package/src/posture/provenance/predicate-replay.js +14 -4
- package/src/posture/runtime-correlation.js +61 -15
- package/src/posture/runtime-explanation.js +116 -0
- package/src/posture/runtime-trace-ingest.js +194 -0
- package/src/posture/scan-checkpoint.js +38 -10
- package/src/posture/waf-ingest.js +7 -2
- package/src/report/index.js +4 -0
- package/src/report/oscal.js +38 -0
- package/src/report/perspectives.js +150 -0
- package/src/sast/_comment-strip.js +8 -1
- package/src/sast/ruby.js +26 -0
- package/src/util/string-memo.js +38 -0
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
export const id = 6579;
|
|
2
|
+
export const ids = [6579];
|
|
3
|
+
export const modules = {
|
|
4
|
+
|
|
5
|
+
/***/ 56579:
|
|
6
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
// EXPORTS
|
|
10
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
11
|
+
buildViews: () => (/* binding */ buildViews),
|
|
12
|
+
renderHtml: () => (/* binding */ renderHtml),
|
|
13
|
+
renderText: () => (/* binding */ renderText)
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
// UNUSED EXPORTS: buildCanonicalFindings
|
|
17
|
+
|
|
18
|
+
// EXTERNAL MODULE: external "node:crypto"
|
|
19
|
+
var external_node_crypto_ = __webpack_require__(77598);
|
|
20
|
+
;// CONCATENATED MODULE: ./src/posture/assurance/release-verdict.js
|
|
21
|
+
// The release verdict (E7-08): a deterministic function from a release package to one of three answers, with every reason in plain words.
|
|
22
|
+
//
|
|
23
|
+
// not_deployable a condition the policy treats as blocking is present: an unfinished scan, files that were not scanned, an analyzer that timed out or failed,
|
|
24
|
+
// a fix that was claimed and not verified, an open finding that is proven exploitable, an open high or critical finding
|
|
25
|
+
// needs_review nothing blocks, but something is unknown and a person has to decide: a signal the context analysis could not settle, runtime evidence that
|
|
26
|
+
// came from a different build, a finding of unproven exploitability that is high or critical
|
|
27
|
+
// deployable none of the above. This is NOT a statement that the release is safe; it says no blocking or unknown condition was found in the evidence the package holds
|
|
28
|
+
//
|
|
29
|
+
// The word "safe" is never produced. The verdict is a function of the package alone (no clock, no environment), so the same package gives the same verdict and the same
|
|
30
|
+
// reasons in the same order, and a stated verdict that differs from the one recomputed here is refused (`verifyStatedVerdict`).
|
|
31
|
+
//
|
|
32
|
+
// WHAT COUNTS AS A BLOCKER is the policy below, not a judgement made per release. Waived findings (a waiver the package lists as honoured) do not block but are listed.
|
|
33
|
+
const SEV_BLOCK = new Set(['critical', 'high']);
|
|
34
|
+
|
|
35
|
+
const asArray = (v) => (Array.isArray(v) ? v : []);
|
|
36
|
+
const by = (pkg, kind) => asArray(pkg && pkg.evidence).filter((e) => e && e.ref && e.ref.kind === kind);
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @param {object} pkg a release package
|
|
40
|
+
* @param {{waivedIds?:string[]}} [opts] finding ids covered by an honoured waiver
|
|
41
|
+
* @returns {{verdict:'not_deployable'|'needs_review'|'deployable', blockers:{code:string, message:string, evidence:string[]}[], unknowns:{code:string, message:string, evidence:string[]}[], waived:string[], statement:string}}
|
|
42
|
+
*/
|
|
43
|
+
function releaseVerdict(pkg, { waivedIds = [] } = {}) {
|
|
44
|
+
const blockers = []; const unknowns = [];
|
|
45
|
+
const block = (code, message, evidence = []) => blockers.push({ code, message, evidence });
|
|
46
|
+
const unk = (code, message, evidence = []) => unknowns.push({ code, message, evidence });
|
|
47
|
+
const waived = new Set(waivedIds);
|
|
48
|
+
|
|
49
|
+
// ---- the scan itself
|
|
50
|
+
const health = by(pkg, 'scan-health')[0];
|
|
51
|
+
if (!health) block('NO_SCAN_HEALTH', 'the package holds no scan health, so nothing says the scan finished');
|
|
52
|
+
else {
|
|
53
|
+
const h = health.payload || {}; const ev = [health.ref.digest];
|
|
54
|
+
if (h.status !== 'complete') block('SCAN_INCOMPLETE', `the scan did not finish cleanly (status ${JSON.stringify(h.status ?? 'unknown')}): ${asArray(h.conditions).join('; ') || 'no reason was recorded'}`, ev);
|
|
55
|
+
const f = h.files || {};
|
|
56
|
+
if (Number.isFinite(f.expected) && Number.isFinite(f.scanned) && f.scanned < f.expected) block('FILES_NOT_SCANNED', `${f.expected - f.scanned} of ${f.expected} files were not scanned`, ev);
|
|
57
|
+
else if (Number.isFinite(f.unanalysed) ? f.unanalysed > 0 : (Number.isFinite(f.skipped) && f.skipped > 0)) block('FILES_SKIPPED', `${Number.isFinite(f.unanalysed) ? f.unanalysed : f.skipped} file(s) were skipped (too large or too dense to analyse)`, ev);
|
|
58
|
+
if (Number.isFinite(f.timedOut) && f.timedOut > 0) block('FILES_TIMED_OUT', `${f.timedOut} file(s) exceeded the per-file analysis time`, ev);
|
|
59
|
+
const a = h.analyzers || {};
|
|
60
|
+
if (Number.isFinite(a.timedOut) && a.timedOut > 0) block('ANALYZER_TIMED_OUT', `${a.timedOut} analyzer(s) timed out, so what they would have found is not in this result`, ev);
|
|
61
|
+
if (Number.isFinite(a.failed) && a.failed > 0 && !(Number.isFinite(a.timedOut) && a.failed === a.timedOut)) block('ANALYZER_FAILED', `${a.failed} analyzer(s) failed, so what they would have found is not in this result`, ev);
|
|
62
|
+
if (h.deepAnalysis && Array.isArray(h.deepAnalysis.incomplete) && h.deepAnalysis.incomplete.length) unk('DEEP_ANALYSIS_INCOMPLETE', `deep analysis stopped short: ${h.deepAnalysis.incomplete.map((x) => `${x.reason} x${x.count}`).join(', ')}`, ev);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// ---- findings and fixes
|
|
66
|
+
const fixes = by(pkg, 'fix-verification');
|
|
67
|
+
const fixFor = (id) => fixes.filter((x) => x.payload && (x.payload.findingStableId === id || x.payload.findingId === id));
|
|
68
|
+
for (const e of by(pkg, 'finding')) {
|
|
69
|
+
const f = e.payload || {}; const id = e.ref.payloadId || f.stableId || f.id; const ev = [e.ref.digest];
|
|
70
|
+
const triage = f.triage && f.triage.state;
|
|
71
|
+
const falsePositive = triage === 'false_positive' || f.falsePositive === true;
|
|
72
|
+
const myFixes = fixFor(id); const fixed = myFixes.find((x) => x.payload.verifiedFull === true);
|
|
73
|
+
if (waived.has(id)) continue;
|
|
74
|
+
if (falsePositive) {
|
|
75
|
+
if (!(f.triage && f.triage.by && f.triage.reason)) unk('FALSE_POSITIVE_UNJUSTIFIED', `finding ${id} is marked a false positive without a named person and a reason`, ev);
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
for (const x of myFixes) if (x.payload.verifiedFull !== true) block('FIX_NOT_VERIFIED', `a fix for ${id} is claimed but was not fully verified (${asArray(x.payload.degradedLegs).map((d) => (typeof d === 'string' ? d : d && d.leg)).filter(Boolean).join(', ') || 'checks did not all pass'})`, [...ev, x.ref.digest]);
|
|
79
|
+
if (fixed) continue;
|
|
80
|
+
const sev = String(f.severity || 'info'); const tier = typeof f.proofTier === 'string' ? f.proofTier : 'unproven';
|
|
81
|
+
const ci = f.contextIntelligence && (f.contextIntelligence.counterexample && f.contextIntelligence.counterexample.state || f.contextIntelligence.state);
|
|
82
|
+
if (tier === 'execution-proven') block('PROVEN_OPEN_FINDING', `finding ${id} (${sev}) is proven exploitable and is open`, ev);
|
|
83
|
+
else if (SEV_BLOCK.has(sev)) {
|
|
84
|
+
if (ci === 'unresolved' || ci === 'plausible') unk('CONTEXT_SIGNAL_UNSETTLED', `finding ${id} (${sev}) rests on a context signal the analysis could not settle (${ci}); a person has to decide whether it is real`, ev);
|
|
85
|
+
else block('OPEN_HIGH_FINDING', `finding ${id} is open at severity ${sev}`, ev);
|
|
86
|
+
} else if (ci === 'unresolved' || ci === 'plausible') unk('CONTEXT_SIGNAL_UNSETTLED', `finding ${id} rests on a context signal the analysis could not settle (${ci})`, ev);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// ---- runtime evidence from another build
|
|
90
|
+
for (const e of by(pkg, 'runtime-explanation')) {
|
|
91
|
+
const edges = asArray(e.payload && e.payload.runtime && e.payload.runtime.edges); const bad = edges.filter((x) => Number(x.mismatchedRecords) > 0);
|
|
92
|
+
if (bad.length) unk('RUNTIME_BUILD_MISMATCH', `runtime records for ${bad.length} edge(s) of ${e.ref.payloadId || 'a finding'} came from a different build than the one released, so they say nothing about this release and are not counted as corroboration`, [e.ref.digest]);
|
|
93
|
+
const miss = asArray(e.payload && e.payload.runtime && e.payload.runtime.missingObservations);
|
|
94
|
+
if (!bad.length && miss.length && e.payload.compare && e.payload.compare.state !== 'corroborated') unk('RUNTIME_NOT_CORROBORATED', `runtime evidence for ${e.ref.payloadId || 'a finding'} does not corroborate the path: ${miss[0]}`, [e.ref.digest]);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
blockers.sort((a, b) => (a.code + a.message < b.code + b.message ? -1 : 1)); unknowns.sort((a, b) => (a.code + a.message < b.code + b.message ? -1 : 1));
|
|
98
|
+
const verdict = blockers.length ? 'not_deployable' : unknowns.length ? 'needs_review' : 'deployable';
|
|
99
|
+
const statement = verdict === 'deployable'
|
|
100
|
+
? 'No blocking or unknown condition was found in the evidence this package holds. That is not a statement that the release is safe.'
|
|
101
|
+
: verdict === 'needs_review' ? `Nothing blocks the release, but ${unknowns.length} thing(s) are unknown and a person has to decide.` : `${blockers.length} condition(s) block the release.`;
|
|
102
|
+
return { verdict, blockers, unknowns, waived: [...waived].sort(), statement };
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** Is the verdict a package states the one its own contents give? @returns {{ok:boolean, stated:string|null, computed:string, message:string|null}} */
|
|
106
|
+
function verifyStatedVerdict(pkg, opts) {
|
|
107
|
+
const computed = releaseVerdict(pkg, opts).verdict;
|
|
108
|
+
const decisions = asArray(pkg && pkg.policy && pkg.policy.decisions);
|
|
109
|
+
const d = decisions.find((x) => x && x.id === 'release-verdict');
|
|
110
|
+
const stated = d ? d.outcome : null;
|
|
111
|
+
if (stated === null) return { ok: false, stated, computed, message: 'the package states no release verdict' };
|
|
112
|
+
if (stated !== computed) return { ok: false, stated, computed, message: `the package states "${stated}" but its own contents give "${computed}"` };
|
|
113
|
+
return { ok: true, stated, computed, message: null };
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
;// CONCATENATED MODULE: ./src/report/perspectives.js
|
|
117
|
+
// Three views of one release (E7-07): what a developer needs, what a CISO needs, what an auditor needs, all built from the SAME canonical list of findings so they
|
|
118
|
+
// cannot disagree.
|
|
119
|
+
//
|
|
120
|
+
// developer where the problem is, why it is one, how to fix it, and whether a fix was verified
|
|
121
|
+
// CISO what is proven and what is not, what changed since the previous release, how risky and how complete
|
|
122
|
+
// auditor for each assertion and each unknown, the evidence it rests on (by digest) and why anything is unknown; the issuer and what the signature does not prove
|
|
123
|
+
//
|
|
124
|
+
// One list, three projections. `canonicalFindings` is computed once from the release package; every view only selects and arranges its fields, and each entry
|
|
125
|
+
// carries the same finding id, status, evidence hash and confidence wherever it appears. Nothing is recomputed per view.
|
|
126
|
+
//
|
|
127
|
+
// The package is DATA from a repository we do not control: every string is escaped before it reaches HTML, the page loads nothing from anywhere and runs no script, and a
|
|
128
|
+
// content security policy says so.
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
const esc = (v) => String(v ?? '').replace(/[&<>"'`]/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''', '`': '`' }[c]));
|
|
133
|
+
const sevRank = { critical: 4, high: 3, medium: 2, low: 1, info: 0 };
|
|
134
|
+
|
|
135
|
+
function confidenceOf(f) {
|
|
136
|
+
if (typeof f.confidence === 'number') return f.confidence >= 0.8 ? 'high' : f.confidence >= 0.5 ? 'medium' : 'low';
|
|
137
|
+
return typeof f.confidenceTier === 'string' ? f.confidenceTier : 'unknown';
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* @param {object} pkg a release package (E7-03). It is assumed to have been verified by the caller; the views carry `verification` as the caller states it.
|
|
142
|
+
* @param {{previous?:object, ranking?:object, verification?:{ok:boolean, errors?:object[]}}} opts `previous` is the previous release's package; `ranking` is a result of rankFleetExposure
|
|
143
|
+
*/
|
|
144
|
+
function buildCanonicalFindings(pkg) {
|
|
145
|
+
const entries = Array.isArray(pkg && pkg.evidence) ? pkg.evidence : [];
|
|
146
|
+
const byKind = (k) => entries.filter((e) => e.ref && e.ref.kind === k);
|
|
147
|
+
const fixes = byKind('fix-verification');
|
|
148
|
+
const out = [];
|
|
149
|
+
for (const e of byKind('finding')) {
|
|
150
|
+
const f = e.payload || {};
|
|
151
|
+
const id = e.ref.payloadId || f.stableId || f.id;
|
|
152
|
+
const fixesFor = fixes.filter((x) => x.payload && (x.payload.findingStableId === id || x.payload.findingId === id || x.payload.findingId === f.id) );
|
|
153
|
+
const fix = fixesFor.find((x) => x.payload.verifiedFull === true) || fixesFor[0] || null;
|
|
154
|
+
const status = !fix ? 'open' : fix.payload.verifiedFull === true ? 'fix-verified' : 'fix-unverified';
|
|
155
|
+
out.push({
|
|
156
|
+
id, evidenceHash: e.ref.digest, status, confidence: confidenceOf(f), severity: f.severity || 'info', proofTier: typeof f.proofTier === 'string' ? f.proofTier : 'unproven',
|
|
157
|
+
where: { file: f.file ?? null, line: Number.isInteger(f.line) ? f.line : null }, title: f.vuln || f.title || 'finding', cwe: f.cwe || null,
|
|
158
|
+
why: f.description || f.reason || null, how: f.remediation || null,
|
|
159
|
+
fix: fix ? { evidenceHash: fix.ref.digest, verifiedFull: fix.payload.verifiedFull === true, completeness: fix.payload.fixCompleteness || null, degradedLegs: Array.isArray(fix.payload.degradedLegs) ? fix.payload.degradedLegs.map((d) => (typeof d === 'string' ? d : d && d.leg) ).filter(Boolean) : [] } : null,
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
return out.sort((a, b) => (sevRank[b.severity] - sevRank[a.severity]) || (a.id < b.id ? -1 : a.id > b.id ? 1 : 0));
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function buildViews(pkg, { previous = null, ranking = null, verification = null } = {}) {
|
|
166
|
+
const findings = buildCanonicalFindings(pkg);
|
|
167
|
+
const packageDigest = `sha256:${(0,external_node_crypto_.createHash)('sha256').update(JSON.stringify(pkg && pkg.lineageOrder || [])).digest('hex')}`;
|
|
168
|
+
const prev = previous ? buildCanonicalFindings(previous) : null;
|
|
169
|
+
const prevById = prev ? new Map(prev.map((f) => [f.id, f])) : null;
|
|
170
|
+
const ids = new Set(findings.map((f) => f.id));
|
|
171
|
+
const change = prev ? {
|
|
172
|
+
new: findings.filter((f) => !prevById.has(f.id)).map((f) => f.id),
|
|
173
|
+
resolved: prev.filter((f) => !ids.has(f.id)).map((f) => f.id),
|
|
174
|
+
statusChanged: findings.filter((f) => prevById.has(f.id) && prevById.get(f.id).status !== f.status).map((f) => ({ id: f.id, from: prevById.get(f.id).status, to: f.status })),
|
|
175
|
+
unchanged: findings.filter((f) => prevById.has(f.id) && prevById.get(f.id).status === f.status).length,
|
|
176
|
+
} : null;
|
|
177
|
+
const rankById = ranking ? new Map(ranking.ranked.map((r) => [r.id, r])) : null;
|
|
178
|
+
const tier = (t) => findings.filter((f) => f.proofTier === t).length;
|
|
179
|
+
const completeness = pkg && pkg.completeness ? { verdict: pkg.completeness.verdict, scanStatus: pkg.completeness.scanStatus, conditions: pkg.completeness.conditions || [] } : { verdict: 'unknown', scanStatus: 'unknown', conditions: [] };
|
|
180
|
+
const unknowns = [];
|
|
181
|
+
if (completeness.verdict !== 'complete') for (const c of completeness.conditions.length ? completeness.conditions : ['the scan did not report that it finished']) unknowns.push({ about: 'scan completeness', reason: c, evidence: pkg.completeness && pkg.completeness.source ? [pkg.completeness.source] : [] });
|
|
182
|
+
for (const a of (pkg && pkg.assertions) || []) if (a.status !== 'supported') unknowns.push({ about: a.text, reason: a.reason || `the assertion is ${a.status}`, evidence: a.evidence || [] });
|
|
183
|
+
for (const f of findings) if (f.proofTier !== 'execution-proven') unknowns.push({ about: `exploitability of ${f.id}`, reason: `proof tier is ${f.proofTier}: it has not been shown to be exploitable`, evidence: [f.evidenceHash] });
|
|
184
|
+
|
|
185
|
+
const developer = findings.map((f) => ({ id: f.id, evidenceHash: f.evidenceHash, status: f.status, confidence: f.confidence, severity: f.severity, where: f.where, why: f.why, how: f.how, title: f.title, cwe: f.cwe, fix: f.fix }));
|
|
186
|
+
const verdict = releaseVerdict(pkg);
|
|
187
|
+
const ciso = {
|
|
188
|
+
verdict: { verdict: verdict.verdict, statement: verdict.statement, blockers: verdict.blockers.map((b) => b.message), unknowns: verdict.unknowns.map((u) => u.message) },
|
|
189
|
+
verified: verification ? verification.ok === true : null,
|
|
190
|
+
scan: completeness,
|
|
191
|
+
proven: { executionProven: tier('execution-proven'), taintProven: tier('taint-proven'), unproven: findings.length - tier('execution-proven') - tier('taint-proven'), total: findings.length },
|
|
192
|
+
bySeverity: Object.fromEntries(['critical', 'high', 'medium', 'low', 'info'].map((s) => [s, findings.filter((f) => f.severity === s).length])),
|
|
193
|
+
fixes: { verified: findings.filter((f) => f.status === 'fix-verified').length, unverified: findings.filter((f) => f.status === 'fix-unverified').length, open: findings.filter((f) => f.status === 'open').length },
|
|
194
|
+
changeSinceLast: change,
|
|
195
|
+
risk: ranking ? { byPriority: ranking.summary.byPriority, incompleteCoverage: ranking.summary.incompleteCoverage, top: ranking.ranked.slice(0, 5).map((r) => ({ id: r.id, priority: r.priority, rule: r.rule })) } : null,
|
|
196
|
+
findings: findings.map((f) => ({ id: f.id, evidenceHash: f.evidenceHash, status: f.status, confidence: f.confidence, severity: f.severity, proofTier: f.proofTier, priority: rankById && rankById.get(f.id) ? rankById.get(f.id).priority : null })),
|
|
197
|
+
};
|
|
198
|
+
const auditor = {
|
|
199
|
+
package: { lineageDigest: packageDigest, snapshot: pkg && pkg.snapshot ? { commit: pkg.snapshot.commit, immutable: pkg.snapshot.immutable, digest: pkg.snapshot.digest } : null },
|
|
200
|
+
issuer: pkg && pkg.issuance ? { trustBasis: pkg.issuance.trustBasis, independentlyCertified: pkg.issuance.independentlyCertified, keyFingerprint: pkg.issuance.issuer && pkg.issuance.issuer.keyFingerprint } : null,
|
|
201
|
+
verification: verification ? { ok: verification.ok === true, errors: (verification.errors || []).map((e) => `${e.code}: ${e.message}`) } : { ok: null, errors: ['no verification was performed by this view'] },
|
|
202
|
+
proves: pkg && pkg.proves || null, doesNotProve: pkg && pkg.doesNotProve || null,
|
|
203
|
+
assertions: ((pkg && pkg.assertions) || []).map((a) => ({ id: a.id, text: a.text, status: a.status, evidence: a.evidence || [], reason: a.reason || null })),
|
|
204
|
+
unknowns,
|
|
205
|
+
findings: findings.map((f) => ({ id: f.id, evidenceHash: f.evidenceHash, status: f.status, confidence: f.confidence, proofTier: f.proofTier, fixEvidence: f.fix ? f.fix.evidenceHash : null })),
|
|
206
|
+
policyDecisions: (pkg && pkg.policy && pkg.policy.decisions) || [],
|
|
207
|
+
};
|
|
208
|
+
return { canonical: findings, developer, ciso, auditor };
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// ---- text ------------------------------------------------------------------------------------------------------------------------
|
|
212
|
+
|
|
213
|
+
function renderText(views, view = 'all') {
|
|
214
|
+
const L = [];
|
|
215
|
+
const dev = () => { L.push('DEVELOPER VIEW'); for (const f of views.developer) { L.push(` [${f.severity}] ${f.title} ${f.where.file ?? '?'}:${f.where.line ?? '?'} id=${f.id} status=${f.status} confidence=${f.confidence} evidence=${f.evidenceHash.slice(0, 19)}`); if (f.why) L.push(` why: ${String(f.why).slice(0, 300)}`); if (f.how) L.push(` fix: ${String(f.how).slice(0, 300)}`); if (f.fix) L.push(` fix check: ${f.fix.verifiedFull ? 'verified' : 'not fully verified'}${f.fix.degradedLegs.length ? ` (not passed: ${f.fix.degradedLegs.join(', ')})` : ''}`); } if (!views.developer.length) L.push(' no findings'); };
|
|
216
|
+
const ciso = () => { const c = views.ciso; L.push('CISO VIEW'); L.push(` release verdict: ${c.verdict.verdict}. ${c.verdict.statement}`); for (const b of c.verdict.blockers) L.push(` blocks: ${b}`); for (const u of c.verdict.unknowns) L.push(` unknown: ${u}`); L.push(` scan: ${c.scan.verdict} (${c.scan.scanStatus})${c.scan.conditions.length ? ' - ' + c.scan.conditions.join('; ') : ''}`); L.push(` proven: ${c.proven.executionProven} executed, ${c.proven.taintProven} taint path, ${c.proven.unproven} unproven, of ${c.proven.total}`); L.push(` fixes: ${c.fixes.verified} verified, ${c.fixes.unverified} unverified, ${c.fixes.open} open`); if (c.changeSinceLast) L.push(` since last release: ${c.changeSinceLast.new.length} new, ${c.changeSinceLast.resolved.length} resolved, ${c.changeSinceLast.statusChanged.length} changed status`); else L.push(' since last release: no previous release was supplied'); if (c.risk) L.push(` risk: ${JSON.stringify(c.risk.byPriority)}; ${c.risk.incompleteCoverage} with incomplete coverage`); L.push(` verification: ${c.verified === null ? 'not performed here' : c.verified ? 'signature and contents verified' : 'FAILED'}`); };
|
|
217
|
+
const aud = () => { const a = views.auditor; L.push('AUDITOR VIEW'); L.push(` snapshot: ${a.package.snapshot ? `${a.package.snapshot.commit ?? 'no commit'} (${a.package.snapshot.immutable ? 'immutable' : 'NOT immutable'})` : 'none'}`); L.push(` issuer: ${a.issuer ? `${a.issuer.trustBasis}, independently certified: ${a.issuer.independentlyCertified}` : 'none'}`); L.push(` verification: ${a.verification.ok === null ? 'not performed here' : a.verification.ok ? 'ok' : 'FAILED: ' + a.verification.errors.join('; ')}`); for (const x of a.assertions) L.push(` assertion ${x.id} [${x.status}]: ${x.text} evidence=${x.evidence.map((d) => d.slice(0, 19)).join(',') || 'none'}`); for (const u of a.unknowns) L.push(` unknown: ${u.about} - ${u.reason}`); L.push(` does not prove: ${a.doesNotProve}`); };
|
|
218
|
+
if (view === 'developer' || view === 'all') dev();
|
|
219
|
+
if (view === 'ciso' || view === 'all') ciso();
|
|
220
|
+
if (view === 'auditor' || view === 'all') aud();
|
|
221
|
+
return L.join('\n') + '\n';
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// ---- html ------------------------------------------------------------------------------------------------------------------------
|
|
225
|
+
|
|
226
|
+
/** One self-contained page, no script, nothing loaded from elsewhere. Every value is escaped. */
|
|
227
|
+
function renderHtml(views, { title = 'Release assurance report' } = {}) {
|
|
228
|
+
const c = views.ciso; const a = views.auditor;
|
|
229
|
+
const row = (f, cols) => `<tr data-finding="${esc(f.id)}" data-evidence="${esc(f.evidenceHash)}" data-status="${esc(f.status)}" data-confidence="${esc(f.confidence)}">${cols.map((x) => `<td>${x}</td>`).join('')}</tr>`;
|
|
230
|
+
return `<!doctype html>
|
|
231
|
+
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">
|
|
232
|
+
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src 'unsafe-inline'; img-src data:">
|
|
233
|
+
<title>${esc(title)}</title>
|
|
234
|
+
<style>
|
|
235
|
+
:root{--bg:#fff;--fg:#1a1a1a;--muted:#555;--line:#d0d0d0;--bad:#a40000;--ok:#0a6b2b}
|
|
236
|
+
@media (prefers-color-scheme: dark){:root{--bg:#14161a;--fg:#e8e8e8;--muted:#a0a0a0;--line:#3a3d44;--bad:#ff8080;--ok:#6fd48e}}
|
|
237
|
+
body{background:var(--bg);color:var(--fg);font:15px/1.5 system-ui,sans-serif;margin:0 auto;max-width:72rem;padding:1rem 16px}
|
|
238
|
+
h1,h2{line-height:1.2}table{border-collapse:collapse;width:100%;overflow-wrap:anywhere}th,td{border:1px solid var(--line);padding:.35rem .5rem;text-align:left;vertical-align:top}
|
|
239
|
+
code{font-family:ui-monospace,monospace;font-size:.9em}.muted{color:var(--muted)}.bad{color:var(--bad)}.ok{color:var(--ok)}details{margin:1rem 0}summary{cursor:pointer;font-weight:600}
|
|
240
|
+
</style></head><body>
|
|
241
|
+
<h1>${esc(title)}</h1>
|
|
242
|
+
<p class="muted">Snapshot ${esc(a.package.snapshot ? a.package.snapshot.commit : 'none')} (${a.package.snapshot && a.package.snapshot.immutable ? 'immutable' : 'not immutable'}). Verification: <span class="${a.verification.ok === true ? 'ok' : 'bad'}">${esc(a.verification.ok === null ? 'not performed by this page' : a.verification.ok ? 'passed' : 'FAILED')}</span>.</p>
|
|
243
|
+
<details open><summary>Developer: where, why, how to fix</summary>
|
|
244
|
+
<table><thead><tr><th>Finding</th><th>Where</th><th>Why</th><th>How to fix</th><th>Status</th><th>Confidence</th></tr></thead><tbody>
|
|
245
|
+
${views.developer.map((f) => row(f, [`<code>${esc(f.id)}</code> ${esc(f.title)}<br><span class="muted">${esc(f.severity)}${f.cwe ? ' ' + esc(f.cwe) : ''}</span>`, `<code>${esc(f.where.file ?? '?')}:${esc(f.where.line ?? '?')}</code>`, esc(f.why ?? ''), esc(f.how ?? ''), esc(f.status), esc(f.confidence)])).join('\n') || '<tr><td colspan="6">No findings.</td></tr>'}
|
|
246
|
+
</tbody></table></details>
|
|
247
|
+
<details open><summary>CISO: what is proven, what changed, risk and coverage</summary>
|
|
248
|
+
<p><strong>Release verdict: ${esc(c.verdict.verdict)}.</strong> ${esc(c.verdict.statement)}</p>
|
|
249
|
+
<ul>${c.verdict.blockers.map((b) => `<li class="bad">Blocks: ${esc(b)}</li>`).join('')}${c.verdict.unknowns.map((u) => `<li>Unknown: ${esc(u)}</li>`).join('')}</ul>
|
|
250
|
+
<p>Scan: <strong>${esc(c.scan.verdict)}</strong> (${esc(c.scan.scanStatus)}). ${c.scan.conditions.map((x) => esc(x)).join('; ')}</p>
|
|
251
|
+
<p>Proven: ${esc(c.proven.executionProven)} by execution, ${esc(c.proven.taintProven)} by a taint path, ${esc(c.proven.unproven)} unproven, of ${esc(c.proven.total)}. Fixes: ${esc(c.fixes.verified)} verified, ${esc(c.fixes.unverified)} unverified, ${esc(c.fixes.open)} open.</p>
|
|
252
|
+
<p>${c.changeSinceLast ? `Since the previous release: ${esc(c.changeSinceLast.new.length)} new, ${esc(c.changeSinceLast.resolved.length)} resolved, ${esc(c.changeSinceLast.statusChanged.length)} changed status.` : 'No previous release was supplied, so no change is reported.'}</p>
|
|
253
|
+
<table><thead><tr><th>Finding</th><th>Severity</th><th>Proof</th><th>Priority</th><th>Status</th><th>Confidence</th></tr></thead><tbody>
|
|
254
|
+
${c.findings.map((f) => row(f, [`<code>${esc(f.id)}</code>`, esc(f.severity), esc(f.proofTier), esc(f.priority ?? 'not ranked'), esc(f.status), esc(f.confidence)])).join('\n') || '<tr><td colspan="6">No findings.</td></tr>'}
|
|
255
|
+
</tbody></table></details>
|
|
256
|
+
<details open><summary>Auditor: evidence behind each statement, and what is unknown</summary>
|
|
257
|
+
<p>Issuer: ${esc(a.issuer ? a.issuer.trustBasis : 'none')}; independently certified: ${esc(a.issuer ? a.issuer.independentlyCertified : 'n/a')}.</p>
|
|
258
|
+
<p class="muted">Proves: ${esc(a.proves)}<br>Does not prove: ${esc(a.doesNotProve)}</p>
|
|
259
|
+
<table><thead><tr><th>Finding</th><th>Evidence hash</th><th>Fix evidence</th><th>Status</th><th>Confidence</th></tr></thead><tbody>
|
|
260
|
+
${a.findings.map((f) => row(f, [`<code>${esc(f.id)}</code>`, `<code>${esc(f.evidenceHash)}</code>`, `<code>${esc(f.fixEvidence ?? 'none')}</code>`, esc(f.status), esc(f.confidence)])).join('\n') || '<tr><td colspan="5">No findings.</td></tr>'}
|
|
261
|
+
</tbody></table>
|
|
262
|
+
<h2>Assertions</h2><ul>${a.assertions.map((x) => `<li><strong>${esc(x.status)}</strong>: ${esc(x.text)} <span class="muted">(${x.evidence.length ? x.evidence.map((d) => `<code>${esc(d)}</code>`).join(', ') : 'no evidence cited'}${x.reason ? '; ' + esc(x.reason) : ''})</span></li>`).join('') || '<li>None.</li>'}</ul>
|
|
263
|
+
<h2>Unknowns</h2><ul>${a.unknowns.map((u) => `<li>${esc(u.about)}: ${esc(u.reason)}</li>`).join('') || '<li>None.</li>'}</ul>
|
|
264
|
+
</details></body></html>
|
|
265
|
+
`;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
/***/ })
|
|
270
|
+
|
|
271
|
+
};
|
|
@@ -0,0 +1,305 @@
|
|
|
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
|
+
};
|