@intutic/mcp-governance-proxy 2.1.0 → 2.3.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/README.md +34 -18
- package/dist/agentTools.d.ts +68 -0
- package/dist/agentTools.d.ts.map +1 -0
- package/dist/agentTools.js +150 -0
- package/dist/agentTools.js.map +1 -0
- package/dist/anomaly/detectors.js +1 -1
- package/dist/anomaly/detectors.js.map +1 -1
- package/dist/anomaly/index.d.ts +2 -1
- package/dist/anomaly/index.d.ts.map +1 -1
- package/dist/anomaly/index.js.map +1 -1
- package/dist/approvalHold.d.ts +66 -0
- package/dist/approvalHold.d.ts.map +1 -0
- package/dist/approvalHold.js +143 -0
- package/dist/approvalHold.js.map +1 -0
- package/dist/budget.d.ts +133 -0
- package/dist/budget.d.ts.map +1 -0
- package/dist/budget.js +191 -0
- package/dist/budget.js.map +1 -0
- package/dist/config.d.ts +7 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +2 -2
- package/dist/config.js.map +1 -1
- package/dist/daemon/healthMonitor.d.ts +2 -0
- package/dist/daemon/healthMonitor.d.ts.map +1 -1
- package/dist/daemon/healthMonitor.js +60 -27
- package/dist/daemon/healthMonitor.js.map +1 -1
- package/dist/daemon/index.d.ts +0 -2
- package/dist/daemon/index.d.ts.map +1 -1
- package/dist/daemon/index.js +0 -2
- package/dist/daemon/index.js.map +1 -1
- package/dist/daemon/instrumentation.d.ts +2 -2
- package/dist/daemon/instrumentation.js +2 -2
- package/dist/daemon/policyCache.d.ts +38 -3
- package/dist/daemon/policyCache.d.ts.map +1 -1
- package/dist/daemon/policyCache.js +64 -22
- package/dist/daemon/policyCache.js.map +1 -1
- package/dist/daemon/socketServer.d.ts +0 -1
- package/dist/daemon/socketServer.d.ts.map +1 -1
- package/dist/daemon/socketServer.js +0 -1
- package/dist/daemon/socketServer.js.map +1 -1
- package/dist/daemon/statusReporter.d.ts.map +1 -1
- package/dist/daemon/statusReporter.js +0 -1
- package/dist/daemon/statusReporter.js.map +1 -1
- package/dist/daemon/telemetryBatcher.d.ts.map +1 -1
- package/dist/daemon/telemetryBatcher.js +0 -1
- package/dist/daemon/telemetryBatcher.js.map +1 -1
- package/dist/daemonClient.d.ts.map +1 -1
- package/dist/daemonClient.js +0 -1
- package/dist/daemonClient.js.map +1 -1
- package/dist/dlp.d.ts +32 -3
- package/dist/dlp.d.ts.map +1 -1
- package/dist/dlp.js +116 -18
- package/dist/dlp.js.map +1 -1
- package/dist/dlpPii.d.ts +66 -0
- package/dist/dlpPii.d.ts.map +1 -0
- package/dist/dlpPii.js +235 -0
- package/dist/dlpPii.js.map +1 -0
- package/dist/emitter.d.ts +68 -10
- package/dist/emitter.d.ts.map +1 -1
- package/dist/emitter.js +29 -43
- package/dist/emitter.js.map +1 -1
- package/dist/guardedValkey.d.ts +40 -0
- package/dist/guardedValkey.d.ts.map +1 -0
- package/dist/guardedValkey.js +84 -0
- package/dist/guardedValkey.js.map +1 -0
- package/dist/httpJson.d.ts +19 -0
- package/dist/httpJson.d.ts.map +1 -0
- package/dist/httpJson.js +62 -0
- package/dist/httpJson.js.map +1 -0
- package/dist/identity.d.ts +27 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +36 -0
- package/dist/identity.js.map +1 -0
- package/dist/injection.js +1 -1
- package/dist/interceptor.d.ts +135 -8
- package/dist/interceptor.d.ts.map +1 -1
- package/dist/interceptor.js +284 -45
- package/dist/interceptor.js.map +1 -1
- package/dist/policy.d.ts +105 -2
- package/dist/policy.d.ts.map +1 -1
- package/dist/policy.js +188 -40
- package/dist/policy.js.map +1 -1
- package/dist/proxy.d.ts +35 -11
- package/dist/proxy.d.ts.map +1 -1
- package/dist/proxy.js +183 -66
- package/dist/proxy.js.map +1 -1
- package/dist/refusals.d.ts +26 -0
- package/dist/refusals.d.ts.map +1 -0
- package/dist/refusals.js +43 -0
- package/dist/refusals.js.map +1 -0
- package/dist/registryObserver.d.ts +37 -0
- package/dist/registryObserver.d.ts.map +1 -0
- package/dist/registryObserver.js +70 -0
- package/dist/registryObserver.js.map +1 -0
- package/dist/session.d.ts +1 -1
- package/dist/session.js +1 -1
- package/dist/sessionScope.d.ts +1 -1
- package/dist/sessionScope.js +1 -1
- package/dist/sessionStore.d.ts +10 -23
- package/dist/sessionStore.d.ts.map +1 -1
- package/dist/sessionStore.js +17 -76
- package/dist/sessionStore.js.map +1 -1
- package/dist/version.d.ts +12 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +13 -0
- package/dist/version.js.map +1 -0
- package/dist/wasm/context.d.ts +10 -0
- package/dist/wasm/context.d.ts.map +1 -1
- package/dist/wasm/context.js +27 -0
- package/dist/wasm/context.js.map +1 -1
- package/dist/wasm/hostImports.d.ts +3 -3
- package/dist/wasm/hostImports.d.ts.map +1 -1
- package/dist/wasm/hostImports.js +8 -7
- package/dist/wasm/hostImports.js.map +1 -1
- package/dist/wasm/loader.d.ts +8 -1
- package/dist/wasm/loader.d.ts.map +1 -1
- package/dist/wasm/loader.js +2 -0
- package/dist/wasm/loader.js.map +1 -1
- package/dist/wasm/referencedFiles.d.ts +29 -4
- package/dist/wasm/referencedFiles.d.ts.map +1 -1
- package/dist/wasm/referencedFiles.js +48 -21
- package/dist/wasm/referencedFiles.js.map +1 -1
- package/dist/wasm/runner.d.ts +106 -22
- package/dist/wasm/runner.d.ts.map +1 -1
- package/dist/wasm/runner.js +194 -74
- package/dist/wasm/runner.js.map +1 -1
- package/dist/wasm/watch.js +1 -1
- package/dist/wasm/worker.d.ts +10 -6
- package/dist/wasm/worker.d.ts.map +1 -1
- package/dist/wasm/worker.js +93 -9
- package/dist/wasm/worker.js.map +1 -1
- package/package.json +5 -4
- package/dist/toolPoison.d.ts +0 -32
- package/dist/toolPoison.d.ts.map +0 -1
- package/dist/toolPoison.js +0 -81
- package/dist/toolPoison.js.map +0 -1
- package/dist/wasm/fuel.d.ts +0 -35
- package/dist/wasm/fuel.d.ts.map +0 -1
- package/dist/wasm/fuel.js +0 -299
- package/dist/wasm/fuel.js.map +0 -1
- package/dist/wasm/memoryCap.d.ts +0 -21
- package/dist/wasm/memoryCap.d.ts.map +0 -1
- package/dist/wasm/memoryCap.js +0 -54
- package/dist/wasm/memoryCap.js.map +0 -1
- package/dist/wasm/wasmBinary.d.ts +0 -25
- package/dist/wasm/wasmBinary.d.ts.map +0 -1
- package/dist/wasm/wasmBinary.js +0 -100
- package/dist/wasm/wasmBinary.js.map +0 -1
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* guardedValkey.ts — the one Valkey connection a proxy process holds, and the
|
|
3
|
+
* guard every command on it goes through.
|
|
4
|
+
*
|
|
5
|
+
* Two things in a proxy read and write Valkey: the shared session window
|
|
6
|
+
* (sessionStore.ts) and the MCP call budgets (budget.ts). They share this
|
|
7
|
+
* connection, and they share its rule: a command runs only on a connected
|
|
8
|
+
* client, never waits longer than a short timeout, and any failure comes back
|
|
9
|
+
* as `undefined`. What `undefined` means is each caller's business — the
|
|
10
|
+
* session window falls back to its per-process copy; a budget follows the
|
|
11
|
+
* proxy's fail setting.
|
|
12
|
+
*
|
|
13
|
+
* @module
|
|
14
|
+
*/
|
|
15
|
+
import { Redis } from 'ioredis';
|
|
16
|
+
import { createStderrLogger } from './stderrLog.js';
|
|
17
|
+
import { describeConnectionError } from './valkeyErrors.js';
|
|
18
|
+
const log = createStderrLogger('mcp-proxy.valkey');
|
|
19
|
+
/** A command that takes longer than this is treated as Valkey being unavailable. */
|
|
20
|
+
export const VALKEY_COMMAND_TIMEOUT_MS = 200;
|
|
21
|
+
export class GuardedValkey {
|
|
22
|
+
client;
|
|
23
|
+
timeoutMs;
|
|
24
|
+
warned = false;
|
|
25
|
+
constructor(url, opts = {}) {
|
|
26
|
+
this.timeoutMs = opts.timeoutMs ?? VALKEY_COMMAND_TIMEOUT_MS;
|
|
27
|
+
this.client = new Redis(url, {
|
|
28
|
+
lazyConnect: true,
|
|
29
|
+
// No offline queue: a command issued before the connection is up must
|
|
30
|
+
// fail now, not wait for a Valkey that may never answer.
|
|
31
|
+
enableOfflineQueue: false,
|
|
32
|
+
maxRetriesPerRequest: 1,
|
|
33
|
+
connectTimeout: 1000,
|
|
34
|
+
retryStrategy: (times) => Math.min(1000 * 2 ** Math.min(times, 5), 30_000),
|
|
35
|
+
});
|
|
36
|
+
this.client.on('error', (err) => this.warnOnce('Valkey unreachable', err));
|
|
37
|
+
void this.client.connect().catch((err) => this.warnOnce('Valkey connect failed', err));
|
|
38
|
+
}
|
|
39
|
+
/** Runs `op`, or answers `undefined` when Valkey is not connected, too slow, or fails. */
|
|
40
|
+
async run(op, opts = {}) {
|
|
41
|
+
let timer;
|
|
42
|
+
const timeout = new Promise((resolve) => {
|
|
43
|
+
timer = setTimeout(() => resolve(undefined), this.timeoutMs);
|
|
44
|
+
timer.unref();
|
|
45
|
+
});
|
|
46
|
+
try {
|
|
47
|
+
if (this.client.status !== 'ready') {
|
|
48
|
+
const settingUp = this.client.status === 'connecting' || this.client.status === 'connect';
|
|
49
|
+
if (!opts.awaitConnect || !settingUp)
|
|
50
|
+
return undefined;
|
|
51
|
+
const ready = new Promise((resolve) => this.client.once('ready', () => resolve(true)));
|
|
52
|
+
if ((await Promise.race([ready, timeout])) !== true)
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
return await Promise.race([op(this.client), timeout]);
|
|
56
|
+
}
|
|
57
|
+
catch (err) {
|
|
58
|
+
this.warnOnce('Valkey command failed', err);
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
finally {
|
|
62
|
+
if (timer)
|
|
63
|
+
clearTimeout(timer);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
async close() {
|
|
67
|
+
try {
|
|
68
|
+
await this.client.quit();
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
this.client.disconnect();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
warnOnce(msg, err) {
|
|
75
|
+
const detail = { err: describeConnectionError(err) };
|
|
76
|
+
if (this.warned) {
|
|
77
|
+
log.debug(detail, msg);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
this.warned = true;
|
|
81
|
+
log.warn(detail, `${msg} — the anomaly session window falls back to this process, and MCP call budgets follow the fail setting`);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=guardedValkey.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guardedValkey.js","sourceRoot":"","sources":["../src/guardedValkey.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AAE3D,MAAM,GAAG,GAAG,kBAAkB,CAAC,kBAAkB,CAAC,CAAA;AAElD,oFAAoF;AACpF,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,CAAA;AAgB5C,MAAM,OAAO,aAAa;IACf,MAAM,CAAO;IACL,SAAS,CAAQ;IAC1B,MAAM,GAAG,KAAK,CAAA;IAEtB,YAAY,GAAW,EAAE,OAA6B,EAAE;QACtD,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,IAAI,yBAAyB,CAAA;QAC5D,IAAI,CAAC,MAAM,GAAG,IAAI,KAAK,CAAC,GAAG,EAAE;YAC3B,WAAW,EAAE,IAAI;YACjB,sEAAsE;YACtE,yDAAyD;YACzD,kBAAkB,EAAE,KAAK;YACzB,oBAAoB,EAAE,CAAC;YACvB,cAAc,EAAE,IAAI;YACpB,aAAa,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC;SAC3E,CAAC,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E,OAAO,SAAS,CAAA;YACvE,CAAC;YACD,OAAO,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC,CAAA;QACvD,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,CAAC,QAAQ,CAAC,uBAAuB,EAAE,GAAG,CAAC,CAAA;YAC3C,OAAO,SAAS,CAAA;QAClB,CAAC;gBAAS,CAAC;YACT,IAAI,KAAK;gBAAE,YAAY,CAAC,KAAK,CAAC,CAAA;QAChC,CAAC;IACH,CAAC;IAED,KAAK,CAAC,KAAK;QACT,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAA;QAC1B,CAAC;QAAC,MAAM,CAAC;YACP,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAA;QAC1B,CAAC;IACH,CAAC;IAEO,QAAQ,CAAC,GAAW,EAAE,GAAY;QACxC,MAAM,MAAM,GAAG,EAAE,GAAG,EAAE,uBAAuB,CAAC,GAAG,CAAC,EAAE,CAAA;QACpD,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;YACtB,OAAM;QACR,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAA;QAClB,GAAG,CAAC,IAAI,CACN,MAAM,EACN,GAAG,GAAG,wGAAwG,CAC/G,CAAA;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* httpJson.ts — the one HTTP client this package uses to talk to the control
|
|
3
|
+
* plane (node:http/https; no fetch polyfill, no extra dependency).
|
|
4
|
+
*
|
|
5
|
+
* Rejects on a transport error, a timeout, or any status >= 400, with the
|
|
6
|
+
* status in the message — a wrong or removed endpoint must surface as a
|
|
7
|
+
* failure, never as an empty success.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
/** A response with an error status, carrying the status for a caller that acts on it. */
|
|
12
|
+
export declare class HttpStatusError extends Error {
|
|
13
|
+
readonly status: number;
|
|
14
|
+
constructor(status: number, message: string);
|
|
15
|
+
}
|
|
16
|
+
export declare function httpRequest(method: 'GET' | 'POST', url: string, apiKey: string, body?: string, timeoutMs?: number): Promise<string>;
|
|
17
|
+
export declare function getJson(url: string, apiKey: string, timeoutMs?: number): Promise<unknown>;
|
|
18
|
+
export declare function postJson(url: string, apiKey: string, payload: unknown, timeoutMs?: number): Promise<unknown>;
|
|
19
|
+
//# sourceMappingURL=httpJson.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpJson.d.ts","sourceRoot":"","sources":["../src/httpJson.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,yFAAyF;AACzF,qBAAa,eAAgB,SAAQ,KAAK;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM;gBAAd,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAIrD;AAED,wBAAgB,WAAW,CACzB,MAAM,EAAE,KAAK,GAAG,MAAM,EACtB,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,MAAM,EACb,SAAS,SAAO,GACf,OAAO,CAAC,MAAM,CAAC,CA6BjB;AAED,wBAAsB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAE/F;AAED,wBAAsB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAGlH"}
|
package/dist/httpJson.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* httpJson.ts — the one HTTP client this package uses to talk to the control
|
|
3
|
+
* plane (node:http/https; no fetch polyfill, no extra dependency).
|
|
4
|
+
*
|
|
5
|
+
* Rejects on a transport error, a timeout, or any status >= 400, with the
|
|
6
|
+
* status in the message — a wrong or removed endpoint must surface as a
|
|
7
|
+
* failure, never as an empty success.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
import * as node_https from 'node:https';
|
|
12
|
+
import * as node_http from 'node:http';
|
|
13
|
+
/** A response with an error status, carrying the status for a caller that acts on it. */
|
|
14
|
+
export class HttpStatusError extends Error {
|
|
15
|
+
status;
|
|
16
|
+
constructor(status, message) {
|
|
17
|
+
super(message);
|
|
18
|
+
this.status = status;
|
|
19
|
+
this.name = 'HttpStatusError';
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export function httpRequest(method, url, apiKey, body, timeoutMs = 5000) {
|
|
23
|
+
return new Promise((resolve, reject) => {
|
|
24
|
+
const lib = new URL(url).protocol === 'https:' ? node_https : node_http;
|
|
25
|
+
const headers = {
|
|
26
|
+
Authorization: `Bearer ${apiKey}`,
|
|
27
|
+
Accept: 'application/json',
|
|
28
|
+
};
|
|
29
|
+
if (body !== undefined) {
|
|
30
|
+
headers['Content-Type'] = 'application/json';
|
|
31
|
+
headers['Content-Length'] = Buffer.byteLength(body);
|
|
32
|
+
}
|
|
33
|
+
const req = lib.request(url, { method, headers, timeout: timeoutMs }, (res) => {
|
|
34
|
+
const chunks = [];
|
|
35
|
+
res.on('data', (c) => chunks.push(c));
|
|
36
|
+
res.on('end', () => {
|
|
37
|
+
const text = Buffer.concat(chunks).toString('utf-8');
|
|
38
|
+
const status = res.statusCode ?? 0;
|
|
39
|
+
if (status >= 400)
|
|
40
|
+
reject(new HttpStatusError(status, `HTTP ${method} ${url} returned ${status}: ${text.slice(0, 200)}`));
|
|
41
|
+
else
|
|
42
|
+
resolve(text);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
req.on('error', reject);
|
|
46
|
+
req.on('timeout', () => {
|
|
47
|
+
req.destroy();
|
|
48
|
+
reject(new Error(`HTTP ${method} ${url} timed out`));
|
|
49
|
+
});
|
|
50
|
+
if (body !== undefined)
|
|
51
|
+
req.write(body);
|
|
52
|
+
req.end();
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
export async function getJson(url, apiKey, timeoutMs) {
|
|
56
|
+
return JSON.parse(await httpRequest('GET', url, apiKey, undefined, timeoutMs));
|
|
57
|
+
}
|
|
58
|
+
export async function postJson(url, apiKey, payload, timeoutMs) {
|
|
59
|
+
const text = await httpRequest('POST', url, apiKey, JSON.stringify(payload), timeoutMs);
|
|
60
|
+
return text ? JSON.parse(text) : null;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=httpJson.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpJson.js","sourceRoot":"","sources":["../src/httpJson.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,UAAU,MAAM,YAAY,CAAA;AACxC,OAAO,KAAK,SAAS,MAAM,WAAW,CAAA;AAEtC,yFAAyF;AACzF,MAAM,OAAO,eAAgB,SAAQ,KAAK;IACnB;IAArB,YAAqB,MAAc,EAAE,OAAe;QAClD,KAAK,CAAC,OAAO,CAAC,CAAA;QADK,WAAM,GAAN,MAAM,CAAQ;QAEjC,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAA;IAC/B,CAAC;CACF;AAED,MAAM,UAAU,WAAW,CACzB,MAAsB,EACtB,GAAW,EACX,MAAc,EACd,IAAa,EACb,SAAS,GAAG,IAAI;IAEhB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAA;QACvE,MA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,MAAM,CAAC,IAAI,KAAK,CAAC,QAAQ,MAAM,IAAI,GAAG,YAAY,CAAC,CAAC,CAAA;QACtD,CAAC,CAAC,CAAA;QACF,IAAI,IAAI,KAAK,SAAS;YAAE,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QACvC,GAAG,CAAC,GAAG,EAAE,CAAA;IACX,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,GAAW,EAAE,MAAc,EAAE,SAAkB;IAC3E,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,WAAW,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,CAAC,CAAY,CAAA;AAC3F,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,GAAW,EAAE,MAAc,EAAE,OAAgB,EAAE,SAAkB;IAC9F,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC,CAAA;IACvF,OAAO,IAAI,CAAC,CAAC,CAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAa,CAAC,CAAC,CAAC,IAAI,CAAA;AACpD,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* identity.ts — who is calling, as far as this proxy process can tell.
|
|
3
|
+
*
|
|
4
|
+
* Carried on every governance event and hold record. Three of these fields are
|
|
5
|
+
* local observations the control plane records as reported, never as proof:
|
|
6
|
+
* the OS account the proxy runs under, the harness session it shares with its
|
|
7
|
+
* sibling proxies (sessionScope.ts), and the server it fronts. The fourth is
|
|
8
|
+
* the API key's prefix — the first 12 characters of a `vk_` key, which the
|
|
9
|
+
* control plane itself treats as a published identifier rather than a secret
|
|
10
|
+
* (`apiKeyAuth.ts` keys its lookup on it). The member the key belongs to is
|
|
11
|
+
* resolved by the control plane from the key itself, so it is not here: a
|
|
12
|
+
* proxy can claim an OS user, but not a member.
|
|
13
|
+
*
|
|
14
|
+
* @module
|
|
15
|
+
*/
|
|
16
|
+
export interface CallerIdentity {
|
|
17
|
+
/** First 12 characters of the `vk_` API key; absent for any other credential. */
|
|
18
|
+
apiKeyPrefix?: string;
|
|
19
|
+
/** The OS account this proxy runs as. */
|
|
20
|
+
osUser?: string;
|
|
21
|
+
/** The harness session scope shared with sibling proxies, when one could be derived. */
|
|
22
|
+
session?: string;
|
|
23
|
+
/** The MCP server this proxy fronts (`--server-name`). */
|
|
24
|
+
serverName: string;
|
|
25
|
+
}
|
|
26
|
+
export declare function callerIdentity(apiKey: string, serverName: string, session: string | undefined): CallerIdentity;
|
|
27
|
+
//# sourceMappingURL=identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,MAAM,WAAW,cAAc;IAC7B,iFAAiF;IACjF,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,yCAAyC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,wFAAwF;IACxF,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,0DAA0D;IAC1D,UAAU,EAAE,MAAM,CAAA;CACnB;AAcD,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,cAAc,CAO9G"}
|
package/dist/identity.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* identity.ts — who is calling, as far as this proxy process can tell.
|
|
3
|
+
*
|
|
4
|
+
* Carried on every governance event and hold record. Three of these fields are
|
|
5
|
+
* local observations the control plane records as reported, never as proof:
|
|
6
|
+
* the OS account the proxy runs under, the harness session it shares with its
|
|
7
|
+
* sibling proxies (sessionScope.ts), and the server it fronts. The fourth is
|
|
8
|
+
* the API key's prefix — the first 12 characters of a `vk_` key, which the
|
|
9
|
+
* control plane itself treats as a published identifier rather than a secret
|
|
10
|
+
* (`apiKeyAuth.ts` keys its lookup on it). The member the key belongs to is
|
|
11
|
+
* resolved by the control plane from the key itself, so it is not here: a
|
|
12
|
+
* proxy can claim an OS user, but not a member.
|
|
13
|
+
*
|
|
14
|
+
* @module
|
|
15
|
+
*/
|
|
16
|
+
import * as node_os from 'node:os';
|
|
17
|
+
/** The same prefix length the control plane's key lookup uses. */
|
|
18
|
+
const KEY_PREFIX_LENGTH = 12;
|
|
19
|
+
function osUserName() {
|
|
20
|
+
try {
|
|
21
|
+
return node_os.userInfo().username || undefined;
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
// No passwd entry for the uid (some containers): there is no name to report.
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export function callerIdentity(apiKey, serverName, session) {
|
|
29
|
+
return {
|
|
30
|
+
...(apiKey.startsWith('vk_') ? { apiKeyPrefix: apiKey.slice(0, KEY_PREFIX_LENGTH) } : {}),
|
|
31
|
+
...(osUserName() ? { osUser: osUserName() } : {}),
|
|
32
|
+
...(session ? { session } : {}),
|
|
33
|
+
serverName,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=identity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity.js","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,OAAO,MAAM,SAAS,CAAA;AAalC,kEAAkE;AAClE,MAAM,iBAAiB,GAAG,EAAE,CAAA;AAE5B,SAAS,UAAU;IACjB,IAAI,CAAC;QACH,OAAO,OAAO,CAAC,QAAQ,EAAE,CAAC,QAAQ,IAAI,SAAS,CAAA;IACjD,CAAC;IAAC,MAAM,CAAC;QACP,6EAA6E;QAC7E,OAAO,SAAS,CAAA;IAClB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,MAAc,EAAE,UAAkB,EAAE,OAA2B;IAC5F,OAAO;QACL,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,iBAAiB,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACzF,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACjD,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/B,UAAU;KACX,CAAA;AACH,CAAC"}
|
package/dist/injection.js
CHANGED
|
@@ -65,7 +65,7 @@ const PATTERNS = [
|
|
|
65
65
|
*/
|
|
66
66
|
const KILL_THRESHOLD = 2;
|
|
67
67
|
/**
|
|
68
|
-
* Workspace-supplied patterns, compiled
|
|
68
|
+
* Workspace-supplied patterns, compiled. Same contract as
|
|
69
69
|
* `dlp.ts`'s `setDynamicPatterns`: sources come from the control plane's
|
|
70
70
|
* `mcpInjectionPatterns`, an invalid one is dropped and counted, and the
|
|
71
71
|
* hardcoded floor above applies regardless — an unreachable control plane
|
package/dist/interceptor.d.ts
CHANGED
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
* interceptor.ts — tools/call decision engine.
|
|
3
3
|
*
|
|
4
4
|
* Given a tool name and arguments, evaluates:
|
|
5
|
+
* 0. The MCP server registry, server/tool allowlists and SSO group clearance
|
|
5
6
|
* 1. DLP scan (credential / destructive pattern detection)
|
|
6
7
|
* 2. SOP policy rules (fetched from control plane via PolicyClient)
|
|
8
|
+
* 3–5. Prompt injection, anomaly detectors, WASM rules
|
|
9
|
+
* 6. MCP call budgets — last, so only a call that would otherwise run is counted
|
|
7
10
|
*
|
|
8
11
|
* Returns an allow / block / redact decision.
|
|
9
12
|
*
|
|
@@ -13,21 +16,50 @@ import type { AnomalyMode, Disposition } from './anomaly/index.js';
|
|
|
13
16
|
import { SessionState } from './session.js';
|
|
14
17
|
import type { WasmRunner } from './wasm/runner.js';
|
|
15
18
|
import type { PolicyClient } from './policy.js';
|
|
16
|
-
import type
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
19
|
+
import { type GovernanceEmitter } from './emitter.js';
|
|
20
|
+
import type { ApprovalHolds } from './approvalHold.js';
|
|
21
|
+
import { type McpBudgetEnforcer } from './budget.js';
|
|
22
|
+
import type { McpRefusalCode } from './refusals.js';
|
|
23
|
+
/**
|
|
24
|
+
* A refusal: what the agent reads (`reason`), and what a client reads — the
|
|
25
|
+
* stable `code`, the `ruleId` that decided, and any `detail` the code carries
|
|
26
|
+
* (refusals.ts). All three reach the JSON-RPC frame's `error.data`.
|
|
27
|
+
*/
|
|
28
|
+
export interface Block {
|
|
20
29
|
action: 'block';
|
|
21
30
|
reason: string;
|
|
22
|
-
|
|
31
|
+
code: Exclude<McpRefusalCode, 'HELD'>;
|
|
32
|
+
ruleId: string;
|
|
33
|
+
detail?: Record<string, unknown>;
|
|
34
|
+
}
|
|
35
|
+
export type Decision = {
|
|
36
|
+
action: 'allow';
|
|
37
|
+
} | Block | {
|
|
23
38
|
action: 'redact';
|
|
24
39
|
reason: string;
|
|
25
40
|
redactedInput: unknown;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Refused for now, pending a person's approval (`require_approval`). Not a
|
|
44
|
+
* block: the agent is told the hold id and to retry once it is approved,
|
|
45
|
+
* which passes only while the workspace's review-hold bypass is on — see
|
|
46
|
+
* approvalHold.ts. `holdId` is empty when the hold could not be recorded.
|
|
47
|
+
*/
|
|
48
|
+
| {
|
|
49
|
+
action: 'hold';
|
|
50
|
+
reason: string;
|
|
51
|
+
holdId: string;
|
|
52
|
+
ruleId: string;
|
|
26
53
|
};
|
|
27
54
|
export declare class ToolCallInterceptor {
|
|
28
55
|
private readonly policy;
|
|
29
56
|
private readonly emitter;
|
|
30
|
-
|
|
57
|
+
/**
|
|
58
|
+
* The local fail setting (`INTUTIC_MCP_FAIL_OPEN`, config.ts). The
|
|
59
|
+
* workspace's `mcpProxyFailBehavior`, once a policy has delivered it,
|
|
60
|
+
* takes precedence — see {@link failOpen}.
|
|
61
|
+
*/
|
|
62
|
+
private readonly localFailOpen;
|
|
31
63
|
/**
|
|
32
64
|
* The real MCP server this proxy process fronts, from `--server-name`
|
|
33
65
|
* (config.ts, threaded since Phase D's `wrapWithProxy` but unconsumed
|
|
@@ -87,7 +119,27 @@ export declare class ToolCallInterceptor {
|
|
|
87
119
|
* belongs to).
|
|
88
120
|
*/
|
|
89
121
|
private readonly workspaceId;
|
|
90
|
-
|
|
122
|
+
/**
|
|
123
|
+
* Turns a `require_approval` rule into a hold through the control
|
|
124
|
+
* plane's decisions API. `undefined` (construction sites that predate
|
|
125
|
+
* holds) leaves such a call held with nothing recorded, which is still a
|
|
126
|
+
* refusal — never an allow.
|
|
127
|
+
*/
|
|
128
|
+
private readonly holds;
|
|
129
|
+
/**
|
|
130
|
+
* Counts each call against the workspace's MCP call budgets (budget.ts).
|
|
131
|
+
* `undefined` (construction sites that predate budgets) skips them; the
|
|
132
|
+
* proxy always passes one, with no store when it has no Valkey, so a
|
|
133
|
+
* covered call then resolves through the fail setting.
|
|
134
|
+
*/
|
|
135
|
+
private readonly budgets;
|
|
136
|
+
constructor(policy: PolicyClient, emitter: GovernanceEmitter,
|
|
137
|
+
/**
|
|
138
|
+
* The local fail setting (`INTUTIC_MCP_FAIL_OPEN`, config.ts). The
|
|
139
|
+
* workspace's `mcpProxyFailBehavior`, once a policy has delivered it,
|
|
140
|
+
* takes precedence — see {@link failOpen}.
|
|
141
|
+
*/
|
|
142
|
+
localFailOpen?: boolean,
|
|
91
143
|
/**
|
|
92
144
|
* The real MCP server this proxy process fronts, from `--server-name`
|
|
93
145
|
* (config.ts, threaded since Phase D's `wrapWithProxy` but unconsumed
|
|
@@ -146,7 +198,30 @@ export declare class ToolCallInterceptor {
|
|
|
146
198
|
* identity: the MCP SERVER this process fronts, not the WORKSPACE it
|
|
147
199
|
* belongs to).
|
|
148
200
|
*/
|
|
149
|
-
workspaceId?: string
|
|
201
|
+
workspaceId?: string,
|
|
202
|
+
/**
|
|
203
|
+
* Turns a `require_approval` rule into a hold through the control
|
|
204
|
+
* plane's decisions API. `undefined` (construction sites that predate
|
|
205
|
+
* holds) leaves such a call held with nothing recorded, which is still a
|
|
206
|
+
* refusal — never an allow.
|
|
207
|
+
*/
|
|
208
|
+
holds?: ApprovalHolds | undefined,
|
|
209
|
+
/**
|
|
210
|
+
* Counts each call against the workspace's MCP call budgets (budget.ts).
|
|
211
|
+
* `undefined` (construction sites that predate budgets) skips them; the
|
|
212
|
+
* proxy always passes one, with no store when it has no Valkey, so a
|
|
213
|
+
* covered call then resolves through the fail setting.
|
|
214
|
+
*/
|
|
215
|
+
budgets?: McpBudgetEnforcer | undefined);
|
|
216
|
+
/** Set once this process has said that budgets went unchecked under fail-open, so the log says it once. */
|
|
217
|
+
private budgetsUncheckedWarned;
|
|
218
|
+
/**
|
|
219
|
+
* Whether a governance check that cannot complete lets the call through:
|
|
220
|
+
* the workspace's `mcpProxyFailBehavior` when the control plane has sent
|
|
221
|
+
* it, the local `INTUTIC_MCP_FAIL_OPEN` until then (and for a workspace
|
|
222
|
+
* that never chose).
|
|
223
|
+
*/
|
|
224
|
+
get failOpen(): boolean;
|
|
150
225
|
/**
|
|
151
226
|
* Applies the shared reask ladder (Phase 2 anomaly detectors AND Phase 3
|
|
152
227
|
* WASM rules both use this): a session-lifetime attempt counter keyed by
|
|
@@ -156,6 +231,46 @@ export declare class ToolCallInterceptor {
|
|
|
156
231
|
* it, exactly like every other new block reason in this package.
|
|
157
232
|
*/
|
|
158
233
|
private applyReaskLadder;
|
|
234
|
+
/**
|
|
235
|
+
* A `require_approval` rule matched. Returns the hold decision, or `null`
|
|
236
|
+
* when an approved bypass for this exact call lets it continue. Every hold
|
|
237
|
+
* reason names the hold id, who may approve it and when a retry passes, in
|
|
238
|
+
* the words the hook gates print (`holdApprovalHint`), so a person reading
|
|
239
|
+
* the agent's transcript knows what to do.
|
|
240
|
+
*/
|
|
241
|
+
private hold;
|
|
242
|
+
/**
|
|
243
|
+
* Refuses the call when the registry says this server — or this tool on it —
|
|
244
|
+
* may not be used. Returns `null` to let the call continue.
|
|
245
|
+
*
|
|
246
|
+
* A blocked server is refused under either default; under `deny`, so is any
|
|
247
|
+
* server not approved (a candidate, or one the registry has never seen);
|
|
248
|
+
* a disabled tool is refused within any server. All three are definite
|
|
249
|
+
* operator decisions and do not depend on `failOpen`.
|
|
250
|
+
*
|
|
251
|
+
* What does depend on it is a registry this process has never loaded — the
|
|
252
|
+
* control plane unreachable since start, or only the MCP daemon's snapshot
|
|
253
|
+
* seed so far. The last-known registry is kept for as long as the process
|
|
254
|
+
* runs, so this is only ever the never-loaded case. Fail-open lets the call continue
|
|
255
|
+
* unchecked against the registry, exactly as a workspace with no registry;
|
|
256
|
+
* fail-closed refuses it, because a `deny` workspace cannot be told apart
|
|
257
|
+
* from an `allow` one without the registry.
|
|
258
|
+
*/
|
|
259
|
+
private checkRegistry;
|
|
260
|
+
/**
|
|
261
|
+
* The workspace's SSO group policy, applied to the member this proxy's API
|
|
262
|
+
* key resolves to, by `evaluateSsoGroupClearance` — the function the
|
|
263
|
+
* server-side hook gate (`resolveSsoGroupPrivilege`) and the policy snapshot
|
|
264
|
+
* use, so all of them answer alike. A tool matches by its bare MCP name or
|
|
265
|
+
* as `mcp__<server>__<tool>`, the name the harness hooks see for the same
|
|
266
|
+
* call. A tool on the `requireOboFor` list is refused: a proxy has no
|
|
267
|
+
* on-behalf-of token to present.
|
|
268
|
+
*
|
|
269
|
+
* With a policy but no resolved member the groups are unknown, and a
|
|
270
|
+
* high-risk tool is refused rather than allowed — unknown is never granted.
|
|
271
|
+
* Without a policy there is nothing to apply.
|
|
272
|
+
*/
|
|
273
|
+
private checkSsoGroupClearance;
|
|
159
274
|
/**
|
|
160
275
|
* Evaluate a tools/call request and return a governance decision.
|
|
161
276
|
*
|
|
@@ -164,5 +279,17 @@ export declare class ToolCallInterceptor {
|
|
|
164
279
|
* @returns Decision: allow, block, or redact
|
|
165
280
|
*/
|
|
166
281
|
decide(toolName: string, toolInput: unknown): Promise<Decision>;
|
|
282
|
+
/**
|
|
283
|
+
* Counts the call against every budget that covers it, or refuses it when
|
|
284
|
+
* one is used up. The threshold and exceeded events go out once per budget
|
|
285
|
+
* per period (the store claims them), each as a `budget_breach` finding; a
|
|
286
|
+
* refusal also sends `tool_blocked`, as every refusal does, carrying the
|
|
287
|
+
* budget — the control plane files one incident per budget per period from
|
|
288
|
+
* those and counts the rest on it.
|
|
289
|
+
*
|
|
290
|
+
* When the count cannot be checked, the fail setting decides, as for every
|
|
291
|
+
* other governance check that cannot complete.
|
|
292
|
+
*/
|
|
293
|
+
private checkBudgets;
|
|
167
294
|
}
|
|
168
295
|
//# sourceMappingURL=interceptor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interceptor.d.ts","sourceRoot":"","sources":["../src/interceptor.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"interceptor.d.ts","sourceRoot":"","sources":["../src/interceptor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AASH,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,KAAK,EAAE,YAAY,EAAW,MAAM,aAAa,CAAA;AACxD,OAAO,EAAoB,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAA;AACvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mB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