@nulladrift/core 0.2.0 → 0.3.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.
- package/dist/changes.d.ts +1 -1
- package/dist/changes.js +1 -1
- package/dist/{chunk-3LIIW7B5.js → chunk-I3CGOK56.js} +1 -1
- package/dist/chunk-I3CGOK56.js.map +1 -0
- package/dist/{chunk-J5HYEYAW.js → chunk-N3REN5LN.js} +171 -4
- package/dist/chunk-N3REN5LN.js.map +1 -0
- package/dist/{chunk-GG2RYE4R.js → chunk-QRV36OVZ.js} +8 -1
- package/dist/chunk-QRV36OVZ.js.map +1 -0
- package/dist/diff/index.d.ts +1 -1
- package/dist/diff/index.js +2 -2
- package/dist/diff/schema.d.ts +1 -1
- package/dist/diff/types.js +1 -1
- package/dist/index.d.ts +40 -49
- package/dist/index.js +42 -123
- package/dist/index.js.map +1 -1
- package/dist/lock/canonical.d.ts +1 -1
- package/dist/lock/jsonschema.d.ts +1 -1
- package/dist/lock/normalize.d.ts +1 -1
- package/dist/lock/reseal.d.ts +1 -1
- package/dist/lock/types.d.ts +1 -178
- package/dist/lock/types.js +1 -1
- package/dist/types-CU0za3Jw.d.ts +231 -0
- package/package.json +1 -1
- package/dist/chunk-3LIIW7B5.js.map +0 -1
- package/dist/chunk-GG2RYE4R.js.map +0 -1
- package/dist/chunk-J5HYEYAW.js.map +0 -1
package/dist/changes.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* collector on an old version reports a kind the server has to understand, and a renamed kind
|
|
7
7
|
* breaks a SARIF rule id somebody has already suppressed. Renaming one is a major version.
|
|
8
8
|
*/
|
|
9
|
-
declare const CHANGE_KINDS: readonly ["server.added", "server.removed", "server.renamed", "server.transport.changed", "server.identity.changed", "server.protocol.changed", "server.instructions.changed", "server.capabilities.widened", "server.capabilities.narrowed", "server.capabilities.changed", "tool.added", "tool.removed", "tool.description.changed", "tool.input_schema.widened", "tool.input_schema.narrowed", "tool.input_schema.changed", "tool.output_schema.changed", "tool.behavior.escalated", "tool.behavior.relaxed", "tool.header_params.changed", "tool.changed", "resource.added", "resource.removed", "resource.changed", "resource_template.added", "resource_template.removed", "resource_template.changed", "prompt.added", "prompt.removed", "prompt.changed"];
|
|
9
|
+
declare const CHANGE_KINDS: readonly ["server.added", "server.removed", "server.renamed", "server.transport.changed", "server.identity.changed", "server.protocol.changed", "server.instructions.changed", "server.capabilities.widened", "server.capabilities.narrowed", "server.capabilities.changed", "tool.added", "tool.removed", "tool.description.changed", "tool.input_schema.widened", "tool.input_schema.narrowed", "tool.input_schema.changed", "tool.output_schema.changed", "tool.behavior.escalated", "tool.behavior.relaxed", "tool.header_params.changed", "tool.capability.gained", "tool.changed", "resource.added", "resource.removed", "resource.changed", "resource_template.added", "resource_template.removed", "resource_template.changed", "prompt.added", "prompt.removed", "prompt.changed"];
|
|
10
10
|
type ChangeKind = (typeof CHANGE_KINDS)[number];
|
|
11
11
|
/**
|
|
12
12
|
* Ranking only. Every kind is drift; severity decides what a reviewer reads first, what SARIF
|
package/dist/changes.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lock/types.ts"],"sourcesContent":["/** The shape of `mcp.lock`. Mirrors schema/mcp.lock.schema.json, which is the published contract. */\n\n/**\n * Bumped to 2 when the root stopped naming a protocol.\n *\n * Version 1 keyed everything under `servers`, which made the format MCP's rather than the\n * product's: an agent's grants, an OpenAPI surface or a token's scopes had nowhere to live\n * without a second root key and a second diff path. Version 2 keys them all under `subjects`,\n * each tagged with what it is.\n *\n * A version 1 file is upgraded on read rather than refused, and the upgrade is lossless:\n * `kind` is not part of any digest (see `reseal.ts`, which covers an explicit field list), so\n * an upgraded lock reseals to exactly the digests it arrived with and nobody sees drift that\n * is really a format change.\n */\nexport const LOCKFILE_VERSION = 2;\n\nimport type { CapabilityKind } from \"../risk/capability\";\n\nexport type JsonValue = string | number | boolean | null | JsonValue[] | { [key: string]: JsonValue };\nexport type JsonObject = { [key: string]: JsonValue };\n\nexport interface Lockfile {\n lockfileVersion: number;\n generatedBy?: string;\n policy?: LockPolicy;\n /**\n * Everything this project has pinned, keyed by identity. One map rather than a key per kind,\n * so adding a kind is a new member of `LockedSubject` and not a new branch in every consumer.\n */\n subjects: Record<string, LockedSubject>;\n}\n\n/**\n * What a pinned thing is.\n *\n * The list is short because only one reader exists. The point of naming it at all is that the\n * diff engine, the policy evaluator and the audit log already do not care which one they are\n * looking at, so the cost of the second is a reader and a vocabulary rather than a redesign.\n */\nexport const SUBJECT_KINDS = [\"mcp-server\"] as const;\nexport type SubjectKind = (typeof SUBJECT_KINDS)[number];\n\nexport interface LockPolicy {\n /** Reverse-DNS `_meta` key prefixes to leave out, for servers that put build ids there. */\n ignoreMetaPrefixes?: string[];\n allowUnreachable?: boolean;\n /**\n * Capabilities no server in this project may have. Checked against the surface itself rather\n * than against the diff, so accepting drift cannot make one allowed and a repository that never\n * changes is still covered.\n *\n * There is deliberately no steering equivalent: a capability is a fact about schema shape, and\n * a steering signal is a regular expression over prose that legitimate servers trip.\n */\n deniedCapabilities?: CapabilityKind[];\n}\n\nexport type ClientKind =\n | \"claude-code\"\n | \"claude-desktop\"\n | \"vscode\"\n | \"cursor\"\n | \"copilot\"\n | \"windsurf\"\n | \"generic\"\n | \"manual\";\n\nexport interface LockedSource {\n client: ClientKind;\n /** Repo-relative where possible, else with the home directory written as `~`. Never an absolute machine path. */\n file: string;\n scope?: \"project\" | \"user\" | \"local\";\n}\n\nexport interface LockedStdioTransport {\n type: \"stdio\";\n command: string;\n args?: string[];\n /** Names only. The lock is committed; the values are credentials. */\n envKeys?: string[];\n cwd?: string;\n}\n\nexport interface LockedHttpTransport {\n type: \"http\" | \"sse\";\n /** Query string removed: query strings routinely carry tokens. */\n url: string;\n headerKeys?: string[];\n}\n\nexport type LockedTransport = LockedStdioTransport | LockedHttpTransport;\n\nexport interface LockedProtocol {\n era: \"modern\" | \"legacy\";\n version: string;\n supportedVersions?: string[];\n}\n\nexport interface LockedServerInfo {\n name?: string;\n title?: string;\n version?: string;\n description?: string;\n websiteUrl?: string;\n}\n\nexport interface LockedAnnotations {\n title?: string;\n readOnlyHint?: boolean;\n destructiveHint?: boolean;\n idempotentHint?: boolean;\n openWorldHint?: boolean;\n}\n\n/** Annotations resolved against the spec's defaults. See docs/lockfile.md §4. */\nexport interface LockedBehavior {\n readOnly: boolean;\n destructive: boolean;\n idempotent: boolean;\n openWorld: boolean;\n}\n\nexport interface LockedIcon {\n src: string;\n mimeType?: string;\n sizes?: string[];\n theme?: \"light\" | \"dark\";\n}\n\nexport interface LockedTool {\n name: string;\n title?: string;\n description?: string;\n inputSchema: JsonObject;\n outputSchema?: JsonObject;\n annotations?: LockedAnnotations;\n behavior: LockedBehavior;\n /** `propertyPath -> HeaderName`, sorted. Derived from `x-mcp-header`. */\n headerParams?: string[];\n icons?: LockedIcon[];\n meta?: JsonObject;\n digest: string;\n}\n\nexport interface LockedResource {\n uri: string;\n name: string;\n title?: string;\n description?: string;\n mimeType?: string;\n annotations?: JsonObject;\n icons?: LockedIcon[];\n meta?: JsonObject;\n digest: string;\n}\n\nexport interface LockedResourceTemplate {\n uriTemplate: string;\n name: string;\n title?: string;\n description?: string;\n mimeType?: string;\n annotations?: JsonObject;\n icons?: LockedIcon[];\n meta?: JsonObject;\n digest: string;\n}\n\nexport interface LockedPromptArgument {\n name: string;\n title?: string;\n description?: string;\n required?: boolean;\n}\n\nexport interface LockedPrompt {\n name: string;\n title?: string;\n description?: string;\n arguments?: LockedPromptArgument[];\n icons?: LockedIcon[];\n meta?: JsonObject;\n digest: string;\n}\n\n/** What every pinned thing carries, whatever it is. */\nexport interface LockedSubjectBase {\n kind: SubjectKind;\n source: LockedSource;\n digest: string;\n}\n\n/** An MCP server's declared capability surface. The first subject kind, and so far the only one. */\nexport interface LockedMcpServer extends LockedSubjectBase {\n kind: \"mcp-server\";\n transport: LockedTransport;\n protocol: LockedProtocol;\n serverInfo?: LockedServerInfo;\n capabilities?: JsonObject;\n instructions?: string;\n tools?: LockedTool[];\n resources?: LockedResource[];\n resourceTemplates?: LockedResourceTemplate[];\n prompts?: LockedPrompt[];\n}\n\n/**\n * A union of one, deliberately. An agent's grants or an OpenAPI surface joins here, and every\n * consumer that switches on `kind` gets a compiler error pointing at the branch it is missing.\n */\nexport type LockedSubject = LockedMcpServer;\n\n/** Anything in the lock that carries its own digest and is matched by a stable key. */\nexport type LockedMember = LockedTool | LockedResource | LockedResourceTemplate | LockedPrompt;\n"],"mappings":";AAeO,IAAM,mBAAmB;AAyBzB,IAAM,gBAAgB,CAAC,YAAY;","names":[]}
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
SEVERITY,
|
|
6
6
|
sortChanges
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-QRV36OVZ.js";
|
|
8
8
|
import {
|
|
9
9
|
stableKey
|
|
10
10
|
} from "./chunk-HLTEHLNF.js";
|
|
@@ -12,6 +12,125 @@ import {
|
|
|
12
12
|
isEscalation
|
|
13
13
|
} from "./chunk-ERWDYBMA.js";
|
|
14
14
|
|
|
15
|
+
// src/risk/untrusted.ts
|
|
16
|
+
function objectsIn(value) {
|
|
17
|
+
if (!Array.isArray(value)) return [];
|
|
18
|
+
return value.filter((member) => typeof member === "object" && member !== null);
|
|
19
|
+
}
|
|
20
|
+
function objectOr(value) {
|
|
21
|
+
return typeof value === "object" && value !== null ? value : {};
|
|
22
|
+
}
|
|
23
|
+
function stringOr(value) {
|
|
24
|
+
return typeof value === "string" ? value : void 0;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// src/risk/capability.ts
|
|
28
|
+
var CAPABILITY_SEVERITIES = ["critical", "high", "medium", "low"];
|
|
29
|
+
var CAPABILITY_KINDS = [
|
|
30
|
+
"process-exec",
|
|
31
|
+
"code-eval",
|
|
32
|
+
"credential-access",
|
|
33
|
+
"file-write",
|
|
34
|
+
"network-egress",
|
|
35
|
+
"database",
|
|
36
|
+
"privilege",
|
|
37
|
+
"agent-control",
|
|
38
|
+
"env-access",
|
|
39
|
+
"file-read"
|
|
40
|
+
];
|
|
41
|
+
var RULES = [
|
|
42
|
+
{ kind: "process-exec", severity: "critical", name: /(^|_)(exec|execute|spawn|shell|bash|sh|cmd|command|run_command|terminal|subprocess)(_|$)/, arg: /(^|_)(command|cmd|argv|shell|exec|script)(_|$)/ },
|
|
43
|
+
// `source` is deliberately absent: in `copy_file(source, destination)` it is a path, and
|
|
44
|
+
// labelling a file copy as arbitrary code execution at CRITICAL is the false positive that
|
|
45
|
+
// teaches people to stop reading the line. `code` has to be the whole argument name for the
|
|
46
|
+
// same reason -- a crawl of 468 published tools flagged `location_code` as arbitrary code
|
|
47
|
+
// execution, and `country_code`, `status_code` and `zip_code` are all waiting behind it.
|
|
48
|
+
{ kind: "code-eval", severity: "critical", name: /(^|_)(eval|evaluate|run_code|exec_code|interpret|compile)(_|$)/, arg: /^code$|(^|_)(source_code|code_to_run|js_code|python_code|expression|program|snippet)(_|$)/ },
|
|
49
|
+
{ kind: "credential-access", severity: "critical", name: /(^|_)(secret|secrets|credential|credentials|token|keychain|vault|password)(_|$)/, arg: /(^|_)(secret|credential|password|private_key|api_key|access_token)(_|$)/ },
|
|
50
|
+
{ kind: "file-write", severity: "high", name: /(^|_)(write|create_file|put_file|save|delete|remove|unlink|rename|move|copy|chmod|mkdir|rmdir|edit)(_|$)/, arg: /(^|_)(contents|content|data|destination|dest_path|target_path)(_|$)/ },
|
|
51
|
+
{ kind: "network-egress", severity: "high", name: /(^|_)(fetch|request|http|curl|download|upload|post|webhook|navigate|browse|send)(_|$)/, arg: /(^|_)(url|uri|endpoint|host|hostname|webhook|callback)(_|$)/ },
|
|
52
|
+
// Narrowed to things that are actually SQL-shaped. `query`, `select` and `update` on their
|
|
53
|
+
// own matched `simulate-research-query`, `browser_select_option` and `trigger-resource-update`,
|
|
54
|
+
// none of which is a database.
|
|
55
|
+
{ kind: "database", severity: "high", name: /(^|_)(sql|execute_sql|run_sql|query_db|db_query|migrate)(_|$)/, arg: /(^|_)(sql|statement|dsn|connection_string)(_|$)/ },
|
|
56
|
+
{ kind: "privilege", severity: "high", name: /(^|_)(sudo|root|admin|grant|revoke|permission|permissions|acl|policy)(_|$)/, arg: /(^|_)(role|scope|scopes|permission|permissions|privilege)(_|$)/ },
|
|
57
|
+
{ kind: "agent-control", severity: "high", name: /(^|_)(prompt|system_prompt|instruction|instructions|memory|context|persona)(_|$)/, arg: /(^|_)(system_prompt|instruction|instructions|persona)(_|$)/ },
|
|
58
|
+
{ kind: "env-access", severity: "medium", name: /(^|_)(env|environment|getenv|setenv|config|settings)(_|$)/, arg: /(^|_)(env|environment|env_var)(_|$)/ },
|
|
59
|
+
{ kind: "file-read", severity: "low", name: /(^|_)(read|read_file|cat|open|load|list_directory|ls|glob|search_files)(_|$)/, arg: /(^|_)(path|file|filename|filepath|directory|dir)(_|$)/ }
|
|
60
|
+
];
|
|
61
|
+
var CONFUSABLES = {
|
|
62
|
+
"\u0430": "a",
|
|
63
|
+
"\u0435": "e",
|
|
64
|
+
"\u043E": "o",
|
|
65
|
+
"\u0441": "c",
|
|
66
|
+
"\u0440": "p",
|
|
67
|
+
"\u0445": "x",
|
|
68
|
+
"\u0443": "y",
|
|
69
|
+
"\u0456": "i",
|
|
70
|
+
"\u0458": "j",
|
|
71
|
+
"\u04BB": "h",
|
|
72
|
+
"\u0501": "d",
|
|
73
|
+
"\u051B": "q",
|
|
74
|
+
"\u03BF": "o",
|
|
75
|
+
"\u03B1": "a",
|
|
76
|
+
"\u03B5": "e",
|
|
77
|
+
"\u03BD": "v",
|
|
78
|
+
"\u03C1": "p",
|
|
79
|
+
"\u03C5": "u",
|
|
80
|
+
"\u0131": "i",
|
|
81
|
+
"\u1E9E": "s"
|
|
82
|
+
};
|
|
83
|
+
var CONFUSABLE_PATTERN = new RegExp(`[${Object.keys(CONFUSABLES).join("")}]`, "g");
|
|
84
|
+
function normalize(identifier) {
|
|
85
|
+
return identifier.toLowerCase().replace(CONFUSABLE_PATTERN, (character) => CONFUSABLES[character] ?? character).replace(/[-.\s/]+/g, "_");
|
|
86
|
+
}
|
|
87
|
+
function argumentNames(inputSchema, depth = 0) {
|
|
88
|
+
if (depth > 6 || typeof inputSchema !== "object" || inputSchema === null) return [];
|
|
89
|
+
const node = inputSchema;
|
|
90
|
+
const names = [];
|
|
91
|
+
const properties = node.properties;
|
|
92
|
+
if (typeof properties === "object" && properties !== null) {
|
|
93
|
+
for (const [name, child] of Object.entries(properties)) {
|
|
94
|
+
names.push(name);
|
|
95
|
+
names.push(...argumentNames(child, depth + 1));
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (node.items !== void 0) names.push(...argumentNames(node.items, depth + 1));
|
|
99
|
+
return names;
|
|
100
|
+
}
|
|
101
|
+
function toolCapabilities(tool) {
|
|
102
|
+
const subject = objectOr(tool);
|
|
103
|
+
const name = normalize(stringOr(subject.name) ?? "");
|
|
104
|
+
const args = argumentNames(subject.inputSchema).map((argument) => [argument, normalize(argument)]);
|
|
105
|
+
const found = /* @__PURE__ */ new Map();
|
|
106
|
+
for (const rule of RULES) {
|
|
107
|
+
if (found.has(rule.kind)) continue;
|
|
108
|
+
if (rule.name?.test(name)) {
|
|
109
|
+
found.set(rule.kind, { kind: rule.kind, severity: rule.severity, evidence: "name" });
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
const hit = rule.arg ? args.find(([, normalized]) => rule.arg?.test(normalized)) : void 0;
|
|
113
|
+
if (hit) found.set(rule.kind, { kind: rule.kind, severity: rule.severity, evidence: `arg:${hit[0]}` });
|
|
114
|
+
}
|
|
115
|
+
return [...found.values()].sort(
|
|
116
|
+
(a, b) => CAPABILITY_SEVERITIES.indexOf(a.severity) - CAPABILITY_SEVERITIES.indexOf(b.severity) || a.kind.localeCompare(b.kind)
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
function surfaceCapabilities(tools) {
|
|
120
|
+
const byKind = /* @__PURE__ */ new Map();
|
|
121
|
+
for (const tool of objectsIn(tools)) {
|
|
122
|
+
const label = stringOr(tool.name) ?? "?";
|
|
123
|
+
for (const capability of toolCapabilities(tool)) {
|
|
124
|
+
const existing = byKind.get(capability.kind);
|
|
125
|
+
if (existing) existing.tools.push(label);
|
|
126
|
+
else byKind.set(capability.kind, { ...capability, tools: [label] });
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return [...byKind.values()].sort(
|
|
130
|
+
(a, b) => CAPABILITY_SEVERITIES.indexOf(a.severity) - CAPABILITY_SEVERITIES.indexOf(b.severity) || a.kind.localeCompare(b.kind)
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
15
134
|
// src/diff/index.ts
|
|
16
135
|
function change(kind, server, summary, extra) {
|
|
17
136
|
return { kind, severity: SEVERITY[kind], server, summary, ...extra };
|
|
@@ -47,6 +166,32 @@ function compareCapabilities(before, after, name) {
|
|
|
47
166
|
}
|
|
48
167
|
return [change("server.capabilities.changed", name, "declared capabilities changed", { before: before.capabilities, after: after.capabilities })];
|
|
49
168
|
}
|
|
169
|
+
var CAPABILITY_SEVERITY = {
|
|
170
|
+
critical: "high",
|
|
171
|
+
high: "high",
|
|
172
|
+
medium: "medium",
|
|
173
|
+
low: "low"
|
|
174
|
+
};
|
|
175
|
+
function compareToolCapabilities(server, before, after) {
|
|
176
|
+
const previous = indexBy(before, (tool) => tool.name);
|
|
177
|
+
const changes = [];
|
|
178
|
+
for (const tool of after ?? []) {
|
|
179
|
+
const existing = previous.get(tool.name);
|
|
180
|
+
if (!existing) continue;
|
|
181
|
+
const had = new Set(toolCapabilities(existing).map((capability) => capability.kind));
|
|
182
|
+
for (const capability of toolCapabilities(tool)) {
|
|
183
|
+
if (had.has(capability.kind)) continue;
|
|
184
|
+
changes.push(
|
|
185
|
+
change("tool.capability.gained", server, `can now ${capability.kind} (${capability.evidence})`, {
|
|
186
|
+
member: tool.name,
|
|
187
|
+
severity: CAPABILITY_SEVERITY[capability.severity],
|
|
188
|
+
after: { kind: capability.kind, severity: capability.severity, evidence: capability.evidence }
|
|
189
|
+
})
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return changes;
|
|
194
|
+
}
|
|
50
195
|
function compareTool(name, before, after) {
|
|
51
196
|
if (before.digest === after.digest) return [];
|
|
52
197
|
const changes = [];
|
|
@@ -104,7 +249,10 @@ function compareMembers(name, before, after, spec, deep) {
|
|
|
104
249
|
for (const [key, member] of next) {
|
|
105
250
|
const existing = previous.get(key);
|
|
106
251
|
if (!existing) {
|
|
107
|
-
|
|
252
|
+
const extra = spec.arriving?.(member);
|
|
253
|
+
changes.push(
|
|
254
|
+
change(spec.added, name, `new ${spec.noun} ${spec.label(member)}${extra ? ` \xB7 ${extra}` : ""}`, { member: spec.label(member), after: member })
|
|
255
|
+
);
|
|
108
256
|
continue;
|
|
109
257
|
}
|
|
110
258
|
if (existing.digest === member.digest) continue;
|
|
@@ -148,10 +296,22 @@ function compareServer(name, before, after) {
|
|
|
148
296
|
name,
|
|
149
297
|
before.tools,
|
|
150
298
|
after.tools,
|
|
151
|
-
{
|
|
299
|
+
{
|
|
300
|
+
key: (t) => t.name,
|
|
301
|
+
label: (t) => t.name,
|
|
302
|
+
added: "tool.added",
|
|
303
|
+
removed: "tool.removed",
|
|
304
|
+
changed: "tool.changed",
|
|
305
|
+
noun: "tool",
|
|
306
|
+
arriving: (t) => {
|
|
307
|
+
const can = toolCapabilities(t);
|
|
308
|
+
return can.length > 0 ? `can ${can.map((capability) => capability.kind).join(", ")}` : "";
|
|
309
|
+
}
|
|
310
|
+
},
|
|
152
311
|
(_key, a, b) => compareTool(name, a, b)
|
|
153
312
|
)
|
|
154
313
|
);
|
|
314
|
+
changes.push(...compareToolCapabilities(name, before.tools, after.tools));
|
|
155
315
|
changes.push(
|
|
156
316
|
...compareMembers(name, before.resources, after.resources, {
|
|
157
317
|
key: (r) => r.uri,
|
|
@@ -232,6 +392,13 @@ function diffLockfiles(before, after) {
|
|
|
232
392
|
}
|
|
233
393
|
|
|
234
394
|
export {
|
|
395
|
+
objectsIn,
|
|
396
|
+
objectOr,
|
|
397
|
+
stringOr,
|
|
398
|
+
CAPABILITY_SEVERITIES,
|
|
399
|
+
CAPABILITY_KINDS,
|
|
400
|
+
toolCapabilities,
|
|
401
|
+
surfaceCapabilities,
|
|
235
402
|
diffLockfiles
|
|
236
403
|
};
|
|
237
|
-
//# sourceMappingURL=chunk-
|
|
404
|
+
//# sourceMappingURL=chunk-N3REN5LN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/risk/untrusted.ts","../src/risk/capability.ts","../src/diff/index.ts"],"sourcesContent":["/**\n * Coercion for values that arrived from somewhere else.\n *\n * Everything in `risk/` reads a declaration a server sent, or a reading a collector posted. The\n * types say `{ name?: string }[]`, and a type is a claim about a value this code never checked:\n * `tools` is whatever was in the JSON, so it can be absent, a string, or an array with a `null`\n * in it. `tool.name` on that `null` throws a TypeError.\n *\n * In the CLI that aborts one audit, which is survivable. In the control plane the same call sits\n * inside ingest, where one malformed element in one tool of one server would fail the whole\n * request -- every other server in that reading included. A classifier is a security control, and\n * a security control that can be switched off by sending it a `null` is one an attacker turns off\n * rather than evades.\n *\n * So the guard belongs here, at the point the value is first believed, rather than at each of the\n * places that go on to read it.\n */\n\n/** The members of `value` that are objects, or an empty list if it is not a list at all. */\nexport function objectsIn(value: unknown): Array<Record<string, unknown>> {\n if (!Array.isArray(value)) return [];\n return value.filter((member): member is Record<string, unknown> => typeof member === \"object\" && member !== null);\n}\n\n/** `value` if it is a non-null object, otherwise an empty one, so a property read is always safe. */\nexport function objectOr(value: unknown): Record<string, unknown> {\n return typeof value === \"object\" && value !== null ? (value as Record<string, unknown>) : {};\n}\n\n/** `value` if it is a string, otherwise undefined: a `name` that is a number is not a name. */\nexport function stringOr(value: unknown): string | undefined {\n return typeof value === \"string\" ? value : undefined;\n}\n","/**\n * What a server could do to you, derived from what it declares.\n *\n * This answers one question and refuses another. It answers *what could this tool do if the\n * model decides to use it*, from the tool's name, its argument names and its schema shape. It\n * does not answer *is this tool malicious*, which is a judgement, needs a corpus, and would make\n * a verdict depend on something other than the bytes on the wire.\n *\n * The distinction matters because it is the same one the severity table already makes: rank by\n * shape, never by intent. A tool named `run_command` taking a `command` argument is arbitrary\n * execution whatever its description claims, and that is a fact about the declaration rather\n * than an opinion about the author.\n *\n * Nothing here is stored in the lockfile. Capabilities are derived from the schemas that *are*\n * stored, so sharpening a pattern re-reads existing locks instead of showing every user a wave\n * of drift that no server caused.\n */\n\n/** Ordered worst-first; the order is the comparison. */\nimport { objectOr, objectsIn, stringOr } from \"./untrusted\";\n\nexport const CAPABILITY_SEVERITIES = [\"critical\", \"high\", \"medium\", \"low\"] as const;\nexport type CapabilitySeverity = (typeof CAPABILITY_SEVERITIES)[number];\n\nexport const CAPABILITY_KINDS = [\n \"process-exec\",\n \"code-eval\",\n \"credential-access\",\n \"file-write\",\n \"network-egress\",\n \"database\",\n \"privilege\",\n \"agent-control\",\n \"env-access\",\n \"file-read\",\n] as const;\nexport type CapabilityKind = (typeof CAPABILITY_KINDS)[number];\n\nexport interface Capability {\n kind: CapabilityKind;\n severity: CapabilitySeverity;\n /** Where it was seen: `name`, or `arg:<argument>`. Shown so a finding can be checked. */\n evidence: string;\n}\n\ninterface Rule {\n kind: CapabilityKind;\n severity: CapabilitySeverity;\n /** Matched against the tool name, with separators normalised to `_`. */\n name?: RegExp;\n /** Matched against each top-level argument name, normalised the same way. */\n arg?: RegExp;\n}\n\n/*\n * Deliberately narrow. A pattern that fires on `get_user` because it contains \"user\" teaches\n * people to ignore the output, and an ignored signal is worse than none: it spends the attention\n * the real findings need.\n */\nconst RULES: Rule[] = [\n { kind: \"process-exec\", severity: \"critical\", name: /(^|_)(exec|execute|spawn|shell|bash|sh|cmd|command|run_command|terminal|subprocess)(_|$)/, arg: /(^|_)(command|cmd|argv|shell|exec|script)(_|$)/ },\n // `source` is deliberately absent: in `copy_file(source, destination)` it is a path, and\n // labelling a file copy as arbitrary code execution at CRITICAL is the false positive that\n // teaches people to stop reading the line. `code` has to be the whole argument name for the\n // same reason -- a crawl of 468 published tools flagged `location_code` as arbitrary code\n // execution, and `country_code`, `status_code` and `zip_code` are all waiting behind it.\n { kind: \"code-eval\", severity: \"critical\", name: /(^|_)(eval|evaluate|run_code|exec_code|interpret|compile)(_|$)/, arg: /^code$|(^|_)(source_code|code_to_run|js_code|python_code|expression|program|snippet)(_|$)/ },\n { kind: \"credential-access\", severity: \"critical\", name: /(^|_)(secret|secrets|credential|credentials|token|keychain|vault|password)(_|$)/, arg: /(^|_)(secret|credential|password|private_key|api_key|access_token)(_|$)/ },\n { kind: \"file-write\", severity: \"high\", name: /(^|_)(write|create_file|put_file|save|delete|remove|unlink|rename|move|copy|chmod|mkdir|rmdir|edit)(_|$)/, arg: /(^|_)(contents|content|data|destination|dest_path|target_path)(_|$)/ },\n { kind: \"network-egress\", severity: \"high\", name: /(^|_)(fetch|request|http|curl|download|upload|post|webhook|navigate|browse|send)(_|$)/, arg: /(^|_)(url|uri|endpoint|host|hostname|webhook|callback)(_|$)/ },\n // Narrowed to things that are actually SQL-shaped. `query`, `select` and `update` on their\n // own matched `simulate-research-query`, `browser_select_option` and `trigger-resource-update`,\n // none of which is a database.\n { kind: \"database\", severity: \"high\", name: /(^|_)(sql|execute_sql|run_sql|query_db|db_query|migrate)(_|$)/, arg: /(^|_)(sql|statement|dsn|connection_string)(_|$)/ },\n { kind: \"privilege\", severity: \"high\", name: /(^|_)(sudo|root|admin|grant|revoke|permission|permissions|acl|policy)(_|$)/, arg: /(^|_)(role|scope|scopes|permission|permissions|privilege)(_|$)/ },\n { kind: \"agent-control\", severity: \"high\", name: /(^|_)(prompt|system_prompt|instruction|instructions|memory|context|persona)(_|$)/, arg: /(^|_)(system_prompt|instruction|instructions|persona)(_|$)/ },\n { kind: \"env-access\", severity: \"medium\", name: /(^|_)(env|environment|getenv|setenv|config|settings)(_|$)/, arg: /(^|_)(env|environment|env_var)(_|$)/ },\n { kind: \"file-read\", severity: \"low\", name: /(^|_)(read|read_file|cat|open|load|list_directory|ls|glob|search_files)(_|$)/, arg: /(^|_)(path|file|filename|filepath|directory|dir)(_|$)/ },\n];\n\n/*\n * Cyrillic and Greek letters that are drawn like Latin ones. `run_comm\\u0430nd` reads as\n * `run_command` to a person and matched nothing at all, so a single substituted character\n * bought a tool complete invisibility to a classifier whose whole job is reading names.\n * Folding them is the difference between a check and a formality.\n */\nconst CONFUSABLES: Record<string, string> = {\n \"\\u0430\": \"a\", \"\\u0435\": \"e\", \"\\u043E\": \"o\", \"\\u0441\": \"c\", \"\\u0440\": \"p\", \"\\u0445\": \"x\",\n \"\\u0443\": \"y\", \"\\u0456\": \"i\", \"\\u0458\": \"j\", \"\\u04BB\": \"h\", \"\\u0501\": \"d\", \"\\u051B\": \"q\",\n \"\\u03BF\": \"o\", \"\\u03B1\": \"a\", \"\\u03B5\": \"e\", \"\\u03BD\": \"v\", \"\\u03C1\": \"p\", \"\\u03C5\": \"u\",\n \"\\u0131\": \"i\", \"\\u1E9E\": \"s\",\n};\n\n/** Built from the map above, so the pattern and the replacements cannot drift apart. */\nconst CONFUSABLE_PATTERN = new RegExp(`[${Object.keys(CONFUSABLES).join(\"\")}]`, \"g\");\n\n/** `browser.take-screenshot` and `browser_take_screenshot` are the same shape. */\nfunction normalize(identifier: string): string {\n return identifier\n .toLowerCase()\n .replace(CONFUSABLE_PATTERN, (character) => CONFUSABLES[character] ?? character)\n .replace(/[-.\\s/]+/g, \"_\");\n}\n\n/*\n * Nested properties count. `tool({ opts: { command } })` is the same capability as\n * `tool({ command })`, and only the top level was examined, so one wrapping object hid it.\n * Depth is bounded because a schema is attacker-supplied and need not terminate.\n */\nfunction argumentNames(inputSchema: unknown, depth = 0): string[] {\n if (depth > 6 || typeof inputSchema !== \"object\" || inputSchema === null) return [];\n const node = inputSchema as { properties?: unknown; items?: unknown };\n const names: string[] = [];\n const properties = node.properties;\n if (typeof properties === \"object\" && properties !== null) {\n for (const [name, child] of Object.entries(properties as Record<string, unknown>)) {\n names.push(name);\n names.push(...argumentNames(child, depth + 1));\n }\n }\n if (node.items !== undefined) names.push(...argumentNames(node.items, depth + 1));\n return names;\n}\n\n/**\n * The capabilities one tool declares. Worst first, one entry per kind: a tool matching\n * `process-exec` by both its name and an argument is not twice as dangerous.\n */\nexport function toolCapabilities(tool: { name?: string; inputSchema?: unknown } | null | undefined): Capability[] {\n // The argument is whatever was in the JSON; see risk/untrusted.\n const subject = objectOr(tool);\n const name = normalize(stringOr(subject.name) ?? \"\");\n const args = argumentNames(subject.inputSchema).map((argument) => [argument, normalize(argument)] as const);\n const found = new Map<CapabilityKind, Capability>();\n\n for (const rule of RULES) {\n if (found.has(rule.kind)) continue;\n if (rule.name?.test(name)) {\n found.set(rule.kind, { kind: rule.kind, severity: rule.severity, evidence: \"name\" });\n continue;\n }\n const hit = rule.arg ? args.find(([, normalized]) => rule.arg?.test(normalized)) : undefined;\n if (hit) found.set(rule.kind, { kind: rule.kind, severity: rule.severity, evidence: `arg:${hit[0]}` });\n }\n\n return [...found.values()].sort(\n (a, b) => CAPABILITY_SEVERITIES.indexOf(a.severity) - CAPABILITY_SEVERITIES.indexOf(b.severity) || a.kind.localeCompare(b.kind),\n );\n}\n\n/** Every capability a set of tools declares between them, with the tools that declare each. */\nexport function surfaceCapabilities(\n tools: ReadonlyArray<{ name?: string; inputSchema?: unknown }> | null | undefined,\n): Array<Capability & { tools: string[] }> {\n const byKind = new Map<CapabilityKind, Capability & { tools: string[] }>();\n for (const tool of objectsIn(tools)) {\n const label = stringOr(tool.name) ?? \"?\";\n for (const capability of toolCapabilities(tool)) {\n const existing = byKind.get(capability.kind);\n if (existing) existing.tools.push(label);\n else byKind.set(capability.kind, { ...capability, tools: [label] });\n }\n }\n return [...byKind.values()].sort(\n (a, b) => CAPABILITY_SEVERITIES.indexOf(a.severity) - CAPABILITY_SEVERITIES.indexOf(b.severity) || a.kind.localeCompare(b.kind),\n );\n}\n","/** Comparing a freshly captured lock against the committed one. */\nimport { stableKey } from \"../lock/canonical\";\nimport { isEscalation } from \"../lock/normalize\";\nimport type {\n LockedPrompt,\n LockedResource,\n LockedResourceTemplate,\n LockedMcpServer,\n LockedTool,\n Lockfile,\n} from \"../lock/types\";\nimport { toolCapabilities, type CapabilitySeverity } from \"../risk/capability\";\nimport { classifySchemaChange } from \"./schema\";\nimport type { Change, ChangeKind, Severity } from \"./types\";\nimport { SEVERITY, sortChanges } from \"./types\";\n\nfunction change(kind: ChangeKind, server: string, summary: string, extra?: Partial<Change>): Change {\n return { kind, severity: SEVERITY[kind], server, summary, ...extra };\n}\n\nfunction same(a: unknown, b: unknown): boolean {\n return stableKey(a ?? null) === stableKey(b ?? null);\n}\n\nfunction indexBy<T>(members: T[] | undefined, key: (member: T) => string): Map<string, T> {\n return new Map((members ?? []).map((member) => [key(member), member]));\n}\n\n/**\n * What a server declares, flattened so that an extension is one of the names.\n *\n * `capabilities` is a handful of top-level keys, and one of them, `extensions`, is a map of\n * reverse-DNS ids: that is the mechanism the specification uses to ship capability outside the\n * core. Comparing only the top level means a server that gains an extension still has\n * `extensions` before and after, so nothing reads as gained and the finding lands on the generic\n * \"declared capabilities changed\" with the detail left inside a JSON blob for a reviewer to go\n * and read. As more of what a server can do arrives as an extension, \"what did this one just\n * gain\" becomes an extension question, and it deserves an answer in words.\n *\n * The `extensions` key itself is not a name. Reporting both it and the id it contains would say\n * the same thing twice on the reading where a server declares its first extension.\n */\nfunction declaredNames(capabilities: LockedMcpServer[\"capabilities\"]): string[] {\n const names: string[] = [];\n for (const [key, value] of Object.entries(capabilities ?? {})) {\n if (key === \"extensions\" && value !== null && typeof value === \"object\" && !Array.isArray(value)) {\n for (const id of Object.keys(value)) names.push(`extensions/${id}`);\n continue;\n }\n names.push(key);\n }\n return names;\n}\n\n/** Describes the delta between two capability maps in the direction that matters. */\nfunction compareCapabilities(before: LockedMcpServer, after: LockedMcpServer, name: string): Change[] {\n if (same(before.capabilities, after.capabilities)) return [];\n const previous = declaredNames(before.capabilities);\n const next = declaredNames(after.capabilities);\n const gained = next.filter((key) => !previous.includes(key));\n const lost = previous.filter((key) => !next.includes(key));\n\n if (gained.length > 0 && lost.length === 0) {\n return [change(\"server.capabilities.widened\", name, `server now declares ${gained.join(\", \")}`, { before: before.capabilities, after: after.capabilities })];\n }\n if (lost.length > 0 && gained.length === 0) {\n return [change(\"server.capabilities.narrowed\", name, `server no longer declares ${lost.join(\", \")}`, { before: before.capabilities, after: after.capabilities })];\n }\n return [change(\"server.capabilities.changed\", name, \"declared capabilities changed\", { before: before.capabilities, after: after.capabilities })];\n}\n\n\n/*\n * What a tool can do, compared across a reading.\n *\n * The schema diff says a tool \"accepts input it did not before\", which is the same sentence\n * whether the new argument is `nickname` or `command`. The classifier already knows the\n * difference and says so at pin time; the diff did not ask, so the finding a reviewer approved\n * described arbitrary command execution in the words of an optional string.\n *\n * A tool that is new is compared against nothing, so everything it can do is gained. That is the\n * honest reading: a server that adds a tool taking `command` has gained command execution just as\n * surely as one that adds the argument to a tool already there.\n */\nconst CAPABILITY_SEVERITY: Record<CapabilitySeverity, Severity> = {\n critical: \"high\",\n high: \"high\",\n medium: \"medium\",\n low: \"low\",\n};\n\nfunction compareToolCapabilities(server: string, before: LockedTool[] | undefined, after: LockedTool[] | undefined): Change[] {\n const previous = indexBy(before, (tool) => tool.name);\n const changes: Change[] = [];\n\n for (const tool of after ?? []) {\n /*\n * Only tools that were already here. A tool that is new is reported once, by `tool.added`,\n * which names what it can do: raising a second finding for the same fact makes a reviewer\n * read the arrival of one tool twice.\n */\n const existing = previous.get(tool.name);\n if (!existing) continue;\n const had = new Set(toolCapabilities(existing).map((capability) => capability.kind));\n for (const capability of toolCapabilities(tool)) {\n if (had.has(capability.kind)) continue;\n changes.push(\n change(\"tool.capability.gained\", server, `can now ${capability.kind} (${capability.evidence})`, {\n member: tool.name,\n severity: CAPABILITY_SEVERITY[capability.severity],\n after: { kind: capability.kind, severity: capability.severity, evidence: capability.evidence },\n }),\n );\n }\n }\n return changes;\n}\n\nfunction compareTool(name: string, before: LockedTool, after: LockedTool): Change[] {\n if (before.digest === after.digest) return [];\n const changes: Change[] = [];\n const at = { member: before.name };\n\n if (!same(before.description, after.description)) {\n changes.push(\n change(\"tool.description.changed\", name, `description changed (${before.description?.length ?? 0} → ${after.description?.length ?? 0} characters)`, {\n ...at,\n before: before.description,\n after: after.description,\n }),\n );\n }\n\n const inputVerdict = classifySchemaChange(before.inputSchema, after.inputSchema);\n if (inputVerdict !== \"same\") {\n const kind = (`tool.input_schema.${inputVerdict}` satisfies ChangeKind) as ChangeKind;\n const wording = inputVerdict === \"widened\" ? \"accepts input it did not before\" : inputVerdict === \"narrowed\" ? \"accepts less input than before\" : \"input schema changed\";\n changes.push(change(kind, name, wording, { ...at, before: before.inputSchema, after: after.inputSchema }));\n }\n\n if (!same(before.outputSchema, after.outputSchema)) {\n changes.push(change(\"tool.output_schema.changed\", name, \"output schema changed\", { ...at, before: before.outputSchema, after: after.outputSchema }));\n }\n\n if (!same(before.behavior, after.behavior)) {\n const escalated = isEscalation(before.behavior, after.behavior);\n changes.push(\n change(escalated ? \"tool.behavior.escalated\" : \"tool.behavior.relaxed\", name, escalated ? describeEscalation(before, after) : \"declares fewer powers than before\", {\n ...at,\n before: before.behavior,\n after: after.behavior,\n }),\n );\n }\n\n if (!same(before.headerParams, after.headerParams)) {\n changes.push(\n change(\"tool.header_params.changed\", name, \"arguments mirrored into HTTP headers changed\", { ...at, before: before.headerParams ?? [], after: after.headerParams ?? [] }),\n );\n }\n\n /*\n * The digest covers more than the fields called out above -- title, icons, `_meta`. If none of\n * them fired, something in that remainder moved, and silence would be worse than a vague\n * finding.\n */\n if (changes.length === 0) {\n changes.push(change(\"tool.changed\", name, \"tool definition changed (title, icons or _meta)\", { ...at, before, after }));\n }\n return changes;\n}\n\nfunction describeEscalation(before: LockedTool, after: LockedTool): string {\n const gained: string[] = [];\n if (before.behavior.readOnly && !after.behavior.readOnly) gained.push(\"may now modify\");\n if (!before.behavior.destructive && after.behavior.destructive) gained.push(\"may now destroy\");\n if (before.behavior.idempotent && !after.behavior.idempotent) gained.push(\"repeat calls now compound\");\n if (!before.behavior.openWorld && after.behavior.openWorld) gained.push(\"may now reach external systems\");\n return gained.join(\"; \");\n}\n\ninterface MemberSpec<T> {\n key: (member: T) => string;\n label: (member: T) => string;\n added: ChangeKind;\n removed: ChangeKind;\n changed: ChangeKind;\n noun: string;\n /** Extra wording for a member that is new, where arriving is itself the finding. */\n arriving?: (member: T) => string;\n}\n\nfunction compareMembers<T extends { digest: string }>(\n name: string,\n before: T[] | undefined,\n after: T[] | undefined,\n spec: MemberSpec<T>,\n deep?: (key: string, a: T, b: T) => Change[],\n): Change[] {\n const changes: Change[] = [];\n const previous = indexBy(before, spec.key);\n const next = indexBy(after, spec.key);\n\n for (const [key, member] of next) {\n const existing = previous.get(key);\n if (!existing) {\n const extra = spec.arriving?.(member);\n changes.push(\n change(spec.added, name, `new ${spec.noun} ${spec.label(member)}${extra ? ` \\u00b7 ${extra}` : \"\"}`, { member: spec.label(member), after: member }),\n );\n continue;\n }\n if (existing.digest === member.digest) continue;\n changes.push(...(deep ? deep(key, existing, member) : [change(spec.changed, name, `${spec.noun} ${spec.label(member)} changed`, { member: spec.label(member), before: existing, after: member })]));\n }\n for (const [key, member] of previous) {\n if (!next.has(key)) changes.push(change(spec.removed, name, `${spec.noun} ${spec.label(member)} is gone`, { member: spec.label(member), before: member }));\n }\n return changes;\n}\n\nfunction compareServer(name: string, before: LockedMcpServer, after: LockedMcpServer): Change[] {\n if (before.digest === after.digest) return [];\n const changes: Change[] = [];\n\n if (!same(before.transport, after.transport)) {\n changes.push(change(\"server.transport.changed\", name, \"the server is reached differently than when it was pinned\", { before: before.transport, after: after.transport }));\n }\n if (!same(before.serverInfo, after.serverInfo)) {\n const from = before.serverInfo?.version ?? \"unknown\";\n const to = after.serverInfo?.version ?? \"unknown\";\n changes.push(change(\"server.identity.changed\", name, `server identity changed (version ${from} → ${to})`, { before: before.serverInfo, after: after.serverInfo }));\n }\n if (!same(before.protocol, after.protocol)) {\n changes.push(\n change(\"server.protocol.changed\", name, `protocol changed (${before.protocol.era}/${before.protocol.version} → ${after.protocol.era}/${after.protocol.version})`, {\n before: before.protocol,\n after: after.protocol,\n }),\n );\n }\n if (!same(before.instructions, after.instructions)) {\n changes.push(\n change(\"server.instructions.changed\", name, \"server instructions changed: this text goes into the model's system prompt\", {\n before: before.instructions,\n after: after.instructions,\n }),\n );\n }\n changes.push(...compareCapabilities(before, after, name));\n\n changes.push(\n ...compareMembers<LockedTool>(name, before.tools, after.tools, {\n key: (t) => t.name,\n label: (t) => t.name,\n added: \"tool.added\",\n removed: \"tool.removed\",\n changed: \"tool.changed\",\n noun: \"tool\",\n arriving: (t) => {\n const can = toolCapabilities(t);\n return can.length > 0 ? `can ${can.map((capability) => capability.kind).join(\", \")}` : \"\";\n },\n }, (_key, a, b) =>\n compareTool(name, a, b),\n ),\n );\n changes.push(...compareToolCapabilities(name, before.tools, after.tools));\n changes.push(\n ...compareMembers<LockedResource>(name, before.resources, after.resources, {\n key: (r) => r.uri,\n label: (r) => `${r.name} (${r.uri})`,\n added: \"resource.added\",\n removed: \"resource.removed\",\n changed: \"resource.changed\",\n noun: \"resource\",\n }),\n );\n changes.push(\n ...compareMembers<LockedResourceTemplate>(name, before.resourceTemplates, after.resourceTemplates, {\n key: (t) => t.uriTemplate,\n // The template itself is the capability -- widening it from file:///project/{path} to\n // file:///{path} is the whole finding -- so it belongs in the label, not just the body.\n label: (t) => `${t.name} (${t.uriTemplate})`,\n added: \"resource_template.added\",\n removed: \"resource_template.removed\",\n changed: \"resource_template.changed\",\n noun: \"resource template\",\n }),\n );\n changes.push(\n ...compareMembers<LockedPrompt>(name, before.prompts, after.prompts, {\n key: (p) => p.name,\n label: (p) => p.name,\n added: \"prompt.added\",\n removed: \"prompt.removed\",\n changed: \"prompt.changed\",\n noun: \"prompt\",\n }),\n );\n\n return changes;\n}\n\n/**\n * A server renamed in config would naively read as a removal plus an addition: two alarming\n * findings for a cosmetic edit. Collapsing requires an identical transport *and* an identical\n * digest, so a rename that also changed capabilities stays a remove and an add -- which is what\n * it is, and hiding a capability change inside a cosmetic one is the failure mode worth avoiding.\n */\nfunction detectRenames(before: Lockfile, after: Lockfile, removed: string[], added: string[]): { changes: Change[]; renamed: Set<string> } {\n const changes: Change[] = [];\n const renamed = new Set<string>();\n const availableAdds = [...added];\n\n for (const oldName of removed) {\n const oldEntry = before.subjects[oldName];\n if (!oldEntry) continue;\n const match = availableAdds.find((newName) => {\n const candidate = after.subjects[newName];\n return candidate !== undefined && candidate.digest === oldEntry.digest && same(candidate.transport, oldEntry.transport);\n });\n if (!match) continue;\n\n availableAdds.splice(availableAdds.indexOf(match), 1);\n renamed.add(oldName);\n renamed.add(match);\n changes.push(change(\"server.renamed\", match, `renamed from \"${oldName}\"; capabilities are unchanged`, { before: oldName, after: match }));\n }\n return { changes, renamed };\n}\n\nexport function diffLockfiles(before: Lockfile, after: Lockfile): Change[] {\n const beforeNames = Object.keys(before.subjects);\n const afterNames = Object.keys(after.subjects);\n const removed = beforeNames.filter((name) => !afterNames.includes(name));\n const added = afterNames.filter((name) => !beforeNames.includes(name));\n\n const { changes: renameChanges, renamed } = detectRenames(before, after, removed, added);\n const changes: Change[] = [...renameChanges];\n\n for (const name of added) {\n if (renamed.has(name)) continue;\n const entry = after.subjects[name];\n const toolCount = entry?.tools?.length ?? 0;\n changes.push(change(\"server.added\", name, `new server with ${toolCount} tool${toolCount === 1 ? \"\" : \"s\"}`, { after: entry }));\n }\n for (const name of removed) {\n if (renamed.has(name)) continue;\n changes.push(change(\"server.removed\", name, \"server is no longer configured\", { before: before.subjects[name] }));\n }\n for (const name of afterNames) {\n const a = before.subjects[name];\n const b = after.subjects[name];\n if (!a || !b) continue;\n changes.push(...compareServer(name, a, b));\n }\n\n return sortChanges(changes);\n}\n"],"mappings":";;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 var CHANGE_KINDS = [
|
|
|
20
20
|
"tool.behavior.escalated",
|
|
21
21
|
"tool.behavior.relaxed",
|
|
22
22
|
"tool.header_params.changed",
|
|
23
|
+
"tool.capability.gained",
|
|
23
24
|
"tool.changed",
|
|
24
25
|
"resource.added",
|
|
25
26
|
"resource.removed",
|
|
@@ -53,6 +54,12 @@ var SEVERITY = {
|
|
|
53
54
|
"tool.behavior.escalated": "high",
|
|
54
55
|
"tool.behavior.relaxed": "low",
|
|
55
56
|
"tool.header_params.changed": "high",
|
|
57
|
+
/*
|
|
58
|
+
* Severity is set per change rather than read from here: what a tool gained decides it. A
|
|
59
|
+
* `command` argument is not the same finding as a `url` one, and flattening both to one number
|
|
60
|
+
* is how "accepts input it did not before" came to describe arbitrary command execution.
|
|
61
|
+
*/
|
|
62
|
+
"tool.capability.gained": "high",
|
|
56
63
|
"tool.changed": "medium",
|
|
57
64
|
"resource.added": "medium",
|
|
58
65
|
"resource.removed": "low",
|
|
@@ -88,4 +95,4 @@ export {
|
|
|
88
95
|
sortChanges,
|
|
89
96
|
serversThatShippedNothing
|
|
90
97
|
};
|
|
91
|
-
//# sourceMappingURL=chunk-
|
|
98
|
+
//# sourceMappingURL=chunk-QRV36OVZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/changes.ts"],"sourcesContent":["/**\n * The change taxonomy: the one vocabulary the collector, the API, the dashboard and every\n * customer's SARIF consumer share.\n *\n * It lives here rather than in the CLI because it is a contract across process boundaries. A\n * collector on an old version reports a kind the server has to understand, and a renamed kind\n * breaks a SARIF rule id somebody has already suppressed. Renaming one is a major version.\n */\n\nexport const CHANGE_KINDS = [\n \"server.added\",\n \"server.removed\",\n \"server.renamed\",\n \"server.transport.changed\",\n \"server.identity.changed\",\n \"server.protocol.changed\",\n \"server.instructions.changed\",\n \"server.capabilities.widened\",\n \"server.capabilities.narrowed\",\n \"server.capabilities.changed\",\n \"tool.added\",\n \"tool.removed\",\n \"tool.description.changed\",\n \"tool.input_schema.widened\",\n \"tool.input_schema.narrowed\",\n \"tool.input_schema.changed\",\n \"tool.output_schema.changed\",\n \"tool.behavior.escalated\",\n \"tool.behavior.relaxed\",\n \"tool.header_params.changed\",\n \"tool.capability.gained\",\n \"tool.changed\",\n \"resource.added\",\n \"resource.removed\",\n \"resource.changed\",\n \"resource_template.added\",\n \"resource_template.removed\",\n \"resource_template.changed\",\n \"prompt.added\",\n \"prompt.removed\",\n \"prompt.changed\",\n] as const;\n\nexport type ChangeKind = (typeof CHANGE_KINDS)[number];\n\n/**\n * Ranking only. Every kind is drift; severity decides what a reviewer reads first, what SARIF\n * level an AppSec tool shows, and which changes a policy can be set to block. \"high\" is reserved\n * for shapes an attacker would use -- text that reaches the model, a widened input, a new power --\n * so that it keeps meaning something.\n */\nexport const SEVERITIES = [\"high\", \"medium\", \"low\"] as const;\nexport type Severity = (typeof SEVERITIES)[number];\n\nexport const SEVERITY: Record<ChangeKind, Severity> = {\n \"server.added\": \"medium\",\n \"server.removed\": \"low\",\n \"server.renamed\": \"low\",\n \"server.transport.changed\": \"high\",\n \"server.identity.changed\": \"medium\",\n \"server.protocol.changed\": \"medium\",\n \"server.instructions.changed\": \"high\",\n \"server.capabilities.widened\": \"medium\",\n \"server.capabilities.narrowed\": \"low\",\n \"server.capabilities.changed\": \"medium\",\n \"tool.added\": \"high\",\n \"tool.removed\": \"low\",\n \"tool.description.changed\": \"high\",\n \"tool.input_schema.widened\": \"high\",\n \"tool.input_schema.narrowed\": \"low\",\n \"tool.input_schema.changed\": \"medium\",\n \"tool.output_schema.changed\": \"medium\",\n \"tool.behavior.escalated\": \"high\",\n \"tool.behavior.relaxed\": \"low\",\n \"tool.header_params.changed\": \"high\",\n /*\n * Severity is set per change rather than read from here: what a tool gained decides it. A\n * `command` argument is not the same finding as a `url` one, and flattening both to one number\n * is how \"accepts input it did not before\" came to describe arbitrary command execution.\n */\n \"tool.capability.gained\": \"high\",\n \"tool.changed\": \"medium\",\n \"resource.added\": \"medium\",\n \"resource.removed\": \"low\",\n \"resource.changed\": \"medium\",\n \"resource_template.added\": \"high\",\n \"resource_template.removed\": \"low\",\n \"resource_template.changed\": \"high\",\n \"prompt.added\": \"medium\",\n \"prompt.removed\": \"low\",\n \"prompt.changed\": \"medium\",\n};\n\nexport const SEVERITY_RANK: Record<Severity, number> = { high: 0, medium: 1, low: 2 };\n\n/** One change, as the collector reports it and as the dashboard renders it. */\nexport interface Change {\n kind: ChangeKind;\n severity: Severity;\n /** Name of the server in the lock. */\n server: string;\n /** Tool, resource, template or prompt name, where the change is scoped to one. */\n member?: string;\n /** One line, written for a reviewer who has not read the lockfile. */\n summary: string;\n before?: unknown;\n after?: unknown;\n}\n\nexport function sortChanges(changes: Change[]): Change[] {\n return [...changes].sort(\n (a, b) =>\n SEVERITY_RANK[a.severity] - SEVERITY_RANK[b.severity] ||\n a.server.localeCompare(b.server) ||\n (a.member ?? \"\").localeCompare(b.member ?? \"\") ||\n a.kind.localeCompare(b.kind),\n );\n}\n\n/**\n * Which servers moved without shipping anything.\n *\n * A surface that changes alongside a version bump is a release: somebody published something,\n * and the change is attributable to it. A surface that changes while the version stays exactly\n * where it was is the opposite, and it is the shape this product exists for: the same package,\n * the same version, a different set of instructions reaching the model.\n *\n * Both halves are already recorded. `server.identity.changed` carries the version move, so the\n * signal is the *absence* of one beside other changes, and a reviewer currently has to notice a\n * thing that is not there. This names it so a report can say it out loud.\n *\n * It lives beside the taxonomy rather than in the engine because it reasons about a list of\n * changes and nothing else: the dashboard asks the same question and has no business depending\n * on a diff engine to do it.\n */\nexport function serversThatShippedNothing(changes: readonly Change[]): string[] {\n const moved = new Set<string>();\n const versioned = new Set<string>();\n for (const change of changes) {\n moved.add(change.server);\n if (change.kind === \"server.identity.changed\") versioned.add(change.server);\n }\n return [...moved].filter((server) => !versioned.has(server)).sort();\n}\n"],"mappings":";AASO,IAAM,eAAe;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAA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,KACpD,EAAE,OAAO,cAAc,EAAE,MAAM,MAC9B,EAAE,UAAU,IAAI,cAAc,EAAE,UAAU,EAAE,KAC7C,EAAE,KAAK,cAAc,EAAE,IAAI;AAAA,EAC/B;AACF;AAkBO,SAAS,0BAA0B,SAAsC;AAC9E,QAAM,QAAQ,oBAAI,IAAY;AAC9B,QAAM,YAAY,oBAAI,IAAY;AAClC,aAAW,UAAU,SAAS;AAC5B,UAAM,IAAI,OAAO,MAAM;AACvB,QAAI,OAAO,SAAS,0BAA2B,WAAU,IAAI,OAAO,MAAM;AAAA,EAC5E;AACA,SAAO,CAAC,GAAG,KAAK,EAAE,OAAO,CAAC,WAAW,CAAC,UAAU,IAAI,MAAM,CAAC,EAAE,KAAK;AACpE;","names":[]}
|
package/dist/diff/index.d.ts
CHANGED
package/dist/diff/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
diffLockfiles
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-N3REN5LN.js";
|
|
4
4
|
import "../chunk-42ZE5O5I.js";
|
|
5
5
|
import "../chunk-ALHOTOM6.js";
|
|
6
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-QRV36OVZ.js";
|
|
7
7
|
import "../chunk-HLTEHLNF.js";
|
|
8
8
|
import "../chunk-ERWDYBMA.js";
|
|
9
9
|
import "../chunk-SUY3NGZP.js";
|
package/dist/diff/schema.d.ts
CHANGED
package/dist/diff/types.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,56 +1,12 @@
|
|
|
1
1
|
export { CHANGE_KINDS, Change, ChangeKind, SEVERITIES, SEVERITY, SEVERITY_RANK, Severity, serversThatShippedNothing, sortChanges } from './changes.js';
|
|
2
|
-
import { Lockfile } from './
|
|
3
|
-
export { ClientKind, JsonObject, JsonValue, LOCKFILE_VERSION, LockPolicy, LockedAnnotations, LockedBehavior, LockedHttpTransport, LockedIcon, LockedMcpServer, LockedMember, LockedPrompt, LockedPromptArgument, LockedProtocol, LockedResource, LockedResourceTemplate, LockedServerInfo, LockedSource, LockedStdioTransport, LockedSubject, LockedSubjectBase, LockedTool, LockedTransport, SUBJECT_KINDS, SubjectKind } from './
|
|
2
|
+
import { C as CapabilityKind, e as CapabilitySeverity, L as Lockfile } from './types-CU0za3Jw.js';
|
|
3
|
+
export { f as CAPABILITY_KINDS, g as CAPABILITY_SEVERITIES, h as Capability, i as ClientKind, a as JsonObject, J as JsonValue, j as LOCKFILE_VERSION, k as LockPolicy, c as LockedAnnotations, b as LockedBehavior, l as LockedHttpTransport, m as LockedIcon, n as LockedMcpServer, o as LockedMember, p as LockedPrompt, q as LockedPromptArgument, r as LockedProtocol, s as LockedResource, t as LockedResourceTemplate, u as LockedServerInfo, v as LockedSource, w as LockedStdioTransport, d as LockedSubject, x as LockedSubjectBase, y as LockedTool, z as LockedTransport, S as SUBJECT_KINDS, A as SubjectKind, B as surfaceCapabilities, D as toolCapabilities } from './types-CU0za3Jw.js';
|
|
4
4
|
export { MAX_DEPTH, canonicalize, digest, exceedsMaxDepth, stableKey, toJson } from './lock/canonical.js';
|
|
5
5
|
export { reseal } from './lock/reseal.js';
|
|
6
6
|
export { extractHeaderParams, isEscalation, normalizeSchema, resolveBehavior, sanitizeUrl, stripIgnoredMeta } from './lock/normalize.js';
|
|
7
7
|
export { diffLockfiles } from './diff/index.js';
|
|
8
8
|
export { classifySchemaChange } from './diff/schema.js';
|
|
9
9
|
|
|
10
|
-
/**
|
|
11
|
-
* What a server could do to you, derived from what it declares.
|
|
12
|
-
*
|
|
13
|
-
* This answers one question and refuses another. It answers *what could this tool do if the
|
|
14
|
-
* model decides to use it*, from the tool's name, its argument names and its schema shape. It
|
|
15
|
-
* does not answer *is this tool malicious*, which is a judgement, needs a corpus, and would make
|
|
16
|
-
* a verdict depend on something other than the bytes on the wire.
|
|
17
|
-
*
|
|
18
|
-
* The distinction matters because it is the same one the severity table already makes: rank by
|
|
19
|
-
* shape, never by intent. A tool named `run_command` taking a `command` argument is arbitrary
|
|
20
|
-
* execution whatever its description claims, and that is a fact about the declaration rather
|
|
21
|
-
* than an opinion about the author.
|
|
22
|
-
*
|
|
23
|
-
* Nothing here is stored in the lockfile. Capabilities are derived from the schemas that *are*
|
|
24
|
-
* stored, so sharpening a pattern re-reads existing locks instead of showing every user a wave
|
|
25
|
-
* of drift that no server caused.
|
|
26
|
-
*/
|
|
27
|
-
/** Ordered worst-first; the order is the comparison. */
|
|
28
|
-
declare const CAPABILITY_SEVERITIES: readonly ["critical", "high", "medium", "low"];
|
|
29
|
-
type CapabilitySeverity = (typeof CAPABILITY_SEVERITIES)[number];
|
|
30
|
-
declare const CAPABILITY_KINDS: readonly ["process-exec", "code-eval", "credential-access", "file-write", "network-egress", "database", "privilege", "agent-control", "env-access", "file-read"];
|
|
31
|
-
type CapabilityKind = (typeof CAPABILITY_KINDS)[number];
|
|
32
|
-
interface Capability {
|
|
33
|
-
kind: CapabilityKind;
|
|
34
|
-
severity: CapabilitySeverity;
|
|
35
|
-
/** Where it was seen: `name`, or `arg:<argument>`. Shown so a finding can be checked. */
|
|
36
|
-
evidence: string;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* The capabilities one tool declares. Worst first, one entry per kind: a tool matching
|
|
40
|
-
* `process-exec` by both its name and an argument is not twice as dangerous.
|
|
41
|
-
*/
|
|
42
|
-
declare function toolCapabilities(tool: {
|
|
43
|
-
name?: string;
|
|
44
|
-
inputSchema?: unknown;
|
|
45
|
-
}): Capability[];
|
|
46
|
-
/** Every capability a set of tools declares between them, with the tools that declare each. */
|
|
47
|
-
declare function surfaceCapabilities(tools: ReadonlyArray<{
|
|
48
|
-
name?: string;
|
|
49
|
-
inputSchema?: unknown;
|
|
50
|
-
}>): Array<Capability & {
|
|
51
|
-
tools: string[];
|
|
52
|
-
}>;
|
|
53
|
-
|
|
54
10
|
/**
|
|
55
11
|
* Text in a declared surface that reads like an instruction to the model rather than
|
|
56
12
|
* documentation for a person.
|
|
@@ -80,6 +36,41 @@ interface SteeringSignal {
|
|
|
80
36
|
}
|
|
81
37
|
declare function steeringSignals(text: string | undefined, field: string): SteeringSignal[];
|
|
82
38
|
|
|
39
|
+
/**
|
|
40
|
+
* Standing rules about what a server may be, as distinct from what changed.
|
|
41
|
+
*
|
|
42
|
+
* Every gate in this product until now has been a gate on movement: something differs from what
|
|
43
|
+
* was approved, so the build fails. That cannot express the rule a security team actually writes
|
|
44
|
+
* down, which is about a property rather than a delta -- *nothing in this repository may execute
|
|
45
|
+
* processes* -- and a rule that can only be checked at the moment of change is not enforced on a
|
|
46
|
+
* repository that never changes.
|
|
47
|
+
*
|
|
48
|
+
* Capability is the right thing to gate on and steering is not. A capability is derived from the
|
|
49
|
+
* shape of the declaration: a `command` argument is a fact about the schema, and the same schema
|
|
50
|
+
* yields the same answer for everyone. A steering signal is a regular expression over prose, and
|
|
51
|
+
* a server documenting "before using this tool, call authenticate first" trips it. Gating on the
|
|
52
|
+
* first is a policy; gating on the second is a coin toss that fails somebody's build.
|
|
53
|
+
*
|
|
54
|
+
* So this exists and the steering equivalent deliberately does not.
|
|
55
|
+
*/
|
|
56
|
+
|
|
57
|
+
interface CapabilityViolation {
|
|
58
|
+
server: string;
|
|
59
|
+
tool: string;
|
|
60
|
+
kind: CapabilityKind;
|
|
61
|
+
severity: CapabilitySeverity;
|
|
62
|
+
/** The argument or name the classification was made from, so the rule can be checked. */
|
|
63
|
+
evidence: string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Every pinned tool whose capability the policy forbids.
|
|
67
|
+
*
|
|
68
|
+
* Checked against the surface as it is, not against the diff, so a repository whose servers have
|
|
69
|
+
* not moved in a year still fails the day the rule is added. That is the point: the rule is about
|
|
70
|
+
* the surface, and accepting drift cannot make a forbidden capability allowed.
|
|
71
|
+
*/
|
|
72
|
+
declare function capabilityViolations(lock: Lockfile, denied: readonly CapabilityKind[] | undefined): CapabilityViolation[];
|
|
73
|
+
|
|
83
74
|
/**
|
|
84
75
|
* Text that started addressing the model since the surface was approved.
|
|
85
76
|
*
|
|
@@ -134,7 +125,7 @@ interface Describable {
|
|
|
134
125
|
description?: string;
|
|
135
126
|
}
|
|
136
127
|
/** Every model-facing string in one locked server, with the field it came from. */
|
|
137
|
-
declare function surfaceText(subject: {
|
|
128
|
+
declare function surfaceText(subject: ({
|
|
138
129
|
instructions?: string;
|
|
139
130
|
tools?: ReadonlyArray<Describable & {
|
|
140
131
|
inputSchema?: unknown;
|
|
@@ -149,6 +140,6 @@ declare function surfaceText(subject: {
|
|
|
149
140
|
resourceTemplates?: ReadonlyArray<Describable & {
|
|
150
141
|
uriTemplate?: string;
|
|
151
142
|
}>;
|
|
152
|
-
}): SurfaceText[];
|
|
143
|
+
}) | null | undefined): SurfaceText[];
|
|
153
144
|
|
|
154
|
-
export {
|
|
145
|
+
export { CapabilityKind, CapabilitySeverity, type CapabilityViolation, Lockfile, STEERING_KINDS, type ServerSteering, type SteeringKind, type SteeringSignal, type SurfaceText, capabilityViolations, newSteering, steeringSignals, surfaceText };
|