@clear-capabilities/agentic-security-scanner 0.162.0 → 0.163.1

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 (153) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/bin/agentic-security.js +87 -0
  3. package/dist/1340.index.js +1871 -0
  4. package/dist/3477.index.js +727 -0
  5. package/dist/3499.index.js +23 -3
  6. package/dist/4113.index.js +1 -1
  7. package/dist/5014.index.js +833 -0
  8. package/dist/5756.index.js +2 -2
  9. package/dist/6257.index.js +1 -1
  10. package/dist/6907.index.js +248 -0
  11. package/dist/6994.index.js +1 -1
  12. package/dist/7033.index.js +33 -5
  13. package/dist/7439.index.js +1822 -0
  14. package/dist/7838.index.js +1 -1
  15. package/dist/9560.index.js +2318 -23
  16. package/dist/957.index.js +1 -1
  17. package/dist/9999.index.js +43 -7
  18. package/dist/agentic-security.mjs +12 -12
  19. package/dist/agentic-security.mjs.sha256 +1 -1
  20. package/package.json +33 -6
  21. package/src/capabilities/CLAUDE.md +114 -0
  22. package/src/capabilities/address.js +73 -0
  23. package/src/capabilities/attack-coverage.js +93 -0
  24. package/src/capabilities/decide.js +256 -0
  25. package/src/capabilities/delegate.js +69 -0
  26. package/src/capabilities/egress.js +20 -0
  27. package/src/capabilities/hook-advice.js +50 -0
  28. package/src/capabilities/index.js +32 -0
  29. package/src/capabilities/manifest.js +344 -0
  30. package/src/capabilities/outbound.js +189 -0
  31. package/src/capabilities/paths.js +57 -0
  32. package/src/capabilities/probes.js +211 -0
  33. package/src/capabilities/proxy.js +182 -0
  34. package/src/capabilities/reasons.js +67 -0
  35. package/src/capabilities/receipts.js +356 -0
  36. package/src/capabilities/records.js +58 -0
  37. package/src/capabilities/recovery.js +367 -0
  38. package/src/capabilities/report.js +81 -0
  39. package/src/capabilities/runner.js +236 -0
  40. package/src/capabilities/secrets.js +26 -0
  41. package/src/capabilities/tool-gate.js +119 -0
  42. package/src/capabilities/tool-registry.js +60 -0
  43. package/src/dataflow/CLAUDE.md +30 -0
  44. package/src/dataflow/catalog.js +42 -1
  45. package/src/dataflow/engine.js +67 -2
  46. package/src/dataflow/guard-dominance.js +352 -0
  47. package/src/discovery/CLAUDE.md +9 -0
  48. package/src/discovery/index.js +15 -1
  49. package/src/discovery/lenses.js +18 -0
  50. package/src/engine.js +80 -15
  51. package/src/integrations/index.js +5 -2
  52. package/src/ir/CLAUDE.md +14 -0
  53. package/src/ir/implicit-handler-params.js +74 -0
  54. package/src/ir/parser-cs.js +20 -0
  55. package/src/ir/parser-go.js +30 -13
  56. package/src/ir/parser-java.js +11 -0
  57. package/src/language/nix-eval-isolation.js +33 -5
  58. package/src/lineage/CLAUDE.md +31 -0
  59. package/src/lineage/deployment/adapter-cloud.js +202 -0
  60. package/src/lineage/deployment/adapter-compose.js +90 -0
  61. package/src/lineage/deployment/adapter-kit.js +142 -0
  62. package/src/lineage/deployment/adapter-kubernetes.js +247 -0
  63. package/src/lineage/deployment/attack-paths.js +443 -0
  64. package/src/lineage/deployment/boundaries-run.js +223 -0
  65. package/src/lineage/deployment/boundary-graph.js +567 -0
  66. package/src/lineage/deployment/cross-repo.js +253 -0
  67. package/src/lineage/deployment/drift.js +383 -0
  68. package/src/lineage/deployment/ingest.js +221 -0
  69. package/src/lineage/deployment/projection.js +244 -0
  70. package/src/lineage/deployment/trace-correlation.js +541 -0
  71. package/src/lineage/source-registry.js +19 -0
  72. package/src/mcp/CLAUDE.md +5 -2
  73. package/src/mcp/invariant-tools.js +64 -0
  74. package/src/mcp/portfolio-tools.js +79 -0
  75. package/src/mcp/redact.js +15 -0
  76. package/src/mcp/server.js +24 -3
  77. package/src/mcp/tools.js +13 -1
  78. package/src/posture/CLAUDE.md +332 -1
  79. package/src/posture/accuracy-scorecard.js +95 -4
  80. package/src/posture/assurance/rollback.js +214 -0
  81. package/src/posture/assurance/rollout.js +200 -0
  82. package/src/posture/business-logic.js +26 -4
  83. package/src/posture/evaluation/bakeoff.js +148 -0
  84. package/src/posture/evaluation/custody.js +200 -0
  85. package/src/posture/evaluation/deployment-ablation.js +416 -0
  86. package/src/posture/evaluation/dev-cases.js +65 -0
  87. package/src/posture/evaluation/economics.js +85 -0
  88. package/src/posture/evaluation/gates.js +161 -0
  89. package/src/posture/evaluation/grouping.js +101 -0
  90. package/src/posture/evaluation/interval.js +132 -0
  91. package/src/posture/evaluation/invariant-ablation.js +325 -0
  92. package/src/posture/evaluation/labels.js +200 -0
  93. package/src/posture/evaluation/protocol.js +308 -0
  94. package/src/posture/evaluation/release-gate.js +209 -0
  95. package/src/posture/evaluation/report.js +158 -0
  96. package/src/posture/evaluation/runner.js +273 -0
  97. package/src/posture/evaluation/scan-child.js +80 -0
  98. package/src/posture/evaluation/score.js +174 -0
  99. package/src/posture/evaluation/synthetic.js +90 -0
  100. package/src/posture/evaluation/why-missed.js +219 -0
  101. package/src/posture/fleet.js +11 -2
  102. package/src/posture/invariants/cli.js +95 -0
  103. package/src/posture/invariants/coverage.js +164 -0
  104. package/src/posture/invariants/export.js +178 -0
  105. package/src/posture/invariants/expressions.js +46 -0
  106. package/src/posture/invariants/lifecycle.js +289 -0
  107. package/src/posture/invariants/project-input.js +55 -0
  108. package/src/posture/invariants/repair.js +340 -0
  109. package/src/posture/invariants/run.js +45 -0
  110. package/src/posture/invariants/scenarios.js +311 -0
  111. package/src/posture/invariants/schema.js +167 -0
  112. package/src/posture/invariants/shrink.js +407 -0
  113. package/src/posture/invariants/state-assertions.js +165 -0
  114. package/src/posture/logic-claims.js +12 -0
  115. package/src/posture/model-routing.js +40 -0
  116. package/src/posture/oracles/adapters.js +172 -1
  117. package/src/posture/oracles/conformance.js +3 -2
  118. package/src/posture/oracles/oracle.js +23 -3
  119. package/src/posture/oracles/registry.js +1 -1
  120. package/src/posture/portfolio/backend.js +279 -0
  121. package/src/posture/portfolio/bundle.js +314 -0
  122. package/src/posture/portfolio/cli.js +142 -0
  123. package/src/posture/portfolio/manifest.js +263 -0
  124. package/src/posture/portfolio/progress.js +267 -0
  125. package/src/posture/portfolio/resume.js +130 -0
  126. package/src/posture/portfolio/retention.js +207 -0
  127. package/src/posture/portfolio/scheduler.js +488 -0
  128. package/src/posture/portfolio/signing.js +155 -0
  129. package/src/posture/portfolio/wording.js +59 -0
  130. package/src/posture/portfolio/work-units.js +405 -0
  131. package/src/posture/replay/replay.js +1 -0
  132. package/src/posture/routing/adapter.js +140 -0
  133. package/src/posture/routing/calibration.js +278 -0
  134. package/src/posture/routing/canary.js +141 -0
  135. package/src/posture/routing/control.js +35 -0
  136. package/src/posture/routing/decide.js +211 -0
  137. package/src/posture/routing/drift.js +137 -0
  138. package/src/posture/routing/economics.js +185 -0
  139. package/src/posture/routing/feedback.js +207 -0
  140. package/src/posture/routing/index.js +31 -0
  141. package/src/posture/routing/outcomes.js +281 -0
  142. package/src/posture/routing/promotion.js +291 -0
  143. package/src/posture/routing/receipts.js +59 -0
  144. package/src/posture/routing/report.js +142 -0
  145. package/src/posture/routing/shadow.js +53 -0
  146. package/src/posture/specification-mining.js +26 -0
  147. package/src/posture/verification/patch-negative.js +16 -4
  148. package/src/posture/verification/patch-promotion.js +10 -2
  149. package/src/report/index.js +51 -1
  150. package/src/sandbox/CLAUDE.md +10 -0
  151. package/src/sandbox/backend-userspace.js +91 -13
  152. package/dist/5613.index.js +0 -500
  153. package/dist/6239.index.js +0 -469
