@exorcist-98/mcp-server 0.3.3 → 0.3.4
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 +1 -1
- package/dist/index.mjs +36 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -37,7 +37,7 @@ out of results unless you ask for it, and is then marked as untrusted.
|
|
|
37
37
|
```json
|
|
38
38
|
{
|
|
39
39
|
"mcpServers": {
|
|
40
|
-
"exorcist": { "command": "npx", "args": ["-y", "@exorcist-98/mcp-server@0.3.
|
|
40
|
+
"exorcist": { "command": "npx", "args": ["-y", "@exorcist-98/mcp-server@0.3.4"] }
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
```
|
package/dist/index.mjs
CHANGED
|
@@ -32138,12 +32138,30 @@ function envFamilyOwners(name) {
|
|
|
32138
32138
|
for (const [re2, owners] of ENV_FAMILIES) if (re2.test(name)) return owners;
|
|
32139
32139
|
return null;
|
|
32140
32140
|
}
|
|
32141
|
-
|
|
32141
|
+
var PATH_VAR = /(?:CONFIG|_FILES?|_DIR|_HOME|_PATH|_PLUGINS?|CACHEDIR|_CERT\w*|_CA\w*)$/;
|
|
32142
|
+
var ENDPOINT_VAR = /(?:_HOST|_URL|_ENDPOINT|_SERVER)$/;
|
|
32143
|
+
function unlockedValueRisk(name, value, cwd, dynamic) {
|
|
32144
|
+
const runtime = dynamic || /[$`]/.test(value);
|
|
32145
|
+
const say = `${name} is set to a path inside the project, or to a value built at run time, and a tool config can name a program to run or a daemon to reach`;
|
|
32146
|
+
if (runtime) return say;
|
|
32147
|
+
if (PATH_VAR.test(name) && anyInside(value, cwd)) return say;
|
|
32148
|
+
for (const part of value.split(/[\s:,;=]+/u)) {
|
|
32149
|
+
if (part !== "" && (/^[./~]/u.test(part) || part.includes("/")) && insideProject(part, cwd)) return say;
|
|
32150
|
+
}
|
|
32151
|
+
if (ENDPOINT_VAR.test(name)) {
|
|
32152
|
+
const m = /^(?:unix|npipe|file):\/\/(.*)$/.exec(value);
|
|
32153
|
+
const target = m === null ? value : m[1];
|
|
32154
|
+
if ((m !== null || /^[./~]/.test(target)) && insideProject(target, cwd)) return say;
|
|
32155
|
+
}
|
|
32156
|
+
return null;
|
|
32157
|
+
}
|
|
32158
|
+
function envAssignRisk(name, value, cwd, dynamic = false, known, prog) {
|
|
32142
32159
|
const owners = envFamilyOwners(name);
|
|
32143
32160
|
if (owners !== null) {
|
|
32144
32161
|
if (name === "HELM_PLUGINS") return "HELM_PLUGINS names a folder of helm plugins, which are programs, and the guard always refuses it. The person can run it in their own terminal";
|
|
32145
32162
|
const list = known ?? userKnownPrograms();
|
|
32146
|
-
|
|
32163
|
+
const unlocked = prog === void 0 ? owners.some((o) => list.has(o)) : owners.includes(prog) && list.has(prog);
|
|
32164
|
+
if (unlocked) return unlockedValueRisk(name, value, cwd, dynamic);
|
|
32147
32165
|
return `${name} belongs to the environment of ${owners[0]}, and its variables change what the tool runs or trusts (config files, plugins, endpoints, certificates, helpers). The guard refuses them whatever the value. To allow it, add "${owners[0]}" to the list of programs in your own user config, ${KNOWN_PROGRAMS_HINT} (a list inside a repository is never read)`;
|
|
32148
32166
|
}
|
|
32149
32167
|
if (!RISK_ENV.test(name)) return null;
|
|
@@ -32315,7 +32333,7 @@ function route(tool, args, c) {
|
|
|
32315
32333
|
const bad = entry.check?.(parsed.pos, parsed.opts, c) ?? null;
|
|
32316
32334
|
if (bad !== null) return blocked(n, `${n} ${key}`, bad);
|
|
32317
32335
|
if (entry.stop !== void 0) {
|
|
32318
|
-
const ep = parsed.opts.
|
|
32336
|
+
const ep = parsed.opts.filter((o) => o.name === "--entrypoint").pop()?.value;
|
|
32319
32337
|
const inner = [...ep === void 0 ? [] : [ep], ...parsed.rest ?? []];
|
|
32320
32338
|
return inner.length === 0 ? plain : { kind: "follow", words: inner };
|
|
32321
32339
|
}
|
|
@@ -32396,8 +32414,8 @@ var KUBE_NEVER = /* @__PURE__ */ new Map([
|
|
|
32396
32414
|
["--server", "was given a server address, and the request would carry your credentials to it"]
|
|
32397
32415
|
]);
|
|
32398
32416
|
var tableOutputOnly = (_pos, opts) => {
|
|
32399
|
-
const
|
|
32400
|
-
return o
|
|
32417
|
+
const outs = opts.filter((x) => x.name === "-o" || x.name === "--output");
|
|
32418
|
+
return outs.every((o) => o.value !== void 0 && ["wide", "name"].includes(t(o.value).replace(/^=/, ""))) ? null : "was asked for an output format other than the plain table (wide or name), and yaml, json and templates return secret values";
|
|
32401
32419
|
};
|
|
32402
32420
|
var KUBECTL_TOOL = {
|
|
32403
32421
|
name: "kubectl",
|
|
@@ -32543,11 +32561,11 @@ var TOOLS = {
|
|
|
32543
32561
|
};
|
|
32544
32562
|
function devToolPlan(prog, args, ctx2 = {}) {
|
|
32545
32563
|
const c = { env: ctx2.env ?? {}, known: ctx2.known ?? userKnownPrograms(), ...ctx2.cwd === void 0 ? {} : { cwd: ctx2.cwd } };
|
|
32546
|
-
if (c.known.has(prog)) return plain;
|
|
32547
32564
|
for (const [k, v] of Object.entries(c.env)) {
|
|
32548
|
-
const risk = envAssignRisk(k, v, c.cwd, false, c.known);
|
|
32565
|
+
const risk = envAssignRisk(k, v, c.cwd, false, c.known, prog);
|
|
32549
32566
|
if (risk !== null) return blocked(prog, prog, `was given ${risk}`);
|
|
32550
32567
|
}
|
|
32568
|
+
if (c.known.has(prog)) return plain;
|
|
32551
32569
|
const unreadable = args.find((w) => w.dynamic || w.glob);
|
|
32552
32570
|
if (unreadable !== void 0) return blocked(prog, prog, "was given a word built at run time (a variable, a substitution or a pattern), and the guard cannot read what it will be");
|
|
32553
32571
|
switch (prog) {
|
|
@@ -33088,7 +33106,8 @@ function resolveWords(words2, f, ctx2) {
|
|
|
33088
33106
|
const env = { ...f.env };
|
|
33089
33107
|
let i = skipFlags(words2, 1, WRAP_SPECS[prog], prog, prog === "env" || prog === "sudo" || prog === "doas" ? env : void 0);
|
|
33090
33108
|
if (prog === "env" || prog === "sudo" || prog === "doas") {
|
|
33091
|
-
|
|
33109
|
+
const inner = words2[i] !== void 0 && !words2[i]?.dynamic && !words2[i]?.glob ? progName(words2[i].text) : void 0;
|
|
33110
|
+
for (const [k, v] of Object.entries(env)) if (f.env[k] !== v) checkAssign(ctx2, k, v, /[$`]/.test(v), inner);
|
|
33092
33111
|
}
|
|
33093
33112
|
if (prog === "timeout") {
|
|
33094
33113
|
if (words2[i] === void 0 || words2[i]?.dynamic) reject("timeout has no fixed duration");
|
|
@@ -33263,9 +33282,14 @@ function producedText(e) {
|
|
|
33263
33282
|
}
|
|
33264
33283
|
var ENV_DECLARERS = /* @__PURE__ */ new Set(["export", "declare", "typeset", "readonly", "local"]);
|
|
33265
33284
|
var ASSIGN_WORD = /^([A-Za-z_][A-Za-z0-9_]*)=([\s\S]*)$/;
|
|
33266
|
-
function
|
|
33285
|
+
function literalProg(words2) {
|
|
33286
|
+
const w = words2[0];
|
|
33287
|
+
if (w === void 0 || w.dynamic || w.glob || ENV_DECLARERS.has(w.text)) return void 0;
|
|
33288
|
+
return progName(w.text);
|
|
33289
|
+
}
|
|
33290
|
+
function checkAssign(ctx2, name, value, dynamic, prog) {
|
|
33267
33291
|
if (ctx2.mode !== "agent") return;
|
|
33268
|
-
const why = envAssignRisk(name, value, ctx2.cwd, dynamic);
|
|
33292
|
+
const why = envAssignRisk(name, value, ctx2.cwd, dynamic, void 0, prog);
|
|
33269
33293
|
if (why !== null) reject(`${why}. If you trust it, the person can run it in their own terminal`, FIX_SIMPLE);
|
|
33270
33294
|
}
|
|
33271
33295
|
function resolveCommands(commands, ctx2, via, baseEnv) {
|
|
@@ -33275,7 +33299,7 @@ function resolveCommands(commands, ctx2, via, baseEnv) {
|
|
|
33275
33299
|
for (const c of commands) {
|
|
33276
33300
|
const env = { ...persist };
|
|
33277
33301
|
for (const a of c.assigns) {
|
|
33278
|
-
checkAssign(ctx2, a.name, a.value.text, a.value.dynamic);
|
|
33302
|
+
checkAssign(ctx2, a.name, a.value.text, a.value.dynamic, literalProg(c.words));
|
|
33279
33303
|
env[a.name] = a.value.text;
|
|
33280
33304
|
}
|
|
33281
33305
|
let stdinText = null;
|
|
@@ -36377,7 +36401,7 @@ Tell the user. They can undo this with: exorcist vault restore ${r.value.id}`
|
|
|
36377
36401
|
}
|
|
36378
36402
|
|
|
36379
36403
|
// src/index.ts
|
|
36380
|
-
var VERSION = "0.3.
|
|
36404
|
+
var VERSION = "0.3.4";
|
|
36381
36405
|
var ctx = {
|
|
36382
36406
|
cwd: process.cwd(),
|
|
36383
36407
|
approved: [],
|