@clear-capabilities/agentic-security-scanner 0.79.0 → 0.80.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/dist/178.index.js +1 -1
- package/dist/333.index.js +283 -0
- package/dist/384.index.js +1 -1
- package/dist/637.index.js +1 -1
- package/dist/838.index.js +1 -1
- package/dist/985.index.js +90 -1
- package/dist/agentic-security.mjs +83 -83
- package/dist/agentic-security.mjs.sha256 +1 -1
- package/package.json +6 -4
- package/src/.agentic-security/findings.json +104638 -0
- package/src/.agentic-security/last-scan.json +104638 -0
- package/src/.agentic-security/last-scan.json.sig +1 -0
- package/src/.agentic-security/scan-history.json +12562 -0
- package/src/.agentic-security/streak.json +21 -0
- package/src/dataflow/.agentic-security/findings.json +6086 -0
- package/src/dataflow/.agentic-security/last-scan.json +6086 -0
- package/src/dataflow/.agentic-security/last-scan.json.sig +1 -0
- package/src/dataflow/.agentic-security/scan-history.json +250 -0
- package/src/dataflow/.agentic-security/streak.json +21 -0
- package/src/dataflow/cross-service-taint.js +201 -0
- package/src/dataflow/formal-verify.js +204 -0
- package/src/dataflow/ifds-precise.js +222 -0
- package/src/dataflow/k2-summary-cache.js +153 -0
- package/src/dataflow/lib-taint-summaries.js +198 -0
- package/src/dataflow/privacy-taint.js +205 -0
- package/src/dataflow/smt-feasibility.js +189 -0
- package/src/engine.js +784 -127
- package/src/ir/.agentic-security/findings.json +4011 -0
- package/src/ir/.agentic-security/last-scan.json +4011 -0
- package/src/ir/.agentic-security/last-scan.json.sig +1 -0
- package/src/ir/.agentic-security/scan-history.json +193 -0
- package/src/ir/.agentic-security/streak.json +20 -0
- package/src/ir/cpp-preprocessor.js +142 -0
- package/src/ir/csharp-ir.js +604 -0
- package/src/ir/universal-ir.js +403 -0
- package/src/mcp/.agentic-security/findings.json +8632 -0
- package/src/mcp/.agentic-security/last-scan.json +8632 -0
- package/src/mcp/.agentic-security/last-scan.json.sig +1 -0
- package/src/mcp/.agentic-security/scan-history.json +143 -0
- package/src/mcp/.agentic-security/streak.json +20 -0
- package/src/mcp/tools.js +90 -1
- package/src/posture/.agentic-security/findings.json +64004 -0
- package/src/posture/.agentic-security/last-scan.json +64004 -0
- package/src/posture/.agentic-security/last-scan.json.sig +1 -0
- package/src/posture/.agentic-security/scan-history.json +7162 -0
- package/src/posture/.agentic-security/streak.json +21 -0
- package/src/posture/api-contract.js +193 -0
- package/src/posture/attack-taxonomy.js +227 -0
- package/src/posture/compliance-policy.js +218 -0
- package/src/posture/composite-risk.js +122 -0
- package/src/posture/csharp-analysis.js +330 -0
- package/src/posture/exploit-bundle.js +210 -0
- package/src/posture/federated-learning.js +172 -0
- package/src/posture/license-attributions.js +94 -0
- package/src/posture/license-graph.js +238 -0
- package/src/posture/pqc-migration-plan.js +158 -0
- package/src/posture/reachability-filter.js +33 -2
- package/src/posture/realtime-cve-monitor.js +214 -0
- package/src/posture/runtime-correlation.js +174 -0
- package/src/posture/sbom-diff.js +171 -0
- package/src/posture/sca-policy.js +235 -0
- package/src/posture/sca-upgrade.js +259 -0
- package/src/posture/threat-model-auto.js +268 -0
- package/src/posture/triage-learning.js +170 -0
- package/src/posture/triage.js +26 -1
- package/src/sast/.agentic-security/findings.json +6154 -0
- package/src/sast/.agentic-security/last-scan.json +6154 -0
- package/src/sast/.agentic-security/last-scan.json.sig +1 -0
- package/src/sast/.agentic-security/scan-history.json +941 -0
- package/src/sast/.agentic-security/streak.json +22 -0
- package/src/sast/_secret-entropy.js +145 -0
- package/src/sast/cloud-iam.js +312 -0
- package/src/sast/cpp.js +138 -4
- package/src/sast/crypto-protocol.js +388 -0
- package/src/sast/csharp-tokenizer.js +392 -0
- package/src/sast/csharp.js +924 -138
- package/src/sast/dapp-frontend.js +200 -0
- package/src/sast/k8s-admission.js +271 -0
- package/src/sast/llm-app.js +272 -0
- package/src/sast/ml-supply-chain.js +259 -0
- package/src/sast/mobile.js +224 -0
- package/src/sast/post-quantum-crypto.js +348 -0
- package/src/sast/web3-advanced.js +375 -0
- package/src/sca/.agentic-security/findings.json +7460 -0
- package/src/sca/.agentic-security/last-scan.json +7460 -0
- package/src/sca/.agentic-security/last-scan.json.sig +1 -0
- package/src/sca/.agentic-security/scan-history.json +113 -0
- package/src/sca/.agentic-security/streak.json +21 -0
- package/src/sca/CLAUDE.md +161 -0
- package/src/sca/binary-metadata.js +37 -15
- package/src/sca/sigstore-verify.js +215 -0
package/dist/178.index.js
CHANGED
|
@@ -13,7 +13,7 @@ export const modules = {
|
|
|
13
13
|
/* harmony import */ var node_child_process__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1421);
|
|
14
14
|
/* harmony import */ var node_fs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3024);
|
|
15
15
|
/* harmony import */ var node_path__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6760);
|
|
16
|
-
/* harmony import */ var _engine_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(
|
|
16
|
+
/* harmony import */ var _engine_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(9072);
|
|
17
17
|
// Time-travel + counterfactual scanning (v0.68).
|
|
18
18
|
//
|
|
19
19
|
// Two new modes that exploit the pure-input shape of runFullScan:
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
export const id = 333;
|
|
2
|
+
export const ids = [333];
|
|
3
|
+
export const modules = {
|
|
4
|
+
|
|
5
|
+
/***/ 5333:
|
|
6
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
7
|
+
|
|
8
|
+
__webpack_require__.r(__webpack_exports__);
|
|
9
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
10
|
+
/* harmony export */ applyScaUpgrade: () => (/* binding */ applyScaUpgrade),
|
|
11
|
+
/* harmony export */ planScaUpgrade: () => (/* binding */ planScaUpgrade)
|
|
12
|
+
/* harmony export */ });
|
|
13
|
+
/* harmony import */ var node_fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3024);
|
|
14
|
+
/* harmony import */ var node_fs_promises__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1455);
|
|
15
|
+
/* harmony import */ var node_path__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6760);
|
|
16
|
+
/* harmony import */ var node_crypto__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(7598);
|
|
17
|
+
/* harmony import */ var node_child_process__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(1421);
|
|
18
|
+
/* harmony import */ var node_util__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(7975);
|
|
19
|
+
/* harmony import */ var _state_dir_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(1174);
|
|
20
|
+
// SCA upgrade engine: dry-run plan + worktree-isolated apply.
|
|
21
|
+
//
|
|
22
|
+
// Phase 3 / Item 5 of the SCA improvement plan. The MCP `apply_fix` path
|
|
23
|
+
// refuses to write manifest files (package.json, *-lock.*, poetry.lock,
|
|
24
|
+
// Cargo.lock, etc.) for safety. SCA findings need a separate path that:
|
|
25
|
+
// 1. Generates an upgrade *plan* via the ecosystem's native dry-run
|
|
26
|
+
// command (npm install --dry-run, pip install --dry-run, etc.).
|
|
27
|
+
// 2. Applies the upgrade via the package manager itself, with a backup
|
|
28
|
+
// + test-gate so a peer-dep break or test regression rolls back.
|
|
29
|
+
//
|
|
30
|
+
// Caller pattern: plan first (read-only), inspect the breaking-change
|
|
31
|
+
// flag / peer warnings, then apply with confirm:true.
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
const execFileAsync = (0,node_util__WEBPACK_IMPORTED_MODULE_5__.promisify)(node_child_process__WEBPACK_IMPORTED_MODULE_4__.execFile);
|
|
42
|
+
|
|
43
|
+
// Per-ecosystem command/manifest map. Add ecosystems by extending this
|
|
44
|
+
// table — every other place in the module reads it.
|
|
45
|
+
const ECOSYSTEM = {
|
|
46
|
+
npm: {
|
|
47
|
+
manifests: ['package.json', 'package-lock.json'],
|
|
48
|
+
altManifests: [['yarn.lock'], ['pnpm-lock.yaml']],
|
|
49
|
+
dryRun: (pkg, ver) => ({ cmd: 'npm', args: ['install', `${pkg}@${ver}`, '--dry-run', '--json'] }),
|
|
50
|
+
apply: (pkg, ver) => ({ cmd: 'npm', args: ['install', `${pkg}@${ver}`, '--save'] }),
|
|
51
|
+
parseDryRun(stdout) {
|
|
52
|
+
try {
|
|
53
|
+
const j = JSON.parse(stdout);
|
|
54
|
+
const peerDeps = Array.isArray(j.warnings) ? j.warnings.filter(w => /peer dep/i.test(w)) : [];
|
|
55
|
+
const transitiveImpact = (j.added || []).length + (j.updated || []).length + (j.removed || []).length;
|
|
56
|
+
return { peerDeps, transitiveImpact, rawSummary: { added: (j.added || []).length, updated: (j.updated || []).length, removed: (j.removed || []).length } };
|
|
57
|
+
} catch { return { peerDeps: [], transitiveImpact: 0, rawSummary: null }; }
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
pypi: {
|
|
61
|
+
manifests: ['requirements.txt', 'pyproject.toml'],
|
|
62
|
+
altManifests: [['poetry.lock'], ['Pipfile.lock']],
|
|
63
|
+
dryRun: (pkg, ver) => ({ cmd: 'pip', args: ['install', '--dry-run', `${pkg}==${ver}`] }),
|
|
64
|
+
apply: (pkg, ver) => ({ cmd: 'pip', args: ['install', '--upgrade', `${pkg}==${ver}`] }),
|
|
65
|
+
parseDryRun() {
|
|
66
|
+
// pip --dry-run output is human-readable; we don't parse it for v1.
|
|
67
|
+
return { peerDeps: [], transitiveImpact: 0, rawSummary: null };
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
cargo: {
|
|
71
|
+
manifests: ['Cargo.toml', 'Cargo.lock'],
|
|
72
|
+
altManifests: [],
|
|
73
|
+
dryRun: (pkg, _ver) => ({ cmd: 'cargo', args: ['update', '--package', pkg, '--dry-run'] }),
|
|
74
|
+
apply: (pkg, _ver) => ({ cmd: 'cargo', args: ['update', '--package', pkg] }),
|
|
75
|
+
parseDryRun() { return { peerDeps: [], transitiveImpact: 0, rawSummary: null }; },
|
|
76
|
+
},
|
|
77
|
+
golang: {
|
|
78
|
+
manifests: ['go.mod', 'go.sum'],
|
|
79
|
+
altManifests: [],
|
|
80
|
+
dryRun: (_pkg, _ver) => null, // `go get` has no dry-run flag; we skip dry-run in v1.
|
|
81
|
+
apply: (pkg, ver) => ({ cmd: 'go', args: ['get', `${pkg}@v${ver}`] }),
|
|
82
|
+
parseDryRun() { return { peerDeps: [], transitiveImpact: 0, rawSummary: null }; },
|
|
83
|
+
},
|
|
84
|
+
// Other ecosystems (rubygems, packagist, pub, maven) return a structured
|
|
85
|
+
// "manual" plan in v1 — no native dry-run + the install side-effects
|
|
86
|
+
// (gem build artifacts, composer cache) are easier for the user to
|
|
87
|
+
// confirm interactively.
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
function _majorVersion(v) {
|
|
91
|
+
const m = String(v || '').match(/^(\d+)/);
|
|
92
|
+
return m ? parseInt(m[1], 10) : null;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function _detectTestCommand(scanRoot) {
|
|
96
|
+
try {
|
|
97
|
+
const pkg = node_path__WEBPACK_IMPORTED_MODULE_2__.join(scanRoot, 'package.json');
|
|
98
|
+
if (node_fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(pkg)) {
|
|
99
|
+
const j = JSON.parse(node_fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync(pkg, 'utf8'));
|
|
100
|
+
if (j.scripts?.test && !/no test specified/i.test(j.scripts.test)) {
|
|
101
|
+
return { cmd: 'npm', args: ['test'] };
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
} catch {}
|
|
105
|
+
if (node_fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(node_path__WEBPACK_IMPORTED_MODULE_2__.join(scanRoot, 'Cargo.toml'))) return { cmd: 'cargo', args: ['test'] };
|
|
106
|
+
if (node_fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(node_path__WEBPACK_IMPORTED_MODULE_2__.join(scanRoot, 'go.mod'))) return { cmd: 'go', args: ['test', './...'] };
|
|
107
|
+
if (node_fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(node_path__WEBPACK_IMPORTED_MODULE_2__.join(scanRoot, 'pyproject.toml'))) return { cmd: 'pytest', args: [] };
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Produce a structured upgrade plan WITHOUT modifying anything on disk.
|
|
112
|
+
// Safe to call repeatedly; runs the ecosystem's --dry-run command.
|
|
113
|
+
async function planScaUpgrade({ scanRoot, finding }) {
|
|
114
|
+
if (!finding || finding.type !== 'vulnerable_dep') {
|
|
115
|
+
return { ok: false, reason: 'not a vulnerable_dep finding' };
|
|
116
|
+
}
|
|
117
|
+
const eco = ECOSYSTEM[finding.ecosystem];
|
|
118
|
+
if (!eco) {
|
|
119
|
+
return {
|
|
120
|
+
ok: true,
|
|
121
|
+
mode: 'manual',
|
|
122
|
+
reason: `ecosystem '${finding.ecosystem}' has no automated upgrade in v1`,
|
|
123
|
+
package: finding.name, currentVersion: finding.version,
|
|
124
|
+
targetVersion: (finding.fixedVersions && finding.fixedVersions[0]) || null,
|
|
125
|
+
command: null,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
const target = (finding.fixedVersions && finding.fixedVersions[0]) || null;
|
|
129
|
+
if (!target) {
|
|
130
|
+
return { ok: false, reason: 'no fixed version in OSV record' };
|
|
131
|
+
}
|
|
132
|
+
const isBreaking = (_majorVersion(target) ?? 0) > (_majorVersion(finding.version) ?? 0);
|
|
133
|
+
const apply = eco.apply(finding.name, target);
|
|
134
|
+
const dryRunSpec = eco.dryRun(finding.name, target);
|
|
135
|
+
let peerDeps = [], transitiveImpact = 0, rawSummary = null, dryRunOk = null;
|
|
136
|
+
if (dryRunSpec) {
|
|
137
|
+
try {
|
|
138
|
+
const r = await execFileAsync(dryRunSpec.cmd, dryRunSpec.args, {
|
|
139
|
+
cwd: scanRoot, timeout: 60_000, maxBuffer: 8 * 1024 * 1024,
|
|
140
|
+
});
|
|
141
|
+
const parsed = eco.parseDryRun(r.stdout);
|
|
142
|
+
peerDeps = parsed.peerDeps;
|
|
143
|
+
transitiveImpact = parsed.transitiveImpact;
|
|
144
|
+
rawSummary = parsed.rawSummary;
|
|
145
|
+
dryRunOk = true;
|
|
146
|
+
} catch (e) {
|
|
147
|
+
// Dry-run failed (e.g. peer-dep resolution conflict). Surface the
|
|
148
|
+
// error structurally so the caller can decide whether to proceed.
|
|
149
|
+
dryRunOk = false;
|
|
150
|
+
const stderr = (e && e.stderr) || (e && e.message) || '';
|
|
151
|
+
peerDeps = /peer dep/i.test(stderr) ? [String(stderr).slice(0, 500)] : [];
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return {
|
|
155
|
+
ok: true,
|
|
156
|
+
mode: 'auto',
|
|
157
|
+
ecosystem: finding.ecosystem,
|
|
158
|
+
package: finding.name,
|
|
159
|
+
currentVersion: finding.version,
|
|
160
|
+
targetVersion: target,
|
|
161
|
+
isBreaking,
|
|
162
|
+
command: `${apply.cmd} ${apply.args.join(' ')}`,
|
|
163
|
+
manifestFiles: eco.manifests,
|
|
164
|
+
dryRun: { ok: dryRunOk, command: dryRunSpec ? `${dryRunSpec.cmd} ${dryRunSpec.args.join(' ')}` : null, peerDeps, transitiveImpact, rawSummary },
|
|
165
|
+
testCommand: (() => { const t = _detectTestCommand(scanRoot); return t ? `${t.cmd} ${t.args.join(' ')}` : null; })(),
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// Apply the upgrade. Backs up affected manifests, runs the install, runs
|
|
170
|
+
// the project's test command if detected, and ROLLS BACK on failure.
|
|
171
|
+
// Audit-logged via the MCP audit layer at the call site.
|
|
172
|
+
async function applyScaUpgrade({ scanRoot, finding, runTests = true }) {
|
|
173
|
+
const plan = await planScaUpgrade({ scanRoot, finding });
|
|
174
|
+
if (!plan.ok) return { applied: false, reason: plan.reason };
|
|
175
|
+
if (plan.mode === 'manual') {
|
|
176
|
+
return { applied: false, reason: plan.reason, plan };
|
|
177
|
+
}
|
|
178
|
+
const eco = ECOSYSTEM[finding.ecosystem];
|
|
179
|
+
const target = plan.targetVersion;
|
|
180
|
+
|
|
181
|
+
// Backup pass — record original contents of every relevant manifest so
|
|
182
|
+
// we can restore on test failure. node_modules / vendor dirs are NOT
|
|
183
|
+
// backed up (too big); they'll be rebuilt by re-running the install on
|
|
184
|
+
// restore.
|
|
185
|
+
const stateDir = (0,_state_dir_js__WEBPACK_IMPORTED_MODULE_6__/* .statePath */ .BQ)(scanRoot, 'sca-upgrade-history');
|
|
186
|
+
node_fs__WEBPACK_IMPORTED_MODULE_0__.mkdirSync(stateDir, { recursive: true });
|
|
187
|
+
const upgradeId = node_crypto__WEBPACK_IMPORTED_MODULE_3__.randomBytes(8).toString('hex');
|
|
188
|
+
const backups = {};
|
|
189
|
+
for (const mf of eco.manifests) {
|
|
190
|
+
const abs = node_path__WEBPACK_IMPORTED_MODULE_2__.join(scanRoot, mf);
|
|
191
|
+
if (!node_fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(abs)) continue;
|
|
192
|
+
const content = await node_fs_promises__WEBPACK_IMPORTED_MODULE_1__.readFile(abs, 'utf8');
|
|
193
|
+
const backupPath = node_path__WEBPACK_IMPORTED_MODULE_2__.join(stateDir, `${upgradeId}-${mf.replace(/[\/\\]/g, '_')}.bak`);
|
|
194
|
+
await node_fs_promises__WEBPACK_IMPORTED_MODULE_1__.writeFile(backupPath, content);
|
|
195
|
+
backups[mf] = { abs, backupPath };
|
|
196
|
+
}
|
|
197
|
+
if (!Object.keys(backups).length) {
|
|
198
|
+
return { applied: false, reason: `no ${finding.ecosystem} manifest files found in scan root` };
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// Run the install.
|
|
202
|
+
const apply = eco.apply(finding.name, target);
|
|
203
|
+
let installOutput = '';
|
|
204
|
+
try {
|
|
205
|
+
const r = await execFileAsync(apply.cmd, apply.args, {
|
|
206
|
+
cwd: scanRoot, timeout: 300_000, maxBuffer: 16 * 1024 * 1024,
|
|
207
|
+
});
|
|
208
|
+
installOutput = (r.stdout || '') + (r.stderr || '');
|
|
209
|
+
} catch (e) {
|
|
210
|
+
// Install failed; restore backups (manifests may have been touched).
|
|
211
|
+
for (const { abs, backupPath } of Object.values(backups)) {
|
|
212
|
+
try { await node_fs_promises__WEBPACK_IMPORTED_MODULE_1__.copyFile(backupPath, abs); } catch {}
|
|
213
|
+
}
|
|
214
|
+
return {
|
|
215
|
+
applied: false,
|
|
216
|
+
reason: `install failed: ${(e && e.message) || e}`.slice(0, 600),
|
|
217
|
+
installOutput: ((e && e.stdout) || '').slice(0, 1500),
|
|
218
|
+
restored: true,
|
|
219
|
+
upgradeId,
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// Optionally run the project's test command. On failure, restore.
|
|
224
|
+
let testResult = null;
|
|
225
|
+
if (runTests) {
|
|
226
|
+
const test = _detectTestCommand(scanRoot);
|
|
227
|
+
if (test) {
|
|
228
|
+
try {
|
|
229
|
+
const r = await execFileAsync(test.cmd, test.args, {
|
|
230
|
+
cwd: scanRoot, timeout: 600_000, maxBuffer: 16 * 1024 * 1024,
|
|
231
|
+
});
|
|
232
|
+
testResult = { ok: true, command: `${test.cmd} ${test.args.join(' ')}`, output: ((r.stdout || '') + (r.stderr || '')).slice(0, 2000) };
|
|
233
|
+
} catch (e) {
|
|
234
|
+
// Tests failed — restore manifests so the working tree is clean.
|
|
235
|
+
for (const { abs, backupPath } of Object.values(backups)) {
|
|
236
|
+
try { await node_fs_promises__WEBPACK_IMPORTED_MODULE_1__.copyFile(backupPath, abs); } catch {}
|
|
237
|
+
}
|
|
238
|
+
return {
|
|
239
|
+
applied: false,
|
|
240
|
+
reason: `tests failed after upgrade: ${(e && e.message) || e}`.slice(0, 300),
|
|
241
|
+
testOutput: ((e && e.stdout) || '').slice(0, 2000),
|
|
242
|
+
restored: true,
|
|
243
|
+
upgradeId,
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// Success path — write a log entry so the user can audit / undo.
|
|
250
|
+
const logEntry = {
|
|
251
|
+
id: upgradeId,
|
|
252
|
+
timestamp: new Date().toISOString(),
|
|
253
|
+
ecosystem: finding.ecosystem,
|
|
254
|
+
package: finding.name,
|
|
255
|
+
from: finding.version,
|
|
256
|
+
to: target,
|
|
257
|
+
backups: Object.fromEntries(Object.entries(backups).map(([k, v]) => [k, v.backupPath])),
|
|
258
|
+
testResult,
|
|
259
|
+
isBreaking: plan.isBreaking,
|
|
260
|
+
finding: { id: finding.id, osvId: finding.osvId, cveAliases: finding.cveAliases },
|
|
261
|
+
};
|
|
262
|
+
const logFp = node_path__WEBPACK_IMPORTED_MODULE_2__.join(stateDir, 'log.json');
|
|
263
|
+
let log = [];
|
|
264
|
+
try { log = JSON.parse(node_fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync(logFp, 'utf8')); } catch {}
|
|
265
|
+
log.push(logEntry);
|
|
266
|
+
node_fs__WEBPACK_IMPORTED_MODULE_0__.writeFileSync(logFp, JSON.stringify(log, null, 2));
|
|
267
|
+
|
|
268
|
+
return {
|
|
269
|
+
applied: true,
|
|
270
|
+
upgradeId,
|
|
271
|
+
package: finding.name,
|
|
272
|
+
from: finding.version,
|
|
273
|
+
to: target,
|
|
274
|
+
isBreaking: plan.isBreaking,
|
|
275
|
+
testResult,
|
|
276
|
+
installOutput: installOutput.slice(0, 1500),
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
/***/ })
|
|
282
|
+
|
|
283
|
+
};
|
package/dist/384.index.js
CHANGED
|
@@ -8,7 +8,7 @@ export const modules = {
|
|
|
8
8
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
9
9
|
/* harmony export */ scanCredentials: () => (/* reexport safe */ _engine_js__WEBPACK_IMPORTED_MODULE_0__.Sv)
|
|
10
10
|
/* harmony export */ });
|
|
11
|
-
/* harmony import */ var _engine_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(
|
|
11
|
+
/* harmony import */ var _engine_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9072);
|
|
12
12
|
// Secrets submodule view of the engine — credential + entropy + TODO scanning.
|
|
13
13
|
|
|
14
14
|
|
package/dist/637.index.js
CHANGED
|
@@ -10,7 +10,7 @@ export const modules = {
|
|
|
10
10
|
/* harmony export */ renderPrDeltaText: () => (/* binding */ renderPrDeltaText)
|
|
11
11
|
/* harmony export */ });
|
|
12
12
|
/* harmony import */ var node_child_process__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1421);
|
|
13
|
-
/* harmony import */ var _engine_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(
|
|
13
|
+
/* harmony import */ var _engine_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9072);
|
|
14
14
|
// Shadowscan / security-DELTA on PR (v0.72).
|
|
15
15
|
//
|
|
16
16
|
// Most SAST PR-comment integrations show absolute counts — "12 findings
|
package/dist/838.index.js
CHANGED
|
@@ -14,7 +14,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
14
14
|
/* harmony import */ var node_child_process__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1421);
|
|
15
15
|
/* harmony import */ var node_fs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3024);
|
|
16
16
|
/* harmony import */ var node_path__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6760);
|
|
17
|
-
/* harmony import */ var _engine_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(
|
|
17
|
+
/* harmony import */ var _engine_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(9072);
|
|
18
18
|
// Closed-loop /fix verification (Sentinel-parity FR-L4-4, FR-L4-5).
|
|
19
19
|
//
|
|
20
20
|
// Given a candidate patch (the new file content + the finding stableId being
|
package/dist/985.index.js
CHANGED
|
@@ -613,6 +613,8 @@ function _findById(scan, id) {
|
|
|
613
613
|
if (!scan) return null;
|
|
614
614
|
return (scan.findings || []).find(f => f.id === id)
|
|
615
615
|
|| (scan.secrets || []).find(f => f.id === id)
|
|
616
|
+
|| (scan.supplyChain || []).find(f => f.id === id)
|
|
617
|
+
|| (scan.logicVulns || []).find(f => f.id === id)
|
|
616
618
|
|| null;
|
|
617
619
|
}
|
|
618
620
|
|
|
@@ -843,6 +845,19 @@ const explain_finding = {
|
|
|
843
845
|
confidence: f.confidence ?? null,
|
|
844
846
|
hasReplacementFix: typeof f.fix?.replacement === 'string',
|
|
845
847
|
integrity: status,
|
|
848
|
+
// Risk-signal passthrough so agents can decide priority without
|
|
849
|
+
// re-reading last-scan.json or re-fetching OSV/KEV/EPSS. compositeRisk
|
|
850
|
+
// is the canonical sort key; the other fields are its provenance.
|
|
851
|
+
compositeRisk: f.compositeRisk ?? null,
|
|
852
|
+
compositeRiskTier: f.compositeRiskTier ?? null,
|
|
853
|
+
compositeRiskFactors: Array.isArray(f.compositeRiskFactors) ? f.compositeRiskFactors : [],
|
|
854
|
+
exploitability: f.exploitability ?? null,
|
|
855
|
+
exploitabilityTier: f.exploitabilityTier ?? null,
|
|
856
|
+
mitigationVerdict: f.mitigationVerdict ?? null,
|
|
857
|
+
kev: !!(f.kev || f.kevListed || f.weaponized),
|
|
858
|
+
epssScore: typeof f.epssScore === 'number' ? f.epssScore : null,
|
|
859
|
+
epssPercentile: typeof f.epssPercentile === 'number' ? f.epssPercentile : null,
|
|
860
|
+
exploitedNow: !!f.exploitedNow,
|
|
846
861
|
};
|
|
847
862
|
},
|
|
848
863
|
};
|
|
@@ -1327,7 +1342,81 @@ const lookup_cve = {
|
|
|
1327
1342
|
},
|
|
1328
1343
|
};
|
|
1329
1344
|
|
|
1330
|
-
|
|
1345
|
+
// ─── synthesize_sca_upgrade ───────────────────────────────────────────────
|
|
1346
|
+
// Phase 3 / Item 5 of the SCA improvement plan. Read-only counterpart to
|
|
1347
|
+
// apply_sca_upgrade — produces a structured upgrade plan via the
|
|
1348
|
+
// ecosystem's native --dry-run command. Safe to call any number of times.
|
|
1349
|
+
let _scaUpgrade;
|
|
1350
|
+
async function _getScaUpgrade() {
|
|
1351
|
+
if (!_scaUpgrade) _scaUpgrade = await __webpack_require__.e(/* import() */ 333).then(__webpack_require__.bind(__webpack_require__, 5333));
|
|
1352
|
+
return _scaUpgrade;
|
|
1353
|
+
}
|
|
1354
|
+
const synthesize_sca_upgrade = {
|
|
1355
|
+
name: 'synthesize_sca_upgrade',
|
|
1356
|
+
description: 'Generate an upgrade plan for a single SCA finding. Runs the ecosystem dry-run (npm install --dry-run, pip install --dry-run, cargo update --dry-run). Returns { ecosystem, package, currentVersion, targetVersion, isBreaking, command, manifestFiles, dryRun, testCommand }. No writes.',
|
|
1357
|
+
inputSchema: {
|
|
1358
|
+
type: 'object',
|
|
1359
|
+
additionalProperties: false,
|
|
1360
|
+
properties: {
|
|
1361
|
+
finding_id: { type: 'string', minLength: 1, maxLength: 256 },
|
|
1362
|
+
},
|
|
1363
|
+
required: ['finding_id'],
|
|
1364
|
+
},
|
|
1365
|
+
async handler({ finding_id }, ctx) {
|
|
1366
|
+
const { scan, status } = _readLastScanVerified(ctx.sessionRoot, { allowUnsigned: true });
|
|
1367
|
+
if (!scan) throw new Error(`No usable scan state (${status}).`);
|
|
1368
|
+
const f = _findById(scan, finding_id);
|
|
1369
|
+
if (!f) throw new Error(`Finding not found: ${finding_id}`);
|
|
1370
|
+
if (f.type !== 'vulnerable_dep') {
|
|
1371
|
+
return { _meta: META, ok: false, reason: 'finding is not an SCA vulnerable_dep — use synthesize_fix for SAST findings' };
|
|
1372
|
+
}
|
|
1373
|
+
const { planScaUpgrade } = await _getScaUpgrade();
|
|
1374
|
+
const plan = await planScaUpgrade({ scanRoot: ctx.sessionRoot, finding: f });
|
|
1375
|
+
return { _meta: META, ...plan };
|
|
1376
|
+
},
|
|
1377
|
+
};
|
|
1378
|
+
|
|
1379
|
+
// ─── apply_sca_upgrade ────────────────────────────────────────────────────
|
|
1380
|
+
// Phase 3 / Item 5 of the SCA improvement plan. The MCP `apply_fix` path
|
|
1381
|
+
// refuses every package-manager manifest by design. This tool bypasses
|
|
1382
|
+
// that ONLY for the install pathway — it shells out to the ecosystem's
|
|
1383
|
+
// native package manager (npm / pip / cargo / go) which is the right
|
|
1384
|
+
// surface for safely modifying manifests + lockfiles. Backs up affected
|
|
1385
|
+
// manifests before the install; runs the project's test command (if
|
|
1386
|
+
// detected); rolls back manifests if tests fail.
|
|
1387
|
+
const apply_sca_upgrade = {
|
|
1388
|
+
name: 'apply_sca_upgrade',
|
|
1389
|
+
description: 'Apply a vulnerable_dep upgrade. Backs up manifests, runs the package manager, runs the project test command, restores manifests on test failure. Requires confirm:true. Set run_tests:false to skip the test gate (NOT recommended).',
|
|
1390
|
+
inputSchema: {
|
|
1391
|
+
type: 'object',
|
|
1392
|
+
additionalProperties: false,
|
|
1393
|
+
properties: {
|
|
1394
|
+
finding_id: { type: 'string', minLength: 1, maxLength: 256 },
|
|
1395
|
+
confirm: { type: 'boolean' },
|
|
1396
|
+
run_tests: { type: 'boolean' },
|
|
1397
|
+
},
|
|
1398
|
+
required: ['finding_id', 'confirm'],
|
|
1399
|
+
},
|
|
1400
|
+
async handler({ finding_id, confirm, run_tests = true }, ctx) {
|
|
1401
|
+
if (confirm !== true) {
|
|
1402
|
+
return { _meta: META, applied: false, reason: 'apply_sca_upgrade requires confirm: true.' };
|
|
1403
|
+
}
|
|
1404
|
+
const { scan, status } = _readLastScanVerified(ctx.sessionRoot, { allowUnsigned: false });
|
|
1405
|
+
if (!scan) {
|
|
1406
|
+
return { _meta: META, applied: false, reason: `last-scan.json failed integrity check: ${status}. Run a fresh scan.` };
|
|
1407
|
+
}
|
|
1408
|
+
const f = _findById(scan, finding_id);
|
|
1409
|
+
if (!f) return { _meta: META, applied: false, reason: `Finding not found: ${finding_id}` };
|
|
1410
|
+
if (f.type !== 'vulnerable_dep') {
|
|
1411
|
+
return { _meta: META, applied: false, reason: 'finding is not an SCA vulnerable_dep — use apply_fix for SAST findings' };
|
|
1412
|
+
}
|
|
1413
|
+
const { applyScaUpgrade } = await _getScaUpgrade();
|
|
1414
|
+
const result = await applyScaUpgrade({ scanRoot: ctx.sessionRoot, finding: f, runTests: run_tests });
|
|
1415
|
+
return { _meta: META, ...result };
|
|
1416
|
+
},
|
|
1417
|
+
};
|
|
1418
|
+
|
|
1419
|
+
const ALL_TOOLS = [scan_diff, query_taint, explain_finding, apply_fix, verify_fix, synthesize_fix, find_rule_module, append_scratchpad, read_scratchpad, append_agents_memory, read_agents_memory, lookup_cve, synthesize_sca_upgrade, apply_sca_upgrade];
|
|
1331
1420
|
|
|
1332
1421
|
;// CONCATENATED MODULE: ./src/mcp/validate.js
|
|
1333
1422
|
// Minimal JSON Schema validator — just the subset our tool schemas use.
|