@clear-capabilities/agentic-security-scanner 0.145.0 → 0.147.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 (162) hide show
  1. package/CHANGELOG.md +139 -0
  2. package/bin/agentic-security.js +3508 -69
  3. package/dist/1122.index.js +702 -0
  4. package/dist/{301.index.js → 1301.index.js} +2 -2
  5. package/dist/1379.index.js +591 -0
  6. package/dist/{444.index.js → 1444.index.js} +2 -2
  7. package/dist/{660.index.js → 1660.index.js} +2 -2
  8. package/dist/{700.index.js → 1700.index.js} +2 -2
  9. package/dist/{905.index.js → 1905.index.js} +3 -3
  10. package/dist/{920.index.js → 1920.index.js} +3 -3
  11. package/dist/{238.index.js → 2238.index.js} +3 -3
  12. package/dist/{271.index.js → 2271.index.js} +2 -2
  13. package/dist/{985.index.js → 2376.index.js} +1260 -340
  14. package/dist/2432.index.js +793 -0
  15. package/dist/2659.index.js +93 -0
  16. package/dist/{826.index.js → 2826.index.js} +2 -2
  17. package/dist/{830.index.js → 2830.index.js} +2 -2
  18. package/dist/2923.index.js +298 -0
  19. package/dist/{1.index.js → 3001.index.js} +5 -5
  20. package/dist/{117.index.js → 3117.index.js} +3 -3
  21. package/dist/3180.index.js +307 -0
  22. package/dist/3276.index.js +117 -0
  23. package/dist/{415.index.js → 3415.index.js} +2 -2
  24. package/dist/{499.index.js → 3499.index.js} +2 -2
  25. package/dist/3518.index.js +450 -0
  26. package/dist/{526.index.js → 3526.index.js} +5 -5
  27. package/dist/{736.index.js → 3736.index.js} +4 -4
  28. package/dist/{839.index.js → 3839.index.js} +4 -4
  29. package/dist/{113.index.js → 4113.index.js} +5 -5
  30. package/dist/{265.index.js → 4265.index.js} +2 -2
  31. package/dist/{384.index.js → 4384.index.js} +3 -3
  32. package/dist/4547.index.js +268 -0
  33. package/dist/4863.index.js +422 -0
  34. package/dist/{970.index.js → 4970.index.js} +2 -2
  35. package/dist/5051.index.js +770 -0
  36. package/dist/{144.index.js → 5144.index.js} +5 -5
  37. package/dist/{333.index.js → 5333.index.js} +3 -3
  38. package/dist/5343.index.js +185 -0
  39. package/dist/5350.index.js +866 -0
  40. package/dist/5561.index.js +436 -0
  41. package/dist/{637.index.js → 5637.index.js} +3 -3
  42. package/dist/{449.index.js → 5830.index.js} +2 -2
  43. package/dist/6626.index.js +532 -0
  44. package/dist/6662.index.js +297 -0
  45. package/dist/{675.index.js → 6675.index.js} +5 -5
  46. package/dist/{730.index.js → 6730.index.js} +6 -6
  47. package/dist/6829.index.js +225 -0
  48. package/dist/6944.index.js +130 -0
  49. package/dist/{178.index.js → 7178.index.js} +3 -3
  50. package/dist/{227.index.js → 7227.index.js} +2 -2
  51. package/dist/7310.index.js +520 -0
  52. package/dist/{552.index.js → 7552.index.js} +4 -4
  53. package/dist/7709.index.js +78 -0
  54. package/dist/8218.index.js +160 -0
  55. package/dist/{476.index.js → 8476.index.js} +4 -4
  56. package/dist/{513.index.js → 8513.index.js} +5 -5
  57. package/dist/{520.index.js → 8520.index.js} +2 -2
  58. package/dist/{718.index.js → 8718.index.js} +2 -2
  59. package/dist/{752.index.js → 8752.index.js} +2 -2
  60. package/dist/8846.index.js +100 -0
  61. package/dist/{435.index.js → 9091.index.js} +560 -189
  62. package/dist/{207.index.js → 9207.index.js} +2 -2
  63. package/dist/{220.index.js → 9220.index.js} +2 -2
  64. package/dist/9390.index.js +163 -0
  65. package/dist/{503.index.js → 9503.index.js} +2 -2
  66. package/dist/{801.index.js → 9801.index.js} +2 -2
  67. package/dist/{824.index.js → 9824.index.js} +2 -2
  68. package/dist/agentic-security.mjs +16 -16
  69. package/dist/agentic-security.mjs.sha256 +1 -1
  70. package/dist/compliance-frameworks/hipaa-security-rule.json +3 -2
  71. package/package.json +12 -5
  72. package/src/dataflow/CLAUDE.md +1 -1
  73. package/src/dataflow/catalog.js +42 -0
  74. package/src/dataflow/orm-write-catalog.js +175 -0
  75. package/src/engine.js +92 -1
  76. package/src/ir/CLAUDE.md +1 -0
  77. package/src/ir/chrome-probe.mjs +150 -0
  78. package/src/ir/parser-js.js +94 -7
  79. package/src/lineage/CLAUDE.md +1203 -0
  80. package/src/lineage/DESIGN_DESTINATION_RESOLVER.md +156 -0
  81. package/src/lineage/DESIGN_GRAPH_BUILDER.md +938 -0
  82. package/src/lineage/DESIGN_HANDLING_ANALYZER.md +355 -0
  83. package/src/lineage/DESIGN_INTRAPROCEDURAL.md +628 -0
  84. package/src/lineage/DESIGN_PATH_PROVENANCE.md +3451 -0
  85. package/src/lineage/DESIGN_QUEUE_DETAIL.md +120 -0
  86. package/src/lineage/DESIGN_REGISTRIES.md +880 -0
  87. package/src/lineage/DESIGN_STORE_DETAIL.md +143 -0
  88. package/src/lineage/DESIGN_TRANSIT_PROTECTION.md +245 -0
  89. package/src/lineage/classification.js +56 -0
  90. package/src/lineage/coverage.js +658 -0
  91. package/src/lineage/cross-repo-link.js +107 -0
  92. package/src/lineage/dataflow-graph.schema.json +184 -0
  93. package/src/lineage/decision-story.js +206 -0
  94. package/src/lineage/drift-policy.js +279 -0
  95. package/src/lineage/driver.js +135 -0
  96. package/src/lineage/engine.js +992 -0
  97. package/src/lineage/export-briefing.js +628 -0
  98. package/src/lineage/export-csv.js +62 -0
  99. package/src/lineage/export-json.js +238 -0
  100. package/src/lineage/export-privacy.js +258 -0
  101. package/src/lineage/federation-loader.js +111 -0
  102. package/src/lineage/field-identity.js +78 -0
  103. package/src/lineage/fixtures/build-flagship-fixture.mjs +272 -0
  104. package/src/lineage/fixtures/flagship-graph.json +1453 -0
  105. package/src/lineage/flow-grade.js +221 -0
  106. package/src/lineage/governance-edit.js +169 -0
  107. package/src/lineage/graph-builder.js +1114 -0
  108. package/src/lineage/graph-diff.js +431 -0
  109. package/src/lineage/graph-snapshot.js +180 -0
  110. package/src/lineage/handling-analyzer.js +168 -0
  111. package/src/lineage/ids.js +349 -0
  112. package/src/lineage/impact-assessment.js +76 -0
  113. package/src/lineage/impact-engine.js +268 -0
  114. package/src/lineage/index.js +281 -0
  115. package/src/lineage/language-coverage-tiers.js +58 -0
  116. package/src/lineage/obligation-mapping.js +126 -0
  117. package/src/lineage/obligation-predicates.js +235 -0
  118. package/src/lineage/observation-adapters.js +282 -0
  119. package/src/lineage/observation-correlation.js +622 -0
  120. package/src/lineage/observation-store.js +497 -0
  121. package/src/lineage/path-query.js +410 -0
  122. package/src/lineage/path-store.js +400 -0
  123. package/src/lineage/protection.js +53 -0
  124. package/src/lineage/recipient-profile.js +192 -0
  125. package/src/lineage/recipient-registry.js +394 -0
  126. package/src/lineage/redact-graph.js +224 -0
  127. package/src/lineage/remediation.js +417 -0
  128. package/src/lineage/resolve-destination.js +91 -0
  129. package/src/lineage/runtime-observation.js +464 -0
  130. package/src/lineage/scenario-diff.js +84 -0
  131. package/src/lineage/scenario-engine.js +251 -0
  132. package/src/lineage/scenario.js +101 -0
  133. package/src/lineage/schema.js +167 -0
  134. package/src/lineage/sink-registry.js +427 -0
  135. package/src/lineage/source-registry.js +357 -0
  136. package/src/lineage/source-seeding.js +212 -0
  137. package/src/lineage/summaries.js +590 -0
  138. package/src/lineage/transform-catalog.js +397 -0
  139. package/src/lineage/transit-protection.js +150 -0
  140. package/src/lineage/validate.js +285 -0
  141. package/src/mcp/CLAUDE.md +7 -1
  142. package/src/mcp/dataflow-tools.js +160 -0
  143. package/src/mcp/server.js +1 -1
  144. package/src/mcp/tools.js +2 -1
  145. package/src/pipeline/scan-health.js +19 -1
  146. package/src/posture/CLAUDE.md +19 -0
  147. package/src/posture/artifact-registry.js +52 -0
  148. package/src/posture/auditor-walkthrough.js +76 -0
  149. package/src/posture/compliance-frameworks/hipaa-security-rule.json +3 -2
  150. package/src/posture/obligation-evidence-pack.js +202 -0
  151. package/src/posture/remediation-ledger.js +337 -0
  152. package/src/server/CLAUDE.md +47 -0
  153. package/src/server/graph-loader.js +141 -0
  154. package/src/server/http-server.js +325 -0
  155. package/src/server/routes.js +129 -0
  156. package/src/server/security.js +111 -0
  157. package/src/server/static-assets.js +139 -0
  158. package/dist/11.index.js +0 -353
  159. package/dist/259.index.js +0 -975
  160. package/dist/317.index.js +0 -300
  161. package/dist/609.index.js +0 -741
  162. package/dist/838.index.js +0 -152
