@clear-capabilities/agentic-security-scanner 0.78.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.
Files changed (126) hide show
  1. package/bin/.agentic-security/findings.json +16 -16
  2. package/bin/.agentic-security/last-scan.json +16 -16
  3. package/bin/.agentic-security/last-scan.json.sig +1 -1
  4. package/bin/.agentic-security/scan-history.json +51 -0
  5. package/bin/.agentic-security/streak.json +5 -5
  6. package/bin/agentic-security.js +22 -7
  7. package/dist/178.index.js +1 -1
  8. package/dist/333.index.js +283 -0
  9. package/dist/384.index.js +1 -1
  10. package/dist/476.index.js +5 -5
  11. package/dist/637.index.js +1 -1
  12. package/dist/700.index.js +138 -0
  13. package/dist/718.index.js +53 -0
  14. package/dist/838.index.js +1 -1
  15. package/dist/985.index.js +95 -1
  16. package/dist/agentic-security.mjs +83 -83
  17. package/dist/agentic-security.mjs.sha256 +1 -1
  18. package/package.json +6 -4
  19. package/src/.agentic-security/findings.json +29799 -7803
  20. package/src/.agentic-security/last-scan.json +29799 -7803
  21. package/src/.agentic-security/last-scan.json.sig +1 -1
  22. package/src/.agentic-security/scan-history.json +5119 -2611
  23. package/src/.agentic-security/streak.json +6 -6
  24. package/src/dataflow/.agentic-security/findings.json +2879 -308
  25. package/src/dataflow/.agentic-security/last-scan.json +2879 -308
  26. package/src/dataflow/.agentic-security/last-scan.json.sig +1 -1
  27. package/src/dataflow/.agentic-security/scan-history.json +68 -520
  28. package/src/dataflow/.agentic-security/streak.json +6 -7
  29. package/src/dataflow/cross-service-taint.js +201 -0
  30. package/src/dataflow/engine.js +52 -8
  31. package/src/dataflow/formal-verify.js +204 -0
  32. package/src/dataflow/ifds-precise.js +222 -0
  33. package/src/dataflow/k2-summary-cache.js +153 -0
  34. package/src/dataflow/lib-taint-summaries.js +198 -0
  35. package/src/dataflow/privacy-taint.js +205 -0
  36. package/src/dataflow/smt-feasibility.js +189 -0
  37. package/src/engine.js +890 -132
  38. package/src/integrations/index.js +2 -1
  39. package/src/ir/.agentic-security/findings.json +240 -6
  40. package/src/ir/.agentic-security/last-scan.json +240 -6
  41. package/src/ir/.agentic-security/last-scan.json.sig +1 -1
  42. package/src/ir/.agentic-security/scan-history.json +16 -594
  43. package/src/ir/.agentic-security/streak.json +8 -9
  44. package/src/ir/callgraph.js +27 -7
  45. package/src/ir/cpp-preprocessor.js +142 -0
  46. package/src/ir/csharp-ir.js +604 -0
  47. package/src/ir/universal-ir.js +403 -0
  48. package/src/llm-validator/index.js +7 -5
  49. package/src/mcp/.agentic-security/findings.json +8632 -0
  50. package/src/mcp/.agentic-security/last-scan.json +8632 -0
  51. package/src/mcp/.agentic-security/last-scan.json.sig +1 -0
  52. package/src/mcp/.agentic-security/scan-history.json +143 -0
  53. package/src/mcp/.agentic-security/streak.json +20 -0
  54. package/src/mcp/audit.js +5 -0
  55. package/src/mcp/tools.js +90 -1
  56. package/src/posture/.agentic-security/findings.json +16809 -4367
  57. package/src/posture/.agentic-security/last-scan.json +16809 -4367
  58. package/src/posture/.agentic-security/last-scan.json.sig +1 -1
  59. package/src/posture/.agentic-security/scan-history.json +6689 -177
  60. package/src/posture/.agentic-security/streak.json +8 -7
  61. package/src/posture/api-contract.js +193 -0
  62. package/src/posture/attack-taxonomy.js +227 -0
  63. package/src/posture/calibration-drift.js +2 -1
  64. package/src/posture/calibration.js +3 -2
  65. package/src/posture/compliance-policy.js +218 -0
  66. package/src/posture/composite-risk.js +122 -0
  67. package/src/posture/csharp-analysis.js +330 -0
  68. package/src/posture/exploit-bundle.js +210 -0
  69. package/src/posture/federated-learning.js +172 -0
  70. package/src/posture/fix-history.js +8 -2
  71. package/src/posture/license-attributions.js +94 -0
  72. package/src/posture/license-graph.js +238 -0
  73. package/src/posture/pqc-migration-plan.js +158 -0
  74. package/src/posture/profile.js +4 -5
  75. package/src/posture/reachability-filter.js +33 -2
  76. package/src/posture/realtime-cve-monitor.js +214 -0
  77. package/src/posture/rule-overrides.js +2 -3
  78. package/src/posture/rule-pack-signing.js +2 -3
  79. package/src/posture/rule-synthesis.js +5 -6
  80. package/src/posture/runtime-correlation.js +174 -0
  81. package/src/posture/sbom-diff.js +171 -0
  82. package/src/posture/sca-policy.js +235 -0
  83. package/src/posture/sca-upgrade.js +259 -0
  84. package/src/posture/security-trend.js +4 -7
  85. package/src/posture/state-dir.js +124 -0
  86. package/src/posture/streak.js +3 -0
  87. package/src/posture/suppressions.js +5 -8
  88. package/src/posture/threat-model-auto.js +268 -0
  89. package/src/posture/triage-learning.js +170 -0
  90. package/src/posture/triage.js +29 -6
  91. package/src/posture/validator-metrics.js +3 -6
  92. package/src/sast/.agentic-security/findings.json +996 -32
  93. package/src/sast/.agentic-security/last-scan.json +996 -32
  94. package/src/sast/.agentic-security/last-scan.json.sig +1 -1
  95. package/src/sast/.agentic-security/scan-history.json +565 -32
  96. package/src/sast/.agentic-security/streak.json +10 -8
  97. package/src/sast/_secret-entropy.js +145 -0
  98. package/src/sast/cloud-iam.js +312 -0
  99. package/src/sast/cpp.js +138 -4
  100. package/src/sast/crypto-protocol.js +388 -0
  101. package/src/sast/csharp-tokenizer.js +392 -0
  102. package/src/sast/csharp.js +924 -138
  103. package/src/sast/dapp-frontend.js +200 -0
  104. package/src/sast/db-taint.js +24 -0
  105. package/src/sast/k8s-admission.js +271 -0
  106. package/src/sast/llm-app.js +272 -0
  107. package/src/sast/ml-supply-chain.js +259 -0
  108. package/src/sast/mobile.js +224 -0
  109. package/src/sast/post-quantum-crypto.js +348 -0
  110. package/src/sast/rust.js +26 -0
  111. package/src/sast/web3-advanced.js +375 -0
  112. package/src/sca/.agentic-security/findings.json +6044 -171
  113. package/src/sca/.agentic-security/last-scan.json +6044 -171
  114. package/src/sca/.agentic-security/last-scan.json.sig +1 -1
  115. package/src/sca/.agentic-security/scan-history.json +83 -6
  116. package/src/sca/.agentic-security/streak.json +9 -9
  117. package/src/sca/CLAUDE.md +161 -0
  118. package/src/sca/binary-metadata.js +146 -0
  119. package/src/sca/py-package-functions.js +118 -0
  120. package/src/sca/sigstore-verify.js +215 -0
  121. package/src/sca/vendor-detect.js +53 -0
  122. package/src/report/.agentic-security/findings.json +0 -80
  123. package/src/report/.agentic-security/last-scan.json +0 -80
  124. package/src/report/.agentic-security/last-scan.json.sig +0 -1
  125. package/src/report/.agentic-security/scan-history.json +0 -35
  126. package/src/report/.agentic-security/streak.json +0 -22
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
- 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];
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.
@@ -1465,6 +1554,11 @@ async function _postRemote(url, entry) {
1465
1554
  function auditCall({ sessionRoot, tool, args, outcome, reason }) {
1466
1555
  if (!sessionRoot) return;
1467
1556
  try {
1557
+ // Safety: only write audit log if sessionRoot looks like a project root
1558
+ const MARKERS = ['.git', 'package.json', 'pyproject.toml', 'go.mod', 'Cargo.toml', 'pom.xml', 'composer.json', 'Gemfile'];
1559
+ let hasMarker = false;
1560
+ for (const m of MARKERS) { try { if (external_node_fs_.existsSync(external_node_path_.join(sessionRoot, m))) { hasMarker = true; break; } } catch {} }
1561
+ if (!hasMarker) return;
1468
1562
  const dir = external_node_path_.join(sessionRoot, '.agentic-security');
1469
1563
  external_node_fs_.mkdirSync(dir, { recursive: true });
1470
1564
  const logFile = external_node_path_.join(dir, 'mcp-audit.log');