cbrowser 18.3.9 → 18.3.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/cli.js +3 -0
  2. package/dist/cli.js.map +1 -1
  3. package/dist/index.d.ts +1 -0
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +2 -0
  6. package/dist/index.js.map +1 -1
  7. package/dist/mcp-server-remote.d.ts.map +1 -1
  8. package/dist/mcp-server-remote.js +8 -1
  9. package/dist/mcp-server-remote.js.map +1 -1
  10. package/dist/mcp-tools/base/index.d.ts +4 -2
  11. package/dist/mcp-tools/base/index.d.ts.map +1 -1
  12. package/dist/mcp-tools/base/index.js +7 -2
  13. package/dist/mcp-tools/base/index.js.map +1 -1
  14. package/dist/mcp-tools/base/security-tools.d.ts +12 -0
  15. package/dist/mcp-tools/base/security-tools.d.ts.map +1 -0
  16. package/dist/mcp-tools/base/security-tools.js +85 -0
  17. package/dist/mcp-tools/base/security-tools.js.map +1 -0
  18. package/dist/security/audit-wrapper.d.ts +148 -0
  19. package/dist/security/audit-wrapper.d.ts.map +1 -0
  20. package/dist/security/audit-wrapper.js +433 -0
  21. package/dist/security/audit-wrapper.js.map +1 -0
  22. package/dist/security/description-scanner.d.ts +132 -0
  23. package/dist/security/description-scanner.d.ts.map +1 -0
  24. package/dist/security/description-scanner.js +408 -0
  25. package/dist/security/description-scanner.js.map +1 -0
  26. package/dist/security/index.d.ts +23 -0
  27. package/dist/security/index.d.ts.map +1 -0
  28. package/dist/security/index.js +29 -0
  29. package/dist/security/index.js.map +1 -0
  30. package/dist/security/output-sanitizer.d.ts +132 -0
  31. package/dist/security/output-sanitizer.d.ts.map +1 -0
  32. package/dist/security/output-sanitizer.js +344 -0
  33. package/dist/security/output-sanitizer.js.map +1 -0
  34. package/dist/security/request-signing.d.ts +53 -0
  35. package/dist/security/request-signing.d.ts.map +1 -0
  36. package/dist/security/request-signing.js +142 -0
  37. package/dist/security/request-signing.js.map +1 -0
  38. package/dist/security/tool-permissions.d.ts +96 -0
  39. package/dist/security/tool-permissions.d.ts.map +1 -0
  40. package/dist/security/tool-permissions.js +317 -0
  41. package/dist/security/tool-permissions.js.map +1 -0
  42. package/dist/security/tool-pinning.d.ts +143 -0
  43. package/dist/security/tool-pinning.d.ts.map +1 -0
  44. package/dist/security/tool-pinning.js +302 -0
  45. package/dist/security/tool-pinning.js.map +1 -0
  46. package/dist/types.d.ts +26 -0
  47. package/dist/types.d.ts.map +1 -1
  48. package/dist/types.js.map +1 -1
  49. package/package.json +1 -1
@@ -0,0 +1,302 @@
1
+ /**
2
+ * CBrowser - Cognitive Browser Automation
3
+ * Copyright 2026 Alexandria Eden alexandria.shai.eden@gmail.com
4
+ * Learn more at https://cbrowser.ai - MIT License
5
+ */
6
+ /**
7
+ * Tool Definition Pinning for CBrowser MCP Server
8
+ *
9
+ * Provides hash verification for MCP tool definitions to detect tampering.
10
+ * Creates a manifest of tool hashes on first use and verifies against it
11
+ * on subsequent uses.
12
+ *
13
+ * Security Model:
14
+ * - Tool definitions (name, description, schema) are hashed on registration
15
+ * - Hashes are stored in ~/.cbrowser/tool-manifest.json
16
+ * - On each startup, hashes are verified against the manifest
17
+ * - Changes are detected and reported (warn-only mode for now)
18
+ *
19
+ * Usage:
20
+ * import { verifyToolDefinitions } from "./security/tool-pinning.js";
21
+ *
22
+ * const tools = collectToolDefinitions(server);
23
+ * const result = verifyToolDefinitions(tools);
24
+ * if (result.status === "changed") {
25
+ * console.warn("Tool definitions changed:", result.message);
26
+ * }
27
+ */
28
+ import { createHash } from "node:crypto";
29
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
30
+ import { join } from "node:path";
31
+ import { getDataDir } from "../config.js";
32
+ import { VERSION } from "../version.js";
33
+ // ============================================================================
34
+ // Core Functions
35
+ // ============================================================================
36
+ /**
37
+ * Get the path to the tool manifest file.
38
+ * Uses ~/.cbrowser/tool-manifest.json by default.
39
+ */
40
+ export function getManifestPath() {
41
+ const dataDir = getDataDir();
42
+ return join(dataDir, "tool-manifest.json");
43
+ }
44
+ /**
45
+ * Create a SHA-256 hash of a tool definition.
46
+ *
47
+ * The hash includes:
48
+ * - Tool name
49
+ * - Tool description
50
+ * - JSON-stringified schema (sorted keys for consistency)
51
+ *
52
+ * @param name - Tool name
53
+ * @param description - Tool description
54
+ * @param schema - Tool schema object
55
+ * @returns 64-character hex SHA-256 hash
56
+ */
57
+ export function hashToolDefinition(name, description, schema) {
58
+ // Use sorted JSON for consistent hashing
59
+ const payload = JSON.stringify({
60
+ name,
61
+ description,
62
+ schema: sortObjectKeys(schema),
63
+ });
64
+ return createHash("sha256").update(payload).digest("hex");
65
+ }
66
+ /**
67
+ * Recursively sort object keys for consistent JSON stringification.
68
+ */
69
+ function sortObjectKeys(obj) {
70
+ if (obj === null || typeof obj !== "object") {
71
+ return obj;
72
+ }
73
+ if (Array.isArray(obj)) {
74
+ return obj.map(sortObjectKeys);
75
+ }
76
+ const sorted = {};
77
+ const keys = Object.keys(obj).sort();
78
+ for (const key of keys) {
79
+ sorted[key] = sortObjectKeys(obj[key]);
80
+ }
81
+ return sorted;
82
+ }
83
+ /**
84
+ * Count the number of parameters in a schema.
85
+ * Assumes top-level keys are parameters.
86
+ */
87
+ function countParameters(schema) {
88
+ if (schema === null || typeof schema !== "object") {
89
+ return 0;
90
+ }
91
+ return Object.keys(schema).length;
92
+ }
93
+ /**
94
+ * Create a new tool manifest from a list of tool definitions.
95
+ *
96
+ * @param tools - Array of tool definitions
97
+ * @returns Complete manifest ready for saving
98
+ */
99
+ export function createToolManifest(tools) {
100
+ const now = new Date().toISOString();
101
+ const toolEntries = {};
102
+ for (const tool of tools) {
103
+ toolEntries[tool.name] = {
104
+ hash: hashToolDefinition(tool.name, tool.description, tool.schema),
105
+ descriptionLength: tool.description.length,
106
+ parameterCount: countParameters(tool.schema),
107
+ pinnedAt: now,
108
+ };
109
+ }
110
+ return {
111
+ server: "cbrowser",
112
+ version: VERSION,
113
+ pinnedAt: now,
114
+ tools: toolEntries,
115
+ };
116
+ }
117
+ /**
118
+ * Load the tool manifest from disk.
119
+ *
120
+ * @returns Manifest if it exists and is valid, null otherwise
121
+ */
122
+ export function loadToolManifest() {
123
+ const path = getManifestPath();
124
+ if (!existsSync(path)) {
125
+ return null;
126
+ }
127
+ try {
128
+ const content = readFileSync(path, "utf-8");
129
+ const manifest = JSON.parse(content);
130
+ // Basic validation
131
+ if (!manifest.server || !manifest.tools) {
132
+ console.error("[Tool Pinning] Invalid manifest structure");
133
+ return null;
134
+ }
135
+ return manifest;
136
+ }
137
+ catch (error) {
138
+ console.error("[Tool Pinning] Failed to load manifest:", error.message);
139
+ return null;
140
+ }
141
+ }
142
+ /**
143
+ * Save a tool manifest to disk.
144
+ * Creates the directory if it doesn't exist.
145
+ *
146
+ * @param manifest - The manifest to save
147
+ */
148
+ export function saveToolManifest(manifest) {
149
+ const path = getManifestPath();
150
+ const dir = join(path, "..");
151
+ if (!existsSync(dir)) {
152
+ mkdirSync(dir, { recursive: true });
153
+ }
154
+ const content = JSON.stringify(manifest, null, 2);
155
+ writeFileSync(path, content, "utf-8");
156
+ }
157
+ /**
158
+ * Verify tool definitions against the pinned manifest.
159
+ *
160
+ * Behavior:
161
+ * - If no manifest exists: Creates one and returns status "created"
162
+ * - If all hashes match: Returns status "verified"
163
+ * - If any differences: Returns status "changed" with details
164
+ *
165
+ * @param tools - Current tool definitions from MCP server
166
+ * @returns Verification result
167
+ */
168
+ export function verifyToolDefinitions(tools) {
169
+ const existingManifest = loadToolManifest();
170
+ // No manifest exists - create one
171
+ if (!existingManifest) {
172
+ const manifest = createToolManifest(tools);
173
+ saveToolManifest(manifest);
174
+ return {
175
+ status: "created",
176
+ message: `Tool manifest created with ${tools.length} tools`,
177
+ };
178
+ }
179
+ // Compare current tools against manifest
180
+ const currentToolNames = new Set(tools.map((t) => t.name));
181
+ const pinnedToolNames = new Set(Object.keys(existingManifest.tools));
182
+ const changedTools = [];
183
+ const newTools = [];
184
+ const removedTools = [];
185
+ // Check each current tool
186
+ for (const tool of tools) {
187
+ const pinEntry = existingManifest.tools[tool.name];
188
+ if (!pinEntry) {
189
+ // Tool exists in current but not in manifest
190
+ newTools.push(tool.name);
191
+ }
192
+ else {
193
+ // Tool exists in both - verify hash
194
+ const currentHash = hashToolDefinition(tool.name, tool.description, tool.schema);
195
+ if (currentHash !== pinEntry.hash) {
196
+ changedTools.push(tool.name);
197
+ }
198
+ }
199
+ }
200
+ // Check for removed tools
201
+ for (const pinnedName of pinnedToolNames) {
202
+ if (!currentToolNames.has(pinnedName)) {
203
+ removedTools.push(pinnedName);
204
+ }
205
+ }
206
+ // Determine overall status
207
+ const hasChanges = changedTools.length > 0 || newTools.length > 0 || removedTools.length > 0;
208
+ if (!hasChanges) {
209
+ return {
210
+ status: "verified",
211
+ message: `All ${tools.length} tool definitions verified successfully`,
212
+ };
213
+ }
214
+ // Build change message
215
+ const parts = [];
216
+ if (changedTools.length > 0) {
217
+ parts.push(`${changedTools.length} modified: ${changedTools.join(", ")}`);
218
+ }
219
+ if (newTools.length > 0) {
220
+ parts.push(`${newTools.length} new: ${newTools.join(", ")}`);
221
+ }
222
+ if (removedTools.length > 0) {
223
+ parts.push(`${removedTools.length} removed: ${removedTools.join(", ")}`);
224
+ }
225
+ return {
226
+ status: "changed",
227
+ changedTools: changedTools.length > 0 ? changedTools : undefined,
228
+ newTools: newTools.length > 0 ? newTools : undefined,
229
+ removedTools: removedTools.length > 0 ? removedTools : undefined,
230
+ message: `Tool definition changes detected: ${parts.join("; ")}`,
231
+ };
232
+ }
233
+ /**
234
+ * Approve a tool change by updating its hash in the manifest.
235
+ * Used to re-approve a tool after intentional modification.
236
+ *
237
+ * @param toolName - Name of the tool to approve
238
+ * @param tool - Current tool definition
239
+ * @throws Error if no manifest exists
240
+ */
241
+ export function approveToolChange(toolName, tool) {
242
+ const manifest = loadToolManifest();
243
+ if (!manifest) {
244
+ throw new Error("Cannot approve tool change: no manifest exists");
245
+ }
246
+ const now = new Date().toISOString();
247
+ manifest.tools[toolName] = {
248
+ hash: hashToolDefinition(tool.name, tool.description, tool.schema),
249
+ descriptionLength: tool.description.length,
250
+ parameterCount: countParameters(tool.schema),
251
+ pinnedAt: now,
252
+ };
253
+ saveToolManifest(manifest);
254
+ }
255
+ /**
256
+ * Remove a tool from the manifest.
257
+ * Used when a tool is intentionally removed.
258
+ *
259
+ * @param toolName - Name of the tool to remove
260
+ * @throws Error if no manifest exists
261
+ */
262
+ export function removeToolFromManifest(toolName) {
263
+ const manifest = loadToolManifest();
264
+ if (!manifest) {
265
+ throw new Error("Cannot remove tool: no manifest exists");
266
+ }
267
+ if (manifest.tools[toolName]) {
268
+ delete manifest.tools[toolName];
269
+ saveToolManifest(manifest);
270
+ }
271
+ }
272
+ /**
273
+ * Approve all current tools, replacing the entire manifest.
274
+ * Use with caution - this trusts the current state completely.
275
+ *
276
+ * @param tools - Current tool definitions
277
+ */
278
+ export function approveAllTools(tools) {
279
+ const manifest = createToolManifest(tools);
280
+ saveToolManifest(manifest);
281
+ }
282
+ /**
283
+ * Get a summary of the current manifest for status display.
284
+ */
285
+ export function getManifestSummary() {
286
+ const manifest = loadToolManifest();
287
+ if (!manifest) {
288
+ return {
289
+ exists: false,
290
+ toolCount: 0,
291
+ version: null,
292
+ pinnedAt: null,
293
+ };
294
+ }
295
+ return {
296
+ exists: true,
297
+ toolCount: Object.keys(manifest.tools).length,
298
+ version: manifest.version,
299
+ pinnedAt: manifest.pinnedAt,
300
+ };
301
+ }
302
+ //# sourceMappingURL=tool-pinning.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-pinning.js","sourceRoot":"","sources":["../../src/security/tool-pinning.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAA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AQ,GAAG,gBAAgB,EAAE,CAAC;IAEpC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO;YACL,MAAM,EAAE,KAAK;YACb,SAAS,EAAE,CAAC;YACZ,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;SACf,CAAC;IACJ,CAAC;IAED,OAAO;QACL,MAAM,EAAE,IAAI;QACZ,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,MAAM;QAC7C,OAAO,EAAE,QAAQ,CAAC,OAAO;QACzB,QAAQ,EAAE,QAAQ,CAAC,QAAQ;KAC5B,CAAC;AACJ,CAAC"}
package/dist/types.d.ts CHANGED
@@ -1681,6 +1681,32 @@ export interface AuditEntry {
1681
1681
  persona?: string;
1682
1682
  duration?: number;
1683
1683
  }
1684
+ /**
1685
+ * Tool invocation audit entry for MCP tool call logging.
1686
+ * Captures tool name, parameters, timing, and results for security auditing.
1687
+ */
1688
+ export interface ToolInvocationEntry {
1689
+ /** ISO timestamp of when the tool was invoked */
1690
+ timestamp: string;
1691
+ /** Current MCP session ID */
1692
+ sessionId: string;
1693
+ /** Unique request ID for this invocation */
1694
+ requestId: string;
1695
+ /** Name of the tool that was invoked */
1696
+ tool: string;
1697
+ /** Parameters passed to the tool (sensitive values redacted) */
1698
+ parameters: Record<string, unknown>;
1699
+ /** Security zone of this action */
1700
+ zone: ActionZone;
1701
+ /** Result status of the invocation */
1702
+ result: "success" | "failure" | "blocked";
1703
+ /** Duration of the tool execution in milliseconds */
1704
+ duration: number;
1705
+ /** Error message if result is failure */
1706
+ error?: string;
1707
+ /** IDs of AuditEntry records triggered by this tool invocation */
1708
+ actionsTriggered: string[];
1709
+ }
1684
1710
  export interface StoredCredential {
1685
1711
  site: string;
1686
1712
  username: string;