@clear-capabilities/agentic-security-scanner 0.145.0 → 0.147.5
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 +266 -0
- package/bin/agentic-security.js +3508 -69
- package/dist/1122.index.js +779 -0
- package/dist/{301.index.js → 1301.index.js} +2 -2
- package/dist/1379.index.js +591 -0
- package/dist/{444.index.js → 1444.index.js} +2 -2
- package/dist/{660.index.js → 1660.index.js} +2 -2
- package/dist/{700.index.js → 1700.index.js} +2 -2
- package/dist/{905.index.js → 1905.index.js} +3 -3
- package/dist/{920.index.js → 1920.index.js} +3 -3
- package/dist/{238.index.js → 2238.index.js} +3 -3
- package/dist/{271.index.js → 2271.index.js} +2 -2
- package/dist/{985.index.js → 2376.index.js} +1260 -340
- package/dist/2432.index.js +793 -0
- package/dist/2659.index.js +93 -0
- package/dist/{826.index.js → 2826.index.js} +2 -2
- package/dist/{830.index.js → 2830.index.js} +2 -2
- package/dist/2923.index.js +298 -0
- package/dist/{1.index.js → 3001.index.js} +5 -5
- package/dist/{117.index.js → 3117.index.js} +3 -3
- package/dist/3180.index.js +379 -0
- package/dist/3276.index.js +117 -0
- package/dist/{415.index.js → 3415.index.js} +2 -2
- package/dist/{499.index.js → 3499.index.js} +2 -2
- package/dist/3518.index.js +450 -0
- package/dist/{526.index.js → 3526.index.js} +5 -5
- package/dist/{736.index.js → 3736.index.js} +4 -4
- package/dist/{839.index.js → 3839.index.js} +4 -4
- package/dist/{113.index.js → 4113.index.js} +5 -5
- package/dist/{265.index.js → 4265.index.js} +2 -2
- package/dist/{384.index.js → 4384.index.js} +3 -3
- package/dist/4547.index.js +268 -0
- package/dist/4863.index.js +422 -0
- package/dist/{970.index.js → 4970.index.js} +2 -2
- package/dist/5051.index.js +841 -0
- package/dist/{144.index.js → 5144.index.js} +5 -5
- package/dist/{333.index.js → 5333.index.js} +3 -3
- package/dist/5343.index.js +185 -0
- package/dist/5350.index.js +866 -0
- package/dist/5561.index.js +436 -0
- package/dist/{637.index.js → 5637.index.js} +3 -3
- package/dist/{449.index.js → 5830.index.js} +2 -2
- package/dist/6626.index.js +532 -0
- package/dist/6662.index.js +297 -0
- package/dist/{675.index.js → 6675.index.js} +5 -5
- package/dist/{730.index.js → 6730.index.js} +6 -6
- package/dist/6829.index.js +225 -0
- package/dist/6944.index.js +130 -0
- package/dist/{178.index.js → 7178.index.js} +3 -3
- package/dist/{227.index.js → 7227.index.js} +2 -2
- package/dist/7310.index.js +520 -0
- package/dist/{552.index.js → 7552.index.js} +4 -4
- package/dist/7709.index.js +78 -0
- package/dist/8218.index.js +160 -0
- package/dist/{476.index.js → 8476.index.js} +4 -4
- package/dist/{513.index.js → 8513.index.js} +5 -5
- package/dist/{520.index.js → 8520.index.js} +2 -2
- package/dist/{718.index.js → 8718.index.js} +2 -2
- package/dist/{752.index.js → 8752.index.js} +2 -2
- package/dist/8846.index.js +100 -0
- package/dist/{435.index.js → 9091.index.js} +560 -189
- package/dist/{207.index.js → 9207.index.js} +2 -2
- package/dist/{220.index.js → 9220.index.js} +2 -2
- package/dist/9390.index.js +163 -0
- package/dist/{503.index.js → 9503.index.js} +2 -2
- package/dist/{801.index.js → 9801.index.js} +2 -2
- package/dist/{824.index.js → 9824.index.js} +2 -2
- package/dist/agentic-security.mjs +16 -16
- package/dist/agentic-security.mjs.sha256 +1 -1
- package/dist/compliance-frameworks/hipaa-security-rule.json +3 -2
- package/dist/frontend/index.html +21 -0
- package/dist/frontend/src/app.js +176 -0
- package/dist/frontend/src/components/evidence-inspector.js +141 -0
- package/dist/frontend/src/components/filter-rail.js +119 -0
- package/dist/frontend/src/components/query-bar.js +126 -0
- package/dist/frontend/src/data/flagship-graph.js +1460 -0
- package/dist/frontend/src/export-entry.js +36 -0
- package/dist/frontend/src/lib/api-client.js +92 -0
- package/dist/frontend/src/lib/contrast.js +34 -0
- package/dist/frontend/src/lib/dom.js +24 -0
- package/dist/frontend/src/lib/escape-html.js +16 -0
- package/dist/frontend/src/lib/flow-path.js +40 -0
- package/dist/frontend/src/lib/focus-controls.js +149 -0
- package/dist/frontend/src/lib/protection-visual.js +46 -0
- package/dist/frontend/src/lib/query-language.js +240 -0
- package/dist/frontend/src/lib/row-filters.js +43 -0
- package/dist/frontend/src/lib/state.js +84 -0
- package/dist/frontend/src/main.js +83 -0
- package/dist/frontend/src/shell.js +184 -0
- package/dist/frontend/src/views/architecture-view.js +798 -0
- package/dist/frontend/src/views/inventory-view.js +292 -0
- package/dist/frontend/src/views/privacy-view.js +172 -0
- package/dist/frontend/src/views/trace-view.js +206 -0
- package/dist/frontend/styles/architecture-view.css +93 -0
- package/dist/frontend/styles/filter-rail.css +34 -0
- package/dist/frontend/styles/inspector.css +69 -0
- package/dist/frontend/styles/inventory-view.css +74 -0
- package/dist/frontend/styles/privacy-view.css +86 -0
- package/dist/frontend/styles/query-bar.css +107 -0
- package/dist/frontend/styles/shell.css +155 -0
- package/dist/frontend/styles/tokens.css +128 -0
- package/dist/frontend/styles/trace-view.css +95 -0
- package/package.json +13 -6
- package/src/dataflow/CLAUDE.md +1 -1
- package/src/dataflow/catalog.js +42 -0
- package/src/dataflow/orm-write-catalog.js +175 -0
- package/src/engine.js +92 -1
- package/src/ir/CLAUDE.md +1 -0
- package/src/ir/chrome-probe.mjs +150 -0
- package/src/ir/parser-js.js +94 -7
- package/src/lineage/CLAUDE.md +1203 -0
- package/src/lineage/DESIGN_DESTINATION_RESOLVER.md +156 -0
- package/src/lineage/DESIGN_GRAPH_BUILDER.md +938 -0
- package/src/lineage/DESIGN_HANDLING_ANALYZER.md +355 -0
- package/src/lineage/DESIGN_INTRAPROCEDURAL.md +628 -0
- package/src/lineage/DESIGN_PATH_PROVENANCE.md +3451 -0
- package/src/lineage/DESIGN_QUEUE_DETAIL.md +120 -0
- package/src/lineage/DESIGN_REGISTRIES.md +880 -0
- package/src/lineage/DESIGN_STORE_DETAIL.md +143 -0
- package/src/lineage/DESIGN_TRANSIT_PROTECTION.md +245 -0
- package/src/lineage/classification.js +56 -0
- package/src/lineage/coverage.js +658 -0
- package/src/lineage/cross-repo-link.js +107 -0
- package/src/lineage/dataflow-graph.schema.json +184 -0
- package/src/lineage/decision-story.js +206 -0
- package/src/lineage/drift-policy.js +279 -0
- package/src/lineage/driver.js +135 -0
- package/src/lineage/engine.js +992 -0
- package/src/lineage/export-briefing.js +628 -0
- package/src/lineage/export-csv.js +62 -0
- package/src/lineage/export-json.js +238 -0
- package/src/lineage/export-privacy.js +258 -0
- package/src/lineage/federation-loader.js +111 -0
- package/src/lineage/field-identity.js +78 -0
- package/src/lineage/fixtures/build-flagship-fixture.mjs +272 -0
- package/src/lineage/fixtures/flagship-graph.json +1453 -0
- package/src/lineage/flow-grade.js +221 -0
- package/src/lineage/governance-edit.js +169 -0
- package/src/lineage/graph-builder.js +1114 -0
- package/src/lineage/graph-diff.js +431 -0
- package/src/lineage/graph-snapshot.js +180 -0
- package/src/lineage/handling-analyzer.js +168 -0
- package/src/lineage/ids.js +349 -0
- package/src/lineage/impact-assessment.js +76 -0
- package/src/lineage/impact-engine.js +268 -0
- package/src/lineage/index.js +281 -0
- package/src/lineage/language-coverage-tiers.js +58 -0
- package/src/lineage/obligation-mapping.js +126 -0
- package/src/lineage/obligation-predicates.js +235 -0
- package/src/lineage/observation-adapters.js +282 -0
- package/src/lineage/observation-correlation.js +622 -0
- package/src/lineage/observation-store.js +497 -0
- package/src/lineage/path-query.js +410 -0
- package/src/lineage/path-store.js +400 -0
- package/src/lineage/protection.js +53 -0
- package/src/lineage/recipient-profile.js +192 -0
- package/src/lineage/recipient-registry.js +394 -0
- package/src/lineage/redact-graph.js +224 -0
- package/src/lineage/remediation.js +417 -0
- package/src/lineage/resolve-destination.js +91 -0
- package/src/lineage/runtime-observation.js +464 -0
- package/src/lineage/scenario-diff.js +84 -0
- package/src/lineage/scenario-engine.js +251 -0
- package/src/lineage/scenario.js +101 -0
- package/src/lineage/schema.js +167 -0
- package/src/lineage/sink-registry.js +427 -0
- package/src/lineage/source-registry.js +357 -0
- package/src/lineage/source-seeding.js +212 -0
- package/src/lineage/summaries.js +590 -0
- package/src/lineage/transform-catalog.js +397 -0
- package/src/lineage/transit-protection.js +150 -0
- package/src/lineage/validate.js +285 -0
- package/src/mcp/CLAUDE.md +7 -1
- package/src/mcp/dataflow-tools.js +160 -0
- package/src/mcp/server.js +1 -1
- package/src/mcp/tools.js +2 -1
- package/src/pipeline/scan-health.js +19 -1
- package/src/posture/CLAUDE.md +19 -0
- package/src/posture/artifact-registry.js +52 -0
- package/src/posture/auditor-walkthrough.js +76 -0
- package/src/posture/compliance-frameworks/hipaa-security-rule.json +3 -2
- package/src/posture/obligation-evidence-pack.js +202 -0
- package/src/posture/remediation-ledger.js +337 -0
- package/src/server/CLAUDE.md +47 -0
- package/src/server/graph-loader.js +141 -0
- package/src/server/http-server.js +325 -0
- package/src/server/routes.js +129 -0
- package/src/server/security.js +111 -0
- package/src/server/static-assets.js +144 -0
- package/src/shared/frontend-root.js +52 -0
- package/dist/11.index.js +0 -353
- package/dist/259.index.js +0 -975
- package/dist/317.index.js +0 -300
- package/dist/609.index.js +0 -741
- package/dist/838.index.js +0 -152
|
@@ -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
|
+
};
|