@clear-capabilities/agentic-security-scanner 0.162.0 → 0.163.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 +26 -0
- package/bin/agentic-security.js +87 -0
- package/dist/1340.index.js +1871 -0
- package/dist/3477.index.js +727 -0
- package/dist/3499.index.js +23 -3
- package/dist/4113.index.js +1 -1
- package/dist/5014.index.js +833 -0
- package/dist/5756.index.js +2 -2
- package/dist/6257.index.js +1 -1
- package/dist/6907.index.js +248 -0
- package/dist/6994.index.js +1 -1
- package/dist/7033.index.js +33 -5
- package/dist/7439.index.js +1822 -0
- package/dist/7838.index.js +1 -1
- package/dist/9560.index.js +2318 -23
- package/dist/957.index.js +1 -1
- package/dist/9999.index.js +43 -7
- package/dist/agentic-security.mjs +12 -12
- package/dist/agentic-security.mjs.sha256 +1 -1
- package/package.json +33 -6
- package/src/capabilities/CLAUDE.md +114 -0
- package/src/capabilities/address.js +73 -0
- package/src/capabilities/attack-coverage.js +93 -0
- package/src/capabilities/decide.js +256 -0
- package/src/capabilities/delegate.js +69 -0
- package/src/capabilities/egress.js +20 -0
- package/src/capabilities/hook-advice.js +50 -0
- package/src/capabilities/index.js +32 -0
- package/src/capabilities/manifest.js +344 -0
- package/src/capabilities/outbound.js +189 -0
- package/src/capabilities/paths.js +57 -0
- package/src/capabilities/probes.js +211 -0
- package/src/capabilities/proxy.js +182 -0
- package/src/capabilities/reasons.js +67 -0
- package/src/capabilities/receipts.js +356 -0
- package/src/capabilities/records.js +58 -0
- package/src/capabilities/recovery.js +367 -0
- package/src/capabilities/report.js +81 -0
- package/src/capabilities/runner.js +236 -0
- package/src/capabilities/secrets.js +26 -0
- package/src/capabilities/tool-gate.js +119 -0
- package/src/capabilities/tool-registry.js +60 -0
- package/src/dataflow/CLAUDE.md +29 -0
- package/src/dataflow/catalog.js +21 -0
- package/src/dataflow/engine.js +20 -0
- package/src/dataflow/guard-dominance.js +352 -0
- package/src/discovery/CLAUDE.md +9 -0
- package/src/discovery/index.js +15 -1
- package/src/discovery/lenses.js +18 -0
- package/src/engine.js +80 -15
- package/src/integrations/index.js +5 -2
- package/src/ir/CLAUDE.md +14 -0
- package/src/ir/implicit-handler-params.js +74 -0
- package/src/ir/parser-cs.js +20 -0
- package/src/ir/parser-go.js +30 -13
- package/src/ir/parser-java.js +11 -0
- package/src/language/nix-eval-isolation.js +33 -5
- package/src/lineage/CLAUDE.md +31 -0
- package/src/lineage/deployment/adapter-cloud.js +202 -0
- package/src/lineage/deployment/adapter-compose.js +90 -0
- package/src/lineage/deployment/adapter-kit.js +142 -0
- package/src/lineage/deployment/adapter-kubernetes.js +247 -0
- package/src/lineage/deployment/attack-paths.js +443 -0
- package/src/lineage/deployment/boundaries-run.js +223 -0
- package/src/lineage/deployment/boundary-graph.js +567 -0
- package/src/lineage/deployment/cross-repo.js +253 -0
- package/src/lineage/deployment/drift.js +383 -0
- package/src/lineage/deployment/ingest.js +221 -0
- package/src/lineage/deployment/projection.js +244 -0
- package/src/lineage/deployment/trace-correlation.js +541 -0
- package/src/lineage/source-registry.js +19 -0
- package/src/mcp/CLAUDE.md +5 -2
- package/src/mcp/invariant-tools.js +64 -0
- package/src/mcp/portfolio-tools.js +79 -0
- package/src/mcp/redact.js +15 -0
- package/src/mcp/server.js +24 -3
- package/src/mcp/tools.js +13 -1
- package/src/posture/CLAUDE.md +332 -1
- package/src/posture/accuracy-scorecard.js +95 -4
- package/src/posture/assurance/rollback.js +214 -0
- package/src/posture/assurance/rollout.js +200 -0
- package/src/posture/business-logic.js +26 -4
- package/src/posture/evaluation/bakeoff.js +148 -0
- package/src/posture/evaluation/custody.js +200 -0
- package/src/posture/evaluation/deployment-ablation.js +416 -0
- package/src/posture/evaluation/dev-cases.js +65 -0
- package/src/posture/evaluation/economics.js +85 -0
- package/src/posture/evaluation/gates.js +161 -0
- package/src/posture/evaluation/grouping.js +101 -0
- package/src/posture/evaluation/interval.js +132 -0
- package/src/posture/evaluation/invariant-ablation.js +325 -0
- package/src/posture/evaluation/labels.js +200 -0
- package/src/posture/evaluation/protocol.js +308 -0
- package/src/posture/evaluation/release-gate.js +209 -0
- package/src/posture/evaluation/report.js +158 -0
- package/src/posture/evaluation/runner.js +273 -0
- package/src/posture/evaluation/scan-child.js +80 -0
- package/src/posture/evaluation/score.js +174 -0
- package/src/posture/evaluation/synthetic.js +90 -0
- package/src/posture/evaluation/why-missed.js +219 -0
- package/src/posture/fleet.js +11 -2
- package/src/posture/invariants/cli.js +95 -0
- package/src/posture/invariants/coverage.js +164 -0
- package/src/posture/invariants/export.js +178 -0
- package/src/posture/invariants/expressions.js +46 -0
- package/src/posture/invariants/lifecycle.js +289 -0
- package/src/posture/invariants/project-input.js +55 -0
- package/src/posture/invariants/repair.js +340 -0
- package/src/posture/invariants/run.js +45 -0
- package/src/posture/invariants/scenarios.js +311 -0
- package/src/posture/invariants/schema.js +167 -0
- package/src/posture/invariants/shrink.js +407 -0
- package/src/posture/invariants/state-assertions.js +165 -0
- package/src/posture/logic-claims.js +12 -0
- package/src/posture/model-routing.js +40 -0
- package/src/posture/oracles/adapters.js +172 -1
- package/src/posture/oracles/conformance.js +3 -2
- package/src/posture/oracles/oracle.js +23 -3
- package/src/posture/oracles/registry.js +1 -1
- package/src/posture/portfolio/backend.js +279 -0
- package/src/posture/portfolio/bundle.js +314 -0
- package/src/posture/portfolio/cli.js +142 -0
- package/src/posture/portfolio/manifest.js +263 -0
- package/src/posture/portfolio/progress.js +267 -0
- package/src/posture/portfolio/resume.js +130 -0
- package/src/posture/portfolio/retention.js +207 -0
- package/src/posture/portfolio/scheduler.js +488 -0
- package/src/posture/portfolio/signing.js +155 -0
- package/src/posture/portfolio/wording.js +59 -0
- package/src/posture/portfolio/work-units.js +405 -0
- package/src/posture/replay/replay.js +1 -0
- package/src/posture/routing/adapter.js +140 -0
- package/src/posture/routing/calibration.js +278 -0
- package/src/posture/routing/canary.js +141 -0
- package/src/posture/routing/control.js +35 -0
- package/src/posture/routing/decide.js +211 -0
- package/src/posture/routing/drift.js +137 -0
- package/src/posture/routing/economics.js +185 -0
- package/src/posture/routing/feedback.js +207 -0
- package/src/posture/routing/index.js +31 -0
- package/src/posture/routing/outcomes.js +281 -0
- package/src/posture/routing/promotion.js +291 -0
- package/src/posture/routing/receipts.js +59 -0
- package/src/posture/routing/report.js +142 -0
- package/src/posture/routing/shadow.js +53 -0
- package/src/posture/specification-mining.js +26 -0
- package/src/posture/verification/patch-negative.js +16 -4
- package/src/posture/verification/patch-promotion.js +10 -2
- package/src/report/index.js +51 -1
- package/src/sandbox/CLAUDE.md +10 -0
- package/src/sandbox/backend-userspace.js +91 -13
- package/dist/5613.index.js +0 -500
- package/dist/6239.index.js +0 -469
package/dist/5756.index.js
CHANGED
|
@@ -25,8 +25,8 @@ var external_node_fs_ = __webpack_require__(73024);
|
|
|
25
25
|
var external_node_path_ = __webpack_require__(76760);
|
|
26
26
|
// EXTERNAL MODULE: ./src/mcp/validate.js
|
|
27
27
|
var validate = __webpack_require__(61211);
|
|
28
|
-
// EXTERNAL MODULE: ./src/egress/redact.js
|
|
29
|
-
var redact = __webpack_require__(
|
|
28
|
+
// EXTERNAL MODULE: ./src/egress/redact.js
|
|
29
|
+
var redact = __webpack_require__(11723);
|
|
30
30
|
;// CONCATENATED MODULE: ./src/llm-validator/agent-tools.js
|
|
31
31
|
// PRD §18.2/§18.3 — the bounded local agent loop's tool registry.
|
|
32
32
|
//
|
package/dist/6257.index.js
CHANGED
|
@@ -10,7 +10,7 @@ export const modules = {
|
|
|
10
10
|
/* harmony export */ proposeOllamaFix: () => (/* binding */ proposeOllamaFix)
|
|
11
11
|
/* harmony export */ });
|
|
12
12
|
/* unused harmony export buildFixPrompt */
|
|
13
|
-
/* harmony import */ var _egress_redact_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(
|
|
13
|
+
/* harmony import */ var _egress_redact_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(11723);
|
|
14
14
|
/* harmony import */ var _egress_policy_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(45712);
|
|
15
15
|
/* harmony import */ var _providers_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(38947);
|
|
16
16
|
/* harmony import */ var _ollama_provider_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(23837);
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
export const id = 6907;
|
|
2
|
+
export const ids = [6907];
|
|
3
|
+
export const modules = {
|
|
4
|
+
|
|
5
|
+
/***/ 26907:
|
|
6
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
7
|
+
|
|
8
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
9
|
+
/* harmony export */ verifyPatchNegative: () => (/* binding */ verifyPatchNegative)
|
|
10
|
+
/* harmony export */ });
|
|
11
|
+
/* harmony import */ var _assurance_identity_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(41877);
|
|
12
|
+
/* harmony import */ var _assurance_schema_kit_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(53353);
|
|
13
|
+
/* harmony import */ var _assurance_config_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(90385);
|
|
14
|
+
/* harmony import */ var _replay_replay_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(37098);
|
|
15
|
+
/* harmony import */ var _oracles_registry_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(18357);
|
|
16
|
+
/* harmony import */ var _patch_promotion_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(51487);
|
|
17
|
+
/* harmony import */ var _repair_records_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(38899);
|
|
18
|
+
// Patch-negative verification (X-204).
|
|
19
|
+
//
|
|
20
|
+
// A re-scan that no longer fires proves the DETECTOR went quiet; a cosmetic edit can do that. A repair is `verified-fix` here
|
|
21
|
+
// only when three things are shown, each by an executed oracle run in an equivalent disposable environment:
|
|
22
|
+
//
|
|
23
|
+
// 1. original-positive the original revision reproduces the exploit (oracle outcome: confirmed)
|
|
24
|
+
// 2. patched-negative the patched revision no longer does, same oracle (oracle outcome: refuted)
|
|
25
|
+
// 3. functional-regression declared legitimate behaviour is intact on the patched revision, with the same expectations
|
|
26
|
+
// holding on the original first (a baseline), so a wrong expectation is reported rather than blamed on the patch.
|
|
27
|
+
//
|
|
28
|
+
// All four runs (the baseline is one) go through `replayManifest`, so each is pinned by commit, fixture hash, patch hash,
|
|
29
|
+
// toolchain, oracle version and inputs, executes inside the trust boundary, and issues a verifier receipt. The result is then
|
|
30
|
+
// handed to `promotePatch`, which re-derives the diff and revision from the proposal and refuses any receipt that does not
|
|
31
|
+
// match them. `verified-fix` needs the promotion; nothing else grants it.
|
|
32
|
+
//
|
|
33
|
+
// A failure never degrades to a vague "not verified": it names the SPECIFIC step that is incomplete and a typed failure code:
|
|
34
|
+
// original-not-reproduced the original did not reproduce under the oracle (nothing to fix, or the scenario is wrong)
|
|
35
|
+
// patched-still-exploitable the exploit still works on the patched revision
|
|
36
|
+
// patched-build-broken the patched revision did not load or its benign control failed
|
|
37
|
+
// patched-negative-inconclusive the patched run decided nothing
|
|
38
|
+
// functional-omitted no functional check was supplied
|
|
39
|
+
// functional-baseline-invalid the declared expectations do not hold on the ORIGINAL revision
|
|
40
|
+
// functional-regression-detected the patched revision behaves differently from the declared expectations
|
|
41
|
+
// oracle-changed the oracle, its version or its inputs differ between the original and patched runs
|
|
42
|
+
// revision-unbound no exact commit: a verdict cannot be tied to a revision
|
|
43
|
+
// prerequisite-unmet a toolchain, feature or isolation prerequisite is missing; resumable where stated
|
|
44
|
+
// environment-mismatch the runs were not in equivalent environments
|
|
45
|
+
// promotion-refused the receipts do not match the exact proposed diff and revision
|
|
46
|
+
//
|
|
47
|
+
// The behaviour check is the functional-regression oracle by default. A requester may name `business-state` as `functional.oracleId`
|
|
48
|
+
// (X-406, `invariants/repair.js`): the same two runs and the same expectation, with an authorized-workflow scenario as the declared
|
|
49
|
+
// case, and `promotePatch` then requires the functional receipts to come from that oracle class instead.
|
|
50
|
+
//
|
|
51
|
+
// Scope, stated so no caller overclaims: the exploit scenario and the functional cases are the REQUESTER's; this verifies the
|
|
52
|
+
// declared scenario and cases, not that the patch is correct elsewhere. Linux is not claimed (the oracle platform statements
|
|
53
|
+
// stay `unverified`). Receipts are valid inside this process only (see patch-promotion.js).
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
const PATCH_NEGATIVE_FEATURE = 'patch-negative-verification';
|
|
63
|
+
const FUNCTIONAL_ORACLE = 'functional-regression';
|
|
64
|
+
// The check that behaviour is preserved is normally the functional-regression oracle. A requester may name `business-state`
|
|
65
|
+
// instead (X-406): the same two runs, the same expectation (refuted), with an authorized-workflow scenario as the declared case.
|
|
66
|
+
const FUNCTIONAL_ORACLES = Object.freeze([FUNCTIONAL_ORACLE, 'business-state']);
|
|
67
|
+
|
|
68
|
+
const STEPS = Object.freeze(['original-positive', 'patched-negative', 'functional-baseline', 'functional-regression']);
|
|
69
|
+
|
|
70
|
+
const ROLE_OF_STEP = Object.freeze({ 'original-positive': 'original', 'patched-negative': 'patched', 'functional-baseline': 'functionalBaseline', 'functional-regression': 'functional' });
|
|
71
|
+
const EXPECTED = Object.freeze({ 'original-positive': 'confirmed', 'patched-negative': 'refuted', 'functional-baseline': 'refuted', 'functional-regression': 'refuted' });
|
|
72
|
+
|
|
73
|
+
const stepResult = (step, status, extra = {}) => ({ step, status, expected: EXPECTED[step], outcome: null, code: null, reason: null, recordId: null, receiptDigest: null, ...extra });
|
|
74
|
+
|
|
75
|
+
function replayCode(run) {
|
|
76
|
+
const first = (run.errors || [])[0];
|
|
77
|
+
if (!first) return 'manifest-rejected';
|
|
78
|
+
if (first.code === 'ORACLE_MISMATCH') return 'oracle-changed';
|
|
79
|
+
if (first.code === 'HASH_MISMATCH') return 'content-hash-mismatch';
|
|
80
|
+
return 'manifest-rejected';
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function classify(step, run) {
|
|
84
|
+
if (run.status === 'rejected') return { status: 'incomplete', code: replayCode(run), reason: (run.errors || []).map((e) => e.message).join('; ').slice(0, 300) || 'the replay manifest was rejected' };
|
|
85
|
+
if (run.status === 'awaiting-prerequisites') {
|
|
86
|
+
const resumable = (run.prerequisites || []).every((p) => p.resumable);
|
|
87
|
+
return { status: 'incomplete', code: 'prerequisite-unmet', outcome: run.outcome ?? null, resumable, reason: `${(run.prerequisites || []).map((p) => `${p.kind} ${p.id} (${p.state})`).join('; ') || 'a prerequisite is unmet'}; nothing was executed${resumable ? ' (resumable)' : ''}` };
|
|
88
|
+
}
|
|
89
|
+
const outcome = run.outcome;
|
|
90
|
+
const observed = run.receipt?.observed || {};
|
|
91
|
+
// a business-state run reports its control flow under `preconditions`: a control flow that no longer works is a broken revision
|
|
92
|
+
const loadBroken = observed.targetLoaded === false || observed.benignCompleted === false || observed.preconditions?.controlRan === false || observed.preconditions?.controlDurableEffect === false;
|
|
93
|
+
if (outcome === 'error') return { status: 'incomplete', code: 'harness-error', reason: String(run.record?.reason || 'the oracle run failed').slice(0, 300), outcome };
|
|
94
|
+
if (outcome === EXPECTED[step]) return { status: 'passed', code: null, reason: run.record?.reason ?? null, outcome };
|
|
95
|
+
const reason = String(run.record?.reason || '').slice(0, 300);
|
|
96
|
+
switch (step) {
|
|
97
|
+
case 'original-positive':
|
|
98
|
+
return { status: 'failed', code: 'original-not-reproduced', reason: `the original revision did not reproduce the exploit (outcome '${outcome}'): ${reason}`, outcome };
|
|
99
|
+
case 'patched-negative':
|
|
100
|
+
if (outcome === 'confirmed') return { status: 'failed', code: 'patched-still-exploitable', reason: `the exploit still works on the patched revision: ${reason}`, outcome };
|
|
101
|
+
return loadBroken
|
|
102
|
+
? { status: 'failed', code: 'patched-build-broken', reason: `the patched revision did not load or its benign control failed: ${reason}`, outcome }
|
|
103
|
+
: { status: 'failed', code: 'patched-negative-inconclusive', reason: `the patched run decided nothing (outcome '${outcome}'): ${reason}`, outcome };
|
|
104
|
+
case 'functional-baseline':
|
|
105
|
+
return { status: 'failed', code: 'functional-baseline-invalid', reason: `the declared functional expectations do not hold on the original revision (outcome '${outcome}'): ${reason}`, outcome };
|
|
106
|
+
default:
|
|
107
|
+
if (outcome === 'confirmed') return { status: 'failed', code: 'functional-regression-detected', reason: `the patched revision behaves differently from the declared expectations: ${reason}`, outcome };
|
|
108
|
+
return loadBroken
|
|
109
|
+
? { status: 'failed', code: 'patched-build-broken', reason: `the patched revision did not load for the functional check: ${reason}`, outcome }
|
|
110
|
+
: { status: 'failed', code: 'functional-inconclusive', reason: `the functional check decided nothing (outcome '${outcome}'): ${reason}`, outcome };
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function summaryOf(steps, verified, incomplete, code) {
|
|
115
|
+
const label = (s) => ({ passed: 'PASS', failed: 'FAIL', incomplete: 'INCOMPLETE', 'not-run': 'not run' })[s.status];
|
|
116
|
+
const lines = steps.map((s) => `${s.step}: ${label(s)}${s.code ? ` (${s.code})` : ''}${s.reason && s.status !== 'passed' ? ` - ${s.reason}` : ''}`);
|
|
117
|
+
lines.push(verified
|
|
118
|
+
? 'verified-fix: the exploit reproduced on the original revision, did not reproduce on the patched revision, and the declared functional cases still hold. Only the declared scenario and cases were exercised.'
|
|
119
|
+
: `NOT verified-fix: incomplete step '${incomplete}'${code ? ` (${code})` : ''}.`);
|
|
120
|
+
return lines.join('\n');
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Run the three-part patch-negative verification for one proposed patch. Never throws.
|
|
125
|
+
*
|
|
126
|
+
* @param {object} req
|
|
127
|
+
* @param {string} req.hypothesisId the finding's stable id
|
|
128
|
+
* @param {string} req.commit exact revision the patch is proposed against (40 or 64 hex)
|
|
129
|
+
* @param {object} req.original { files, entry, oracleId, inputs, budgets? } the exploit scenario on the original files
|
|
130
|
+
* @param {object} req.patch { files } the proposed diff: the new content of each changed file
|
|
131
|
+
* @param {object} [req.patched] { oracleId?, inputs?, entry? }: must equal the original's; anything else is `oracle-changed`
|
|
132
|
+
* @param {object} [req.functional] { inputs, budgets? } for the functional-regression oracle; omitting it prevents verified-fix
|
|
133
|
+
* @param {object} [req.pinnedOracle] { id, version, logicDigest } the oracle identity the requester recorded earlier
|
|
134
|
+
* @param {object[]} [req.ledger] earlier repair records to extend
|
|
135
|
+
* @param {object} [o] { config, runOptions } config is the assurance config; runOptions go to the oracle runner (test seams)
|
|
136
|
+
*/
|
|
137
|
+
async function verifyPatchNegative(req, o = {}) {
|
|
138
|
+
const config = o.config || (0,_assurance_config_js__WEBPACK_IMPORTED_MODULE_2__.resolveAssuranceConfig)({ env: process.env });
|
|
139
|
+
const gate = (0,_assurance_config_js__WEBPACK_IMPORTED_MODULE_2__/* .featureStatus */ .FX)(config, PATCH_NEGATIVE_FEATURE);
|
|
140
|
+
const steps = STEPS.map((s) => stepResult(s, 'not-run', { reason: 'not reached' }));
|
|
141
|
+
const base = {
|
|
142
|
+
status: 'not-verified-fix', verifiedFix: false, incompleteStep: null, failureCode: null, reason: null, steps,
|
|
143
|
+
patchDigest: null, promotion: null, receipts: null, records: {}, verificationRecord: null, repairRecords: Array.isArray(req?.ledger) ? req.ledger : [], summary: '',
|
|
144
|
+
};
|
|
145
|
+
if (gate.status !== 'ok') {
|
|
146
|
+
return { ...base, status: 'disabled', incompleteStep: 'feature-gate', failureCode: gate.code || 'disabled', reason: `${PATCH_NEGATIVE_FEATURE} is not available: ${gate.reason}`, summary: `patch-negative verification did not run: ${gate.reason}` };
|
|
147
|
+
}
|
|
148
|
+
const refuse = (step, code, reason, extra = {}) => {
|
|
149
|
+
const rejected = req && (0,_assurance_schema_kit_js__WEBPACK_IMPORTED_MODULE_1__/* .isPlainObject */ .Qd)(req.patch) && (0,_assurance_schema_kit_js__WEBPACK_IMPORTED_MODULE_1__/* .isPlainObject */ .Qd)(req.patch.files) && Object.keys(req.patch.files).length && typeof req.hypothesisId === 'string'
|
|
150
|
+
? ledgerFor(base.repairRecords, req, base.patchDigest ?? (0,_assurance_identity_js__WEBPACK_IMPORTED_MODULE_0__/* .digestOf */ .ol)(req.patch.files), { rejected: { step, code, reason } }) : { records: base.repairRecords };
|
|
151
|
+
return { ...base, ...extra, patchDigest: req?.patch?.files ? (0,_assurance_identity_js__WEBPACK_IMPORTED_MODULE_0__/* .digestOf */ .ol)(req.patch.files) : null, incompleteStep: step, failureCode: code, reason, repairRecords: rejected.records, summary: summaryOf(steps, false, step, code) };
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
// ---- shape and preconditions that need no execution
|
|
155
|
+
const patchFiles = req?.patch?.files;
|
|
156
|
+
if (!(0,_assurance_schema_kit_js__WEBPACK_IMPORTED_MODULE_1__/* .isPlainObject */ .Qd)(req) || typeof req.hypothesisId !== 'string' || !req.hypothesisId || !(0,_assurance_schema_kit_js__WEBPACK_IMPORTED_MODULE_1__/* .isPlainObject */ .Qd)(req.original) || !(0,_assurance_schema_kit_js__WEBPACK_IMPORTED_MODULE_1__/* .isPlainObject */ .Qd)(req.original.files)
|
|
157
|
+
|| typeof req.original.entry !== 'string' || typeof req.original.oracleId !== 'string' || !(0,_assurance_schema_kit_js__WEBPACK_IMPORTED_MODULE_1__/* .isPlainObject */ .Qd)(req.original.inputs)
|
|
158
|
+
|| !(0,_assurance_schema_kit_js__WEBPACK_IMPORTED_MODULE_1__/* .isPlainObject */ .Qd)(patchFiles) || Object.keys(patchFiles).length === 0) {
|
|
159
|
+
return refuse('input-validation', 'bad-request', 'a request needs a hypothesis id, the original files, entry, oracle and inputs, and a non-empty patch');
|
|
160
|
+
}
|
|
161
|
+
if (!(0,_assurance_schema_kit_js__WEBPACK_IMPORTED_MODULE_1__/* .isCommit */ .WM)(req.commit)) return refuse('input-validation', 'revision-unbound', 'no exact commit was given: a verdict cannot be tied to a revision');
|
|
162
|
+
const original = req.original;
|
|
163
|
+
const oracle = _oracles_registry_js__WEBPACK_IMPORTED_MODULE_4__.getOracle(original.oracleId);
|
|
164
|
+
if (!oracle) return refuse('input-validation', 'unknown-oracle', `the exploit oracle '${String(original.oracleId).slice(0, 60)}' is not registered`);
|
|
165
|
+
if (oracle.id === FUNCTIONAL_ORACLE) return refuse('input-validation', 'bad-request', 'the exploit oracle cannot be the functional-regression oracle');
|
|
166
|
+
const patched = (0,_assurance_schema_kit_js__WEBPACK_IMPORTED_MODULE_1__/* .isPlainObject */ .Qd)(req.patched) ? req.patched : {};
|
|
167
|
+
if ((patched.oracleId !== undefined && patched.oracleId !== original.oracleId) || (patched.inputs !== undefined && (0,_assurance_identity_js__WEBPACK_IMPORTED_MODULE_0__/* .digestOf */ .ol)(patched.inputs) !== (0,_assurance_identity_js__WEBPACK_IMPORTED_MODULE_0__/* .digestOf */ .ol)(original.inputs)) || (patched.entry !== undefined && patched.entry !== original.entry)) {
|
|
168
|
+
return refuse('oracle-consistency', 'oracle-changed', 'the patched run names a different oracle, entry or inputs than the original run: a changed oracle cannot show the exploit is closed');
|
|
169
|
+
}
|
|
170
|
+
const pin = req.pinnedOracle;
|
|
171
|
+
if (pin !== undefined && (!(0,_assurance_schema_kit_js__WEBPACK_IMPORTED_MODULE_1__/* .isPlainObject */ .Qd)(pin) || pin.id !== oracle.id || pin.version !== oracle.version || pin.logicDigest !== oracle.logicDigest)) {
|
|
172
|
+
return refuse('oracle-consistency', 'oracle-changed', 'the oracle differs from the identity the requester pinned (id, version or logic digest)');
|
|
173
|
+
}
|
|
174
|
+
const fn = req.functional;
|
|
175
|
+
if (!(0,_assurance_schema_kit_js__WEBPACK_IMPORTED_MODULE_1__/* .isPlainObject */ .Qd)(fn) || !(0,_assurance_schema_kit_js__WEBPACK_IMPORTED_MODULE_1__/* .isPlainObject */ .Qd)(fn.inputs)) {
|
|
176
|
+
return refuse('functional-regression', 'functional-omitted', 'no functional regression check was supplied: a patch that was never checked for behaviour cannot be a verified fix');
|
|
177
|
+
}
|
|
178
|
+
const functionalOracle = fn.oracleId === undefined ? FUNCTIONAL_ORACLE : fn.oracleId;
|
|
179
|
+
if (!FUNCTIONAL_ORACLES.includes(functionalOracle)) {
|
|
180
|
+
return refuse('input-validation', 'bad-request', `the functional check oracle must be one of ${FUNCTIONAL_ORACLES.join(', ')}`);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
const patchDigest = (0,_assurance_identity_js__WEBPACK_IMPORTED_MODULE_0__/* .digestOf */ .ol)(patchFiles);
|
|
184
|
+
base.patchDigest = patchDigest;
|
|
185
|
+
let ledger = ledgerFor(base.repairRecords, req, patchDigest, {}).records; // proposed
|
|
186
|
+
const common = { hypothesisId: req.hypothesisId, commit: req.commit };
|
|
187
|
+
const plan = [
|
|
188
|
+
['original-positive', { oracleId: original.oracleId, entry: original.entry, inputs: original.inputs, patchFiles: null, budgets: original.budgets }],
|
|
189
|
+
['patched-negative', { oracleId: original.oracleId, entry: original.entry, inputs: original.inputs, patchFiles, budgets: original.budgets }],
|
|
190
|
+
['functional-baseline', { oracleId: functionalOracle, entry: original.entry, inputs: fn.inputs, patchFiles: null, budgets: fn.budgets }],
|
|
191
|
+
['functional-regression', { oracleId: functionalOracle, entry: original.entry, inputs: fn.inputs, patchFiles, budgets: fn.budgets }],
|
|
192
|
+
];
|
|
193
|
+
const runs = {};
|
|
194
|
+
let failed = null;
|
|
195
|
+
for (const [i, [step, spec]] of plan.entries()) {
|
|
196
|
+
if (failed) continue;
|
|
197
|
+
let run;
|
|
198
|
+
try {
|
|
199
|
+
const manifest = (0,_replay_replay_js__WEBPACK_IMPORTED_MODULE_3__/* .createReplayManifest */ .$A)({ ...common, fixtureFiles: original.files, patchFiles: spec.patchFiles, oracleId: spec.oracleId, entry: spec.entry, inputs: spec.inputs, budgets: spec.budgets || {}, expected: { outcome: EXPECTED[step] } });
|
|
200
|
+
run = await (0,_replay_replay_js__WEBPACK_IMPORTED_MODULE_3__/* .replayManifest */ .TY)({ manifest, fixtureFiles: original.files, patchFiles: spec.patchFiles }, { config: o.config || config, runOptions: o.runOptions });
|
|
201
|
+
} catch (e) {
|
|
202
|
+
run = { status: 'rejected', errors: [{ code: 'RUN_FAILED', message: String(e?.message || e).slice(0, 200) }] };
|
|
203
|
+
}
|
|
204
|
+
const c = classify(step, run);
|
|
205
|
+
steps[i] = stepResult(step, c.status, { ...c, recordId: run.record?.id ?? null, receiptDigest: run.receipt?.receiptDigest ?? null });
|
|
206
|
+
if (run.executed && run.receipt) runs[ROLE_OF_STEP[step]] = run;
|
|
207
|
+
if (c.status !== 'passed') failed = { step, ...c };
|
|
208
|
+
}
|
|
209
|
+
base.records = Object.fromEntries(Object.entries(runs).map(([k, r]) => [k, r.record]));
|
|
210
|
+
if (failed) {
|
|
211
|
+
ledger = ledgerFor(ledger, req, patchDigest, { rejected: { step: failed.step, code: failed.code, reason: failed.reason } }).records;
|
|
212
|
+
const original0 = base.records.original ? (0,_repair_records_js__WEBPACK_IMPORTED_MODULE_6__/* .withRepairStatus */ .m$)(base.records.original, (0,_repair_records_js__WEBPACK_IMPORTED_MODULE_6__/* .verificationRepairFor */ .Kf)(ledger, req.hypothesisId, patchDigest)) : null;
|
|
213
|
+
return { ...base, incompleteStep: failed.step, failureCode: failed.code, reason: failed.reason, resumable: failed.resumable ?? false, repairRecords: ledger, verificationRecord: original0, summary: summaryOf(steps, false, failed.step, failed.code) };
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// ---- the receipts must match the exact proposed diff and revision before anything is promoted
|
|
217
|
+
const receipts = Object.fromEntries(Object.entries(runs).map(([k, r]) => [k, r.receipt]));
|
|
218
|
+
const promotion = (0,_patch_promotion_js__WEBPACK_IMPORTED_MODULE_5__/* .promotePatch */ .l)({ proposal: { hypothesisId: req.hypothesisId, revision: req.commit, originalFiles: original.files, patchFiles, functionalOracle }, receipts });
|
|
219
|
+
if (!promotion.ok) {
|
|
220
|
+
const envBroken = promotion.reasons.some((r) => r.code === 'environment-mismatch');
|
|
221
|
+
const code = envBroken ? 'environment-mismatch' : promotion.reasons.some((r) => r.code === 'oracle-changed') ? 'oracle-changed' : 'promotion-refused';
|
|
222
|
+
const step = envBroken ? 'environment-equivalence' : code === 'oracle-changed' ? 'oracle-consistency' : 'promotion';
|
|
223
|
+
const reason = promotion.reasons.map((r) => r.message).join('; ').slice(0, 400);
|
|
224
|
+
ledger = ledgerFor(ledger, req, patchDigest, { rejected: { step, code, reason } }).records;
|
|
225
|
+
return { ...base, promotion, incompleteStep: step, failureCode: code, reason, repairRecords: ledger, verificationRecord: base.records.original ? (0,_repair_records_js__WEBPACK_IMPORTED_MODULE_6__/* .withRepairStatus */ .m$)(base.records.original, (0,_repair_records_js__WEBPACK_IMPORTED_MODULE_6__/* .verificationRepairFor */ .Kf)(ledger, req.hypothesisId, patchDigest)) : null, summary: summaryOf(steps, false, step, code) };
|
|
226
|
+
}
|
|
227
|
+
const promoted = (0,_repair_records_js__WEBPACK_IMPORTED_MODULE_6__/* .recordPromotion */ .Zw)(ledger, promotion, { verificationRecordId: base.records.patched?.id ?? null });
|
|
228
|
+
ledger = promoted.records;
|
|
229
|
+
const verificationRecord = (0,_repair_records_js__WEBPACK_IMPORTED_MODULE_6__/* .withRepairStatus */ .m$)(base.records.original, (0,_repair_records_js__WEBPACK_IMPORTED_MODULE_6__/* .verificationRepairFor */ .Kf)(ledger, req.hypothesisId, patchDigest, base.records.patched?.id));
|
|
230
|
+
return {
|
|
231
|
+
...base, status: 'verified-fix', verifiedFix: true, promotion, receipts, repairRecords: ledger, verificationRecord,
|
|
232
|
+
reason: 'verified', summary: summaryOf(steps, true, null, null),
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// The ledger for one verification: always starts with a `proposed` record, and records a rejection when verification stopped.
|
|
237
|
+
function ledgerFor(records, req, patchDigest, { rejected } = {}) {
|
|
238
|
+
let list = Array.isArray(records) ? records : [];
|
|
239
|
+
const fields = { hypothesisId: req.hypothesisId, revision: (0,_assurance_schema_kit_js__WEBPACK_IMPORTED_MODULE_1__/* .isCommit */ .WM)(req.commit) ? req.commit : null, diffDigest: patchDigest };
|
|
240
|
+
if (!list.some((r) => r.hypothesisId === fields.hypothesisId && r.diffDigest === patchDigest)) list = (0,_repair_records_js__WEBPACK_IMPORTED_MODULE_6__/* .appendRepairRecord */ .f7)(list, { ...fields, kind: 'proposed', reason: 'a patch was proposed for verification' }).records;
|
|
241
|
+
if (rejected) list = (0,_repair_records_js__WEBPACK_IMPORTED_MODULE_6__/* .appendRepairRecord */ .f7)(list, { ...fields, kind: 'rejected', step: rejected.step, reason: `${rejected.code}: ${String(rejected.reason || '').slice(0, 300)}` }).records;
|
|
242
|
+
return { records: list };
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
/***/ })
|
|
247
|
+
|
|
248
|
+
};
|
package/dist/6994.index.js
CHANGED
|
@@ -10,7 +10,7 @@ export const modules = {
|
|
|
10
10
|
/* harmony export */ proposeOllamaPoc: () => (/* binding */ proposeOllamaPoc)
|
|
11
11
|
/* harmony export */ });
|
|
12
12
|
/* unused harmony export buildPocPrompt */
|
|
13
|
-
/* harmony import */ var _egress_redact_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(
|
|
13
|
+
/* harmony import */ var _egress_redact_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(11723);
|
|
14
14
|
/* harmony import */ var _egress_policy_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(45712);
|
|
15
15
|
/* harmony import */ var _providers_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(38947);
|
|
16
16
|
/* harmony import */ var _ollama_provider_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(23837);
|
package/dist/7033.index.js
CHANGED
|
@@ -1231,6 +1231,15 @@ const un=net.connect(sock);un.on('connect',()=>{r.daemonSocket='CONNECTED';un.de
|
|
|
1231
1231
|
setTimeout(()=>{r.timeout=true;console.log(JSON.stringify(r));process.exit(0)},8000);
|
|
1232
1232
|
`;
|
|
1233
1233
|
|
|
1234
|
+
/** server.listen that settles: it resolves when listening and rejects on the server's error (a bare callback never fires on failure). */
|
|
1235
|
+
function listenOrReject(server, ...args) {
|
|
1236
|
+
return new Promise((resolve, reject) => {
|
|
1237
|
+
const onError = (e) => reject(e);
|
|
1238
|
+
server.once('error', onError);
|
|
1239
|
+
server.listen(...args, () => { server.off('error', onError); resolve(); });
|
|
1240
|
+
});
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1234
1243
|
/**
|
|
1235
1244
|
* Prove the isolation of a backend with real attempts, independent of any evaluator flag. The result is
|
|
1236
1245
|
* `verified` only if the one permitted read worked, the scratch write worked and every other attempt was refused.
|
|
@@ -1243,12 +1252,31 @@ async function probeSandbox(sb, opts = {}) {
|
|
|
1243
1252
|
for (const d of [allowed, scratch, outside]) (0,external_node_fs_.mkdirSync)(d);
|
|
1244
1253
|
(0,external_node_fs_.writeFileSync)((0,external_node_path_.join)(allowed, 'a.txt'), 'allowed'); (0,external_node_fs_.writeFileSync)((0,external_node_path_.join)(outside, 'secret.txt'), 'secret');
|
|
1245
1254
|
const script = (0,external_node_path_.join)(base, 'probe.cjs'); (0,external_node_fs_.writeFileSync)(script, PROBE_SOURCE);
|
|
1246
|
-
|
|
1255
|
+
let sockPath = (0,external_node_path_.join)(base, 'daemon.sock');
|
|
1256
|
+
let sockDir = null;
|
|
1247
1257
|
let connections = 0;
|
|
1248
1258
|
const tcp = (0,external_node_net_.createServer)((s) => { connections++; s.destroy(); });
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1259
|
+
let uds = (0,external_node_net_.createServer)((s) => { connections++; s.destroy(); });
|
|
1260
|
+
try {
|
|
1261
|
+
await listenOrReject(tcp, 0, '127.0.0.1');
|
|
1262
|
+
try {
|
|
1263
|
+
await listenOrReject(uds, sockPath);
|
|
1264
|
+
} catch (e) {
|
|
1265
|
+
// A unix socket path is limited to about 104 bytes, and a temporary directory can easily be longer than that (macOS, CI runners).
|
|
1266
|
+
// Without an error handler the listen call never completed and the whole evaluation hung. Retry in a short directory; the probe
|
|
1267
|
+
// proves that the sandboxed process is refused, which does not depend on where the socket lives.
|
|
1268
|
+
if (!['EINVAL', 'ENAMETOOLONG'].includes(e && e.code) || !(0,external_node_fs_.existsSync)('/tmp')) throw e;
|
|
1269
|
+
uds.close();
|
|
1270
|
+
uds = (0,external_node_net_.createServer)((s) => { connections++; s.destroy(); });
|
|
1271
|
+
sockDir = (0,external_node_fs_.mkdtempSync)('/tmp/nep-');
|
|
1272
|
+
sockPath = (0,external_node_path_.join)(sockDir, 'd.sock');
|
|
1273
|
+
await listenOrReject(uds, sockPath);
|
|
1274
|
+
}
|
|
1275
|
+
} catch (e) {
|
|
1276
|
+
tcp.close(); uds.close(); (0,external_node_fs_.rmSync)(base, { recursive: true, force: true });
|
|
1277
|
+
if (sockDir) (0,external_node_fs_.rmSync)(sockDir, { recursive: true, force: true });
|
|
1278
|
+
return { verified: false, backend: sb.backend, reason: `the probe could not create its listeners (${(e && e.code) || 'error'}): isolation is not verified`, attempts: {} };
|
|
1279
|
+
}
|
|
1252
1280
|
const port = tcp.address().port;
|
|
1253
1281
|
try {
|
|
1254
1282
|
const exe = opts.nodePath || process.execPath;
|
|
@@ -1269,7 +1297,7 @@ async function probeSandbox(sb, opts = {}) {
|
|
|
1269
1297
|
if (attempts.credentialEnv && attempts.credentialEnv !== 'absent') insufficient.push('a credential environment variable was visible');
|
|
1270
1298
|
if (attempts.timeout) insufficient.push('the probe timed out');
|
|
1271
1299
|
return { verified: insufficient.length === 0 && connections === 0, backend: sb.backend, reason: insufficient.length ? insufficient.join('; ') : (connections ? 'the probe listeners saw a connection' : null), attempts, listenerConnections: connections, insufficient };
|
|
1272
|
-
} finally { tcp.close(); uds.close(); (0,external_node_fs_.rmSync)(base, { recursive: true, force: true }); }
|
|
1300
|
+
} finally { tcp.close(); uds.close(); (0,external_node_fs_.rmSync)(base, { recursive: true, force: true }); if (sockDir) (0,external_node_fs_.rmSync)(sockDir, { recursive: true, force: true }); }
|
|
1273
1301
|
}
|
|
1274
1302
|
|
|
1275
1303
|
// ── 3. evaluator feature detection ───────────────────────────────────────────
|