package/dist/957.index.js CHANGED
@@ -10,7 +10,7 @@ export const modules = {
10
10
  /* harmony export */ proposeOllamaExplanation: () => (/* binding */ proposeOllamaExplanation)
11
11
  /* harmony export */ });
12
12
  /* unused harmony export buildExplainPrompt */
13
- /* harmony import */ var _egress_redact_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(74831);
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);
@@ -503,7 +503,7 @@ async function runHunter(focusArea, lens, ctx = {}, opts = {}) {
503
503
 
504
504
  let prompt;
505
505
  try {
506
- prompt = (0,discovery_lenses/* buildHunterPrompt */.j)(focusArea, lens, ctx);
506
+ prompt = (0,discovery_lenses/* buildHunterPrompt */.jM)(focusArea, lens, ctx);
507
507
  } catch (err) {
508
508
  const reason = `failed to build hunter prompt: ${err?.message || String(err)}`;
509
509
  appendEntry(transcript, { phase: 'prompt_error', reason });
@@ -959,8 +959,8 @@ function forgetRefuted(memory) {
959
959
 
960
960
  // EXTERNAL MODULE: ./src/posture/verification/emit.js
961
961
  var emit = __webpack_require__(85578);
962
- // EXTERNAL MODULE: ./src/posture/oracles/oracle.js + 4 modules
963
- var oracle = __webpack_require__(80219);
962
+ // EXTERNAL MODULE: ./src/posture/oracles/oracle.js + 1 modules
963
+ var oracle = __webpack_require__(14642);
964
964
  // EXTERNAL MODULE: ./src/posture/assurance/verification-record.js
965
965
  var verification_record = __webpack_require__(29668);
966
966
  // EXTERNAL MODULE: ./src/posture/assurance/identity.js
@@ -1182,6 +1182,8 @@ function deepFreeze(o) {
1182
1182
  return Object.freeze(o);
1183
1183
  }
1184
1184
 
1185
+ // EXTERNAL MODULE: ./src/posture/assurance/config.js
1186
+ var config = __webpack_require__(90385);
1185
1187
  ;// CONCATENATED MODULE: ./src/discovery/index.js
1186
1188
  //
1187
1189
  // Compose the discovery pipeline:
@@ -1202,6 +1204,7 @@ function deepFreeze(o) {
1202
1204
 
1203
1205
 
1204
1206
 
1207
+
1205
1208
  // Bridge a candidate to the deterministic layer. A taint finding at or within
1206
1209
  // two lines of the candidate corroborates it; a modelled sink on the line
1207
1210
  // without a full path is weaker corroboration ("sink-adjacent").
@@ -1344,7 +1347,7 @@ async function runDiscovery(ctx = {}, opts = {}) {
1344
1347
 
1345
1348
  const lenses = [];
1346
1349
  for (const key of lensKeys) {
1347
- const lens = (0,discovery_lenses/* lensByKey */.H)(key);
1350
+ const lens = (0,discovery_lenses/* lensByKey */.Hy)(key);
1348
1351
  // An unknown key must degrade visibly, not vanish via a silent filter.
1349
1352
  if (lens) lenses.push(lens);
1350
1353
  else reasons.push(`unresolved lens key: "${key}"`);
@@ -1480,6 +1483,18 @@ async function runDiscovery(ctx = {}, opts = {}) {
1480
1483
  if (e.ok) verificationRecords.push(e.record);
1481
1484
  }
1482
1485
 
1486
+ // X-402: opt-in invariant proposals. A candidate from a state-oriented lens can suggest a contract; the suggestion is advisory,
1487
+ // `proposed`, authored by the model and never approved here. Off unless `opts.invariantProposals = { config }` and the
1488
+ // `invariant-scenarios` feature is enabled in that config.
1489
+ let invariantProposals = null;
1490
+ if (opts.invariantProposals && (0,config/* featureStatus */.FX)(opts.invariantProposals.config, 'invariant-scenarios').status === 'ok') {
1491
+ invariantProposals = [];
1492
+ for (const f of fresh) {
1493
+ const inv = (0,discovery_lenses/* invariantProposalFor */.gj)({ lens: f.discovery?.lens, title: f.vuln, description: f.description, file: f.file, line: f.line });
1494
+ if (inv) invariantProposals.push({ hypothesisId: f.stableId, invariant: inv });
1495
+ }
1496
+ }
1497
+
1483
1498
  // X-207: opt-in promotion. A hypothesis crosses into a finding ONLY through `promoteHypothesis` (trusted verifier receipt,
1484
1499
  // explicit policy, audit record). `fresh` is unchanged; promoted findings and every decision's audit record are reported
1485
1500
  // separately, and nothing here writes `last-scan.json`. `opts.promote = { policy, verify(hypothesis) -> runOracle result }`.
@@ -1501,6 +1516,7 @@ async function runDiscovery(ctx = {}, opts = {}) {
1501
1516
  fresh,
1502
1517
  verificationRecords,
1503
1518
  ...(promotions ? { promotions } : {}),
1519
+ ...(invariantProposals ? { invariantProposals } : {}),
1504
1520
  duplicates,
1505
1521
  suppressed,
1506
1522
  // `refutedCandidates` holds RAW candidates straight from `disprovePanel`,
@@ -1559,11 +1575,13 @@ async function runDiscovery(ctx = {}, opts = {}) {
1559
1575
  /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
1560
1576
 
1561
1577
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1562
- /* harmony export */ H: () => (/* binding */ lensByKey),
1578
+ /* harmony export */ Hy: () => (/* binding */ lensByKey),
1563
1579
  /* harmony export */ LENSES: () => (/* binding */ LENSES),
1564
- /* harmony export */ j: () => (/* binding */ buildHunterPrompt)
1580
+ /* harmony export */ gj: () => (/* binding */ invariantProposalFor),
1581
+ /* harmony export */ jM: () => (/* binding */ buildHunterPrompt)
1565
1582
  /* harmony export */ });
1566
- /* harmony import */ var _egress_redact_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(74831);
1583
+ /* harmony import */ var _egress_redact_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(11723);
1584
+ /* harmony import */ var _posture_invariants_lifecycle_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(80891);
1567
1585
  //
1568
1586
  // The seven hunting lenses. Each hunter run is one (focus area × lens) pair.
1569
1587
  //
@@ -1574,6 +1592,7 @@ async function runDiscovery(ctx = {}, opts = {}) {
1574
1592
  // no single prompt reaches. `wildcard` exists because a fixed taxonomy is a
1575
1593
  // ceiling, and the classes worth finding are the ones not on the list.
1576
1594
 
1595
+
1577
1596
  const LENSES = Object.freeze([
1578
1597
  { key: 'injection', title: 'Injection', family: 'injection', cwe: 'CWE-74',
1579
1598
  brief: 'Untrusted input reaching an interpreter: SQL, shell, template, XPath, LDAP, or deserialization. Follow the value, not the function name.' },
@@ -1591,6 +1610,23 @@ const LENSES = Object.freeze([
1591
1610
  brief: 'Anything the other lenses do not cover. Prefer the surprising and specific over the generic; report nothing rather than something already obvious.' },
1592
1611
  ]);
1593
1612
 
1613
+ // X-402: the lenses that reason about who may do what to whose data can propose an INVARIANT for a candidate they raise. The
1614
+ // proposal is a skeleton contract authored by the model (`proposed`, with the candidate as source evidence and a high uncertainty),
1615
+ // advisory until a reviewer approves it in the signed ledger. A lens whose candidates are not about state (injection, crypto) has
1616
+ // no mapping and proposes nothing.
1617
+ const TENANT_HINT = /tenant|idor|ownership|object reference|cross[- ]?(?:account|user|org)|leak|another user|other user/i;
1618
+ const WORKFLOW_HINT = /refund|order|status|workflow|state machine|out[- ]of[- ]order|step|approval|checkout|paid|ship/i;
1619
+
1620
+ function invariantProposalFor(candidate) {
1621
+ const text = `${candidate?.title || ''} ${candidate?.description || ''} ${candidate?.rationale || ''}`;
1622
+ let cls = null;
1623
+ if (candidate?.lens === 'authz') cls = TENANT_HINT.test(text) ? 'tenant-isolation' : 'privilege-constraint';
1624
+ else if (candidate?.lens === 'feature-abuse' && TENANT_HINT.test(text)) cls = 'tenant-isolation';
1625
+ else if (candidate?.lens === 'business-logic' && WORKFLOW_HINT.test(text)) cls = 'workflow-order';
1626
+ if (!cls || typeof candidate.file !== 'string') return null;
1627
+ return (0,_posture_invariants_lifecycle_js__WEBPACK_IMPORTED_MODULE_1__/* .inferredInvariant */ .mB)({ class: cls, source: 'discovery-lens', evidence: { file: candidate.file, line: Number.isInteger(candidate.line) ? candidate.line : null, lens: candidate.lens }, uncertainty: 0.85 });
1628
+ }
1629
+
1594
1630
  function lensByKey(key) {
1595
1631
  if (typeof key !== 'string') return null;
1596
1632
  return LENSES.find(l => l.key === key) || null;