@@ -1,5 +1,5 @@
1
- export const id = 207;
2
- export const ids = [207];
1
+ export const id = 9207;
2
+ export const ids = [9207];
3
3
  export const modules = {
4
4
 
5
5
  /***/ 9207:
@@ -1,5 +1,5 @@
1
- export const id = 220;
2
- export const ids = [220];
1
+ export const id = 9220;
2
+ export const ids = [9220];
3
3
  export const modules = {
4
4
 
5
5
  /***/ 9220:
@@ -0,0 +1,163 @@
1
+ export const id = 9390;
2
+ export const ids = [9390];
3
+ export const modules = {
4
+
5
+ /***/ 9390:
6
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
7
+
8
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
9
+ /* harmony export */ auditCall: () => (/* binding */ auditCall)
10
+ /* harmony export */ });
11
+ /* unused harmony export verifyAuditLog */
12
+ /* harmony import */ var node_fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3024);
13
+ /* harmony import */ var node_path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6760);
14
+ /* harmony import */ var node_crypto__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7598);
15
+ /* harmony import */ var _redact_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(3468);
16
+ /* harmony import */ var _posture_state_dir_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(1174);
17
+ // Append-only audit log of MCP tool calls — OWASP MCP08.
18
+ //
19
+ // Format: one JSON object per line (NDJSON) at
20
+ // <sessionRoot>/.agentic-security/mcp-audit.log
21
+ //
22
+ // Each entry carries `prev` — the SHA-256 of the previous entry's serialized
23
+ // form. The first entry's prev is "GENESIS". Tampering with any line breaks
24
+ // the chain from that point forward; a reader can detect partial truncation
25
+ // or in-place edits.
26
+ //
27
+ // REMOTE SINK (post-recommendation #10). The local file alone cannot detect
28
+ // a total rewrite — an attacker with FS write can re-author the whole log
29
+ // with fresh hashes. Closing that blind spot requires an off-host witness.
30
+ // Set $AGENTIC_SECURITY_AUDIT_WEBHOOK to a POST endpoint; every entry is
31
+ // fire-and-forget POSTed there in addition to the local append. Failures
32
+ // to reach the webhook are best-effort — they NEVER block a tool call,
33
+ // because that would let a network outage become a denial of service. They
34
+ // DO get recorded as `_remoteSinkErr` on the local entry, so an operator
35
+ // reviewing the log later can spot a forging attempt that targeted the
36
+ // remote (any gap between local-sequence and remote-sequence is evidence).
37
+ //
38
+ // Argument blobs are redacted (OWASP MCP01/MCP10) so credentials passed in
39
+ // arguments cannot leak via the audit trail OR via the remote sink.
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+ const MAX_ARG_BYTES = 1024;
48
+ const GENESIS = 'GENESIS';
49
+ const REMOTE_TIMEOUT_MS = 1500;
50
+
51
+ // Per-process session ID (harness-anatomy #9). Stamped on every audit entry
52
+ // so downstream metrics can aggregate by session and surface outliers like
53
+ // "200 apply_fix calls in one session." The ID is `<pid>-<short-ts>` — not
54
+ // cryptographically unique, but enough to disambiguate concurrent runs on
55
+ // the same host. Stable for the lifetime of this Node process.
56
+ const SESSION_ID = `${process.pid}-${Date.now().toString(36).slice(-6)}`;
57
+
58
+ function _summarize(args) {
59
+ let s;
60
+ try { s = JSON.stringify(args); } catch { s = '<unserializable>'; }
61
+ s = (0,_redact_js__WEBPACK_IMPORTED_MODULE_4__/* .redactArgsBlob */ .MC)(s);
62
+ if (s.length > MAX_ARG_BYTES) s = s.slice(0, MAX_ARG_BYTES) + `…(+${s.length - MAX_ARG_BYTES})`;
63
+ return s;
64
+ }
65
+
66
+ function _sha(s) { return node_crypto__WEBPACK_IMPORTED_MODULE_2__.createHash('sha256').update(s).digest('hex'); }
67
+
68
+ function _readLastEntryHash(logFile) {
69
+ if (!node_fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(logFile)) return GENESIS;
70
+ try {
71
+ const all = node_fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync(logFile, 'utf8');
72
+ const lines = all.split('\n').filter(Boolean);
73
+ if (!lines.length) return GENESIS;
74
+ return _sha(lines[lines.length - 1]);
75
+ } catch { return GENESIS; }
76
+ }
77
+
78
+ // Fire-and-forget POST to the remote sink. Resolves to null on success,
79
+ // to a short error string on failure. Never throws; never blocks longer
80
+ // than REMOTE_TIMEOUT_MS. The local audit append happens regardless.
81
+ async function _postRemote(url, entry) {
82
+ try {
83
+ const controller = new AbortController();
84
+ const t = setTimeout(() => controller.abort(), REMOTE_TIMEOUT_MS);
85
+ const r = await fetch(url, {
86
+ method: 'POST',
87
+ headers: { 'Content-Type': 'application/json' },
88
+ body: JSON.stringify(entry),
89
+ signal: controller.signal,
90
+ });
91
+ clearTimeout(t);
92
+ if (!r.ok) return `HTTP ${r.status}`;
93
+ return null;
94
+ } catch (e) {
95
+ return String((e && e.message) || e).slice(0, 200);
96
+ }
97
+ }
98
+
99
+ function auditCall({ sessionRoot, tool, args, outcome, reason }) {
100
+ if (!sessionRoot) return;
101
+ try {
102
+ // Safety: only write audit log if sessionRoot looks like a project root
103
+ const MARKERS = ['.git', 'package.json', 'pyproject.toml', 'go.mod', 'Cargo.toml', 'pom.xml', 'composer.json', 'Gemfile'];
104
+ let hasMarker = false;
105
+ for (const m of MARKERS) { try { if (node_fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(node_path__WEBPACK_IMPORTED_MODULE_1__.join(sessionRoot, m))) { hasMarker = true; break; } } catch {} }
106
+ if (!hasMarker) return;
107
+ const dir = (0,_posture_state_dir_js__WEBPACK_IMPORTED_MODULE_3__/* .stateDir */ .Pn)(sessionRoot);
108
+ node_fs__WEBPACK_IMPORTED_MODULE_0__.mkdirSync(dir, { recursive: true });
109
+ const logFile = node_path__WEBPACK_IMPORTED_MODULE_1__.join(dir, 'mcp-audit.log');
110
+ const entry = {
111
+ ts: new Date().toISOString(),
112
+ sessionId: SESSION_ID,
113
+ tool,
114
+ outcome,
115
+ ...(reason ? { reason } : {}),
116
+ args: _summarize(args),
117
+ prev: _readLastEntryHash(logFile),
118
+ };
119
+ node_fs__WEBPACK_IMPORTED_MODULE_0__.appendFileSync(logFile, JSON.stringify(entry) + '\n');
120
+ // Remote sink (post-recommendation #10). Fire-and-forget. We don't await
121
+ // the promise so the tool call returns immediately; the remote POST runs
122
+ // on its own microtask. Failures get logged to a sidecar file so the
123
+ // operator can detect when the sink is unreachable.
124
+ const webhook = process.env.AGENTIC_SECURITY_AUDIT_WEBHOOK;
125
+ if (webhook) {
126
+ _postRemote(webhook, entry).then((err) => {
127
+ if (!err) return;
128
+ try {
129
+ const errFile = node_path__WEBPACK_IMPORTED_MODULE_1__.join(dir, 'mcp-audit.remote-errors.log');
130
+ node_fs__WEBPACK_IMPORTED_MODULE_0__.appendFileSync(errFile, JSON.stringify({
131
+ ts: new Date().toISOString(), entryTs: entry.ts, tool, err,
132
+ }) + '\n');
133
+ } catch { /* nothing else to do */ }
134
+ });
135
+ }
136
+ } catch { /* audit failure must never break a tool call */ }
137
+ }
138
+
139
+ // Verify the chain from start to end. Returns
140
+ // { ok: true, entries: N } if intact
141
+ // { ok: false, brokenAt: <line-index>, expected, got } if any link breaks
142
+ // Reader/operator-facing tool.
143
+ function verifyAuditLog(logFile) {
144
+ if (!fs.existsSync(logFile)) return { ok: true, entries: 0 };
145
+ const text = fs.readFileSync(logFile, 'utf8');
146
+ const lines = text.split('\n').filter(Boolean);
147
+ let expectedPrev = GENESIS;
148
+ for (let i = 0; i < lines.length; i++) {
149
+ let entry;
150
+ try { entry = JSON.parse(lines[i]); }
151
+ catch { return { ok: false, brokenAt: i, reason: 'not JSON' }; }
152
+ if (entry.prev !== expectedPrev) {
153
+ return { ok: false, brokenAt: i, expected: expectedPrev, got: entry.prev };
154
+ }
155
+ expectedPrev = _sha(lines[i]);
156
+ }
157
+ return { ok: true, entries: lines.length };
158
+ }
159
+
160
+
161
+ /***/ })
162
+
163
+ };
@@ -1,5 +1,5 @@
1
- export const id = 503;
2
- export const ids = [503];
1
+ export const id = 9503;
2
+ export const ids = [9503];
3
3
  export const modules = {
4
4
 
5
5
  /***/ 9503:
@@ -1,5 +1,5 @@
1
- export const id = 801;
2
- export const ids = [801];
1
+ export const id = 9801;
2
+ export const ids = [9801];
3
3
  export const modules = {
4
4
 
5
5
  /***/ 9801:
@@ -1,5 +1,5 @@
1
- export const id = 824;
2
- export const ids = [824];
1
+ export const id = 9824;
2
+ export const ids = [9824];
3
3
  export const modules = {
4
4
 
5
5
  /***/ 9824: