@yagyeshvyas/vibeguard 1.11.0 → 1.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,21 @@
3
3
  All notable changes to VibeGuard are documented here.
4
4
  Format based on [Keep a Changelog](https://keepachangelog.com/).
5
5
 
6
+ ## [1.11.2] - 2026-11-22
7
+
8
+ ### Fixed
9
+
10
+ - Include `scripts/postinstall.js` in the npm tarball; the previous package
11
+ failed `npm install` with MODULE_NOT_FOUND. Clean install verified from the
12
+ registry.
13
+
14
+ ## [1.11.1] - 2026-11-22
15
+
16
+ ### Fixed
17
+
18
+ - Installer now pins the exact runtime package version dynamically instead of the
19
+ stale 1.10.0 literal.
20
+
6
21
  ## [1.11.0] - 2026-11-22
7
22
 
8
23
  ### Added — v2 security foundation (internal testing)
package/README.md CHANGED
@@ -66,7 +66,7 @@ Offline by default · Zero telemetry · No paid APIs · Free forever.
66
66
 
67
67
  ---
68
68
 
69
- ## 🆕 What's New — v1.11.0
69
+ ## 🆕 What's New — v1.11.2
70
70
 
71
71
  **Security foundation v2 (internal testing).** This release is not beta or
72
72
  production-ready; it is the verified internal-testing build described in
@@ -84,9 +84,9 @@ production-ready; it is the verified internal-testing build described in
84
84
  - **623 tests, 0 failures** on Windows Node24/Node18 and Linux Node22; 29/29
85
85
  platform tests on Windows/Linux/macOS CI.
86
86
 
87
- Install note: v1.11.0 is distributed as `@yagyeshvyas/vibeguard@1.11.0`. If a
87
+ Install note: v1.11.2 is distributed as `@yagyeshvyas/vibeguard@1.11.2`. If a
88
88
  registry mirror still serves an older build, use the exact
89
- [v1.11.0 GitHub release tarball](https://github.com/yagyeshVyas/VibeGuard/releases/tag/v1.11.0).
89
+ [v1.11.2 GitHub release tarball](https://github.com/yagyeshVyas/VibeGuard/releases/tag/v1.11.2).
90
90
 
91
91
  ## 🆕 What's New — v1.10.0
92
92
 
@@ -146,9 +146,9 @@ Full details, policy schema and honest limits: [MCP-FIREWALL.md](MCP-FIREWALL.md
146
146
 
147
147
  ---
148
148
 
149
- ## Security baseline v2 — v1.11.0 status (internal testing)
149
+ ## Security baseline v2 — v1.11.2 status (internal testing)
150
150
 
151
- This repository contains the v1.11.0 security foundation. It is **not** a
151
+ This repository contains the v1.11.2 security foundation. It is **not** a
152
152
  production-ready agent security platform. Linux network/PID namespace isolation
153
153
  is available; Windows/macOS OS isolation is not implemented.
154
154
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yagyeshvyas/vibeguard",
3
- "version": "1.11.0",
3
+ "version": "1.11.2",
4
4
  "description": "Offline-by-default security scanner and runtime firewall for AI-coded apps and MCP agents. 861 rules, 93 MCP tools, signed default-deny policy, tool-poisoning/prompt-injection/secret-exfiltration detection, signed audit, authenticated HTTP/SSE MCP bridge, Linux namespace sandboxing and OWASP Agentic AI + MCP coverage. Zero telemetry.",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",
@@ -27,7 +27,8 @@
27
27
  "CHANGELOG.md",
28
28
  "MCP-FIREWALL.md",
29
29
  "docs",
30
- ".vibeguard-mcp.example.json"
30
+ ".vibeguard-mcp.example.json",
31
+ "scripts"
31
32
  ],
32
33
  "overrides": {
33
34
  "@hono/node-server": "^2.0.5",
@@ -0,0 +1,94 @@
1
+ 'use strict';
2
+
3
+ /*
4
+ * scripts/counts.js — generates live counts of rules, MCP tools, and defense
5
+ * layers from the source. Used to keep README.md and package.json numbers
6
+ * from drifting. Run: `npm run counts`.
7
+ *
8
+ * Output: JSON to stdout: { rules, mcpTools, layers }
9
+ * Also writes a README block between <!-- COUNTS:START --> and <!-- COUNTS:END -->
10
+ * markers if --update-readme is passed.
11
+ */
12
+
13
+ const fs = require('fs');
14
+ const path = require('path');
15
+
16
+ const ROOT = path.resolve(__dirname, '..');
17
+
18
+ // --- Rules ---
19
+ function countRules() {
20
+ const { allRules } = require(path.join(ROOT, 'src', 'rules'));
21
+ return allRules().length;
22
+ }
23
+
24
+ // --- MCP Tools ---
25
+ // Statically count tool registrations in mcp-server.js (can't require it
26
+ // directly — it starts an MCP server on load).
27
+ function countMcpTools() {
28
+ const code = fs.readFileSync(path.join(ROOT, 'src', 'mcp-server.js'), 'utf8');
29
+ const matches = [...code.matchAll(/name:\s*['"]([a-z_]+)['"]/g)].map((m) => m[1]);
30
+ const tools = matches.filter((n) => n !== 'vibeguard');
31
+ const unique = [...new Set(tools)];
32
+ return unique.length;
33
+ }
34
+
35
+ // --- Defense Layers ---
36
+ // Counted from the pre-deploy gates in src/pre-deploy.js (the canonical list).
37
+ function countLayers() {
38
+ // Count from pre-deploy.js GATES array — no git needed.
39
+ try {
40
+ const src = fs.readFileSync(path.join(ROOT, 'src', 'pre-deploy.js'), 'utf8');
41
+ const match = src.match(/const GATES\s*=\s*\[([\s\S]*?)\]/);
42
+ if (match) {
43
+ const ids = match[1].match(/id:\s*'[^']+'/g);
44
+ if (ids) return ids.length;
45
+ }
46
+ } catch {}
47
+ return 13;
48
+ }
49
+
50
+ function getCounts() {
51
+ return {
52
+ rules: countRules(),
53
+ mcpTools: countMcpTools(),
54
+ layers: countLayers(),
55
+ };
56
+ }
57
+
58
+ // --- README update ---
59
+ function updateReadme(counts) {
60
+ const readmePath = path.join(ROOT, 'README.md');
61
+ let content = fs.readFileSync(readmePath, 'utf8');
62
+ const startMarker = '<!-- COUNTS:START -->';
63
+ const endMarker = '<!-- COUNTS:END -->';
64
+
65
+ const block = [
66
+ startMarker,
67
+ `<!-- Auto-generated by scripts/counts.js — do not edit manually -->`,
68
+ `<!-- Rules: ${counts.rules} | MCP Tools: ${counts.mcpTools} | Defense Layers: ${counts.layers} -->`,
69
+ endMarker,
70
+ ].join('\n');
71
+
72
+ const startIdx = content.indexOf(startMarker);
73
+ const endIdx = content.indexOf(endMarker);
74
+
75
+ if (startIdx !== -1 && endIdx !== -1) {
76
+ content = content.slice(0, startIdx) + block + content.slice(endIdx + endMarker.length);
77
+ } else {
78
+ // No markers yet — append before the closing </div> at the end.
79
+ content = content.trimEnd() + '\n\n' + block + '\n';
80
+ }
81
+
82
+ fs.writeFileSync(readmePath, content);
83
+ }
84
+
85
+ // --- CLI ---
86
+ const args = process.argv.slice(2);
87
+ const counts = getCounts();
88
+
89
+ if (args.includes('--update-readme')) {
90
+ updateReadme(counts);
91
+ console.error('Updated README.md with counts block.');
92
+ }
93
+
94
+ console.log(JSON.stringify(counts, null, 2));
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ // scripts/gen-integrity.js — regenerate src/integrity.json with fresh SHA-256
4
+ // hashes of the critical security modules. Run before publish (wired into
5
+ // prepublishOnly) so the shipped package can self-verify it wasn't tampered.
6
+
7
+ const fs = require('fs');
8
+ const path = require('path');
9
+ const { computeManifest } = require('../src/integrity');
10
+
11
+ const srcDir = path.join(__dirname, '..', 'src');
12
+ const manifest = computeManifest(srcDir);
13
+ const out = path.join(srcDir, 'integrity.json');
14
+ fs.writeFileSync(out, JSON.stringify(manifest, null, 2) + '\n');
15
+ process.stdout.write(`integrity.json written: ${Object.keys(manifest.hashes).length} modules hashed.\n`);
@@ -0,0 +1,136 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+ /* Live MCP handshake test: speaks the MCP JSON-RPC protocol over stdio,
4
+ * exactly like Claude Code / Cursor / any MCP client would. */
5
+ const { spawn } = require('child_process');
6
+ const path = require('path');
7
+
8
+ const serverPath = path.join(__dirname, '..', 'src', 'mcp-server.js');
9
+ const child = spawn(process.execPath, [serverPath], {
10
+ cwd: path.join(__dirname, '..'),
11
+ env: { ...process.env, PATH: process.env.PATH },
12
+ stdio: ['pipe', 'pipe', 'pipe'],
13
+ });
14
+
15
+ // Surface spawn/exit failures instead of dying silently (as the OS pipes do).
16
+ child.on('error', (e) => {
17
+ console.error('FATAL: could not spawn MCP server —', e.message);
18
+ for (const p of pending.values()) p.rej(e);
19
+ pending.clear();
20
+ process.exitCode = 1;
21
+ });
22
+ child.on('exit', (code) => {
23
+ if (pending.size > 0) {
24
+ console.error('FATAL: MCP server exited early (code=' + code + ') with requests pending.');
25
+ for (const p of pending.values()) p.rej(new Error('server exited'));
26
+ pending.clear();
27
+ process.exitCode = 1;
28
+ }
29
+ });
30
+
31
+ let buf = '';
32
+ const pending = new Map();
33
+ let idc = 0;
34
+
35
+ function send(method, params) {
36
+ const id = ++idc;
37
+ const msg = JSON.stringify({ jsonrpc: '2.0', id, method, params });
38
+ child.stdin.write(msg + '\n');
39
+ return new Promise((res, rej) => pending.set(id, { res, rej }));
40
+ }
41
+
42
+ child.stdout.on('data', (d) => {
43
+ process.stderr.write('[raw-out] ' + d.toString().slice(0, 300) + '\n');
44
+ buf += d.toString();
45
+ let idx;
46
+ while ((idx = buf.indexOf('\n')) !== -1) {
47
+ const line = buf.slice(0, idx).trim();
48
+ buf = buf.slice(idx + 1);
49
+ if (!line) continue;
50
+ let msg;
51
+ try { msg = JSON.parse(line); } catch { continue; }
52
+ if (msg.id && pending.has(msg.id)) {
53
+ const p = pending.get(msg.id);
54
+ pending.delete(msg.id);
55
+ msg.error ? p.rej(new Error(JSON.stringify(msg.error))) : p.res(msg.result);
56
+ } else if (msg.method === 'notifications/initialized') {
57
+ // ignore
58
+ }
59
+ }
60
+ });
61
+
62
+ let stderr = '';
63
+ child.stderr.on('data', (d) => { stderr += d.toString(); });
64
+
65
+ (async () => {
66
+ try {
67
+ const t0 = Date.now();
68
+ const init = await send('initialize', {
69
+ protocolVersion: '2024-11-05',
70
+ capabilities: {},
71
+ clientInfo: { name: 'hermes-livecheck', version: '1.0.0' },
72
+ });
73
+ console.log('[1] initialize OK in', Date.now() - t0 + 'ms');
74
+ console.log(' serverInfo:', JSON.stringify(init.serverInfo));
75
+ console.log(' protocolVersion:', init.protocolVersion);
76
+ console.log(' capabilities:', JSON.stringify(init.capabilities));
77
+
78
+ child.stdin.write(JSON.stringify({ jsonrpc: '2.0', method: 'notifications/initialized' }) + '\n');
79
+
80
+ const tools = await send('tools/list', {});
81
+ console.log('[2] tools/list OK —', tools.tools.length, 'tools');
82
+ const names = tools.tools.map((t) => t.name);
83
+ console.log(' sample:', names.slice(0, 8).join(', '), '…');
84
+
85
+ // Verify every tool has a name + description + inputSchema (agents need these).
86
+ const missing = tools.tools.filter((t) => !t.name || !t.description || !t.inputSchema);
87
+ console.log('[3] tools missing name/desc/schema:', missing.length);
88
+ const noDesc = tools.tools.filter((t) => !t.description || t.description.length < 10);
89
+ if (noDesc.length) console.log(' weak descriptions:', noDesc.map((t) => t.name).join(', '));
90
+
91
+ // Actually call the flagship tool against this repo.
92
+ const res = await send('tools/call', {
93
+ name: 'scan_project',
94
+ arguments: { dir: path.join(__dirname, '..', 'test', 'fixtures') },
95
+ });
96
+ if (res.isError) throw new Error('scan_project failed: ' + JSON.stringify(res).slice(0, 300));
97
+ const text = (res.content || []).map((c) => c.text || '').join('');
98
+ console.log('[4] tools/call scan_project OK —', text.slice(0, 90).replace(/\n/g, ' '));
99
+ if (!/Grade [A-F]/.test(text)) throw new Error('scan_project result missing grade: ' + text.slice(0, 200));
100
+
101
+ // check_code is the inline-snippet tool agents use most.
102
+ const res2 = await send('tools/call', {
103
+ name: 'check_code',
104
+ arguments: { code: 'const fs=require("fs");\nconst data = fs.readFileSync(req.query.file, "utf8");\nres.send(data);', language: 'javascript' },
105
+ });
106
+ if (res2.isError) throw new Error('check_code failed: ' + JSON.stringify(res2).slice(0, 300));
107
+ const text2 = (res2.content || []).map((c) => c.text || '').join('');
108
+ console.log('[5] tools/call check_code OK — finds:', /critical|high|medium|low|path-traversal|injection/i.test(text2) ? 'findings present' : 'no findings?');
109
+
110
+ // Unknown tool must name the tool, not "undefined" — agents rely on this error.
111
+ const bad = await send('tools/call', { name: 'definitely_not_a_tool', arguments: {} });
112
+ if (!bad.isError) throw new Error('unknown tool should have errored');
113
+ const badText = (bad.content || []).map((c) => c.text || '').join('');
114
+ if (!badText.includes('definitely_not_a_tool')) throw new Error('unknown-tool error does not name the tool: ' + badText);
115
+ console.log('[6] unknown tool error names the tool OK —', badText.slice(0, 60));
116
+
117
+ console.log('ALL MCP HANDSHAKE CHECKS PASSED');
118
+ } catch (e) {
119
+ console.error('MCP HANDSHAKE FAILED:', e.message);
120
+ if (stderr) console.error('server stderr:', stderr.slice(0, 800));
121
+ process.exitCode = 1;
122
+ } finally {
123
+ child.kill();
124
+ // Let stdout flush naturally — process.exit() truncates piped output.
125
+ }
126
+ })();
127
+
128
+ // Global watchdog: if the server never answers, fail loudly instead of hanging.
129
+ setTimeout(() => {
130
+ if (pending.size > 0) {
131
+ console.error('MCP HANDSHAKE TIMED OUT — server never responded. stderr:');
132
+ console.error(stderr.slice(0, 1200) || '(no stderr)');
133
+ process.exitCode = 1;
134
+ child.kill();
135
+ }
136
+ }, 20000).unref();
@@ -0,0 +1,129 @@
1
+ #!/usr/bin/env node
2
+ /* Deep MCP tool audit: boots the server, enumerates every tool, calls each one
3
+ * with minimal/valid args, and classifies the result:
4
+ * PASS — returned a result
5
+ * graceful-err — returned an isError result with a clean validation message
6
+ * BUG — crash, "Unknown tool", TypeError, or empty/undefined result
7
+ * Usage: node scripts/mcp-audit-tools.js [--json]
8
+ */
9
+ 'use strict';
10
+ const { spawn } = require('child_process');
11
+ const path = require('path');
12
+
13
+ const serverPath = path.join(__dirname, '..', 'src', 'mcp-server.js');
14
+ const child = spawn(process.execPath, [serverPath], {
15
+ cwd: path.join(__dirname, '..'),
16
+ env: { ...process.env, PATH: process.env.PATH },
17
+ stdio: ['pipe', 'pipe', 'pipe'],
18
+ });
19
+
20
+ let buf = '';
21
+ const pending = new Map();
22
+ let idc = 0;
23
+
24
+ child.stdout.on('data', (d) => {
25
+ buf += d.toString('utf8');
26
+ let idx;
27
+ while ((idx = buf.indexOf('\n')) !== -1) {
28
+ const line = buf.slice(0, idx).trim();
29
+ buf = buf.slice(idx + 1);
30
+ if (!line) continue;
31
+ let msg;
32
+ try { msg = JSON.parse(line); } catch { continue; }
33
+ if (msg.id && pending.has(msg.id)) {
34
+ const { resolve } = pending.get(msg.id);
35
+ pending.delete(msg.id);
36
+ resolve(msg);
37
+ }
38
+ }
39
+ });
40
+ child.stderr.on('data', () => { /* banner etc — ignore */ });
41
+
42
+ function send(method, params, timeoutMs = 30000) {
43
+ const id = ++idc;
44
+ const msg = JSON.stringify({ jsonrpc: '2.0', id, method, params });
45
+ return new Promise((resolve, reject) => {
46
+ const t = setTimeout(() => { pending.delete(id); reject(new Error(`timeout ${method}`)); }, timeoutMs);
47
+ pending.set(id, { resolve: (m) => { clearTimeout(t); resolve(m); } });
48
+ child.stdin.write(msg + '\n');
49
+ });
50
+ }
51
+
52
+ // Build a minimal valid arg set from a JSON Schema (string props get samples).
53
+ function sampleArgs(schema) {
54
+ const props = (schema && schema.properties) || {};
55
+ const args = {};
56
+ const required = (schema && schema.required) || [];
57
+ const isDir = (k) => /dir|root|folder|directory/i.test(k);
58
+ const isFile = (k) => /^file$|filename|^path$/.test(k);
59
+ const isRule = (k) => /^rule|rule_id|ruleid/i.test(k);
60
+ for (const [k, v] of Object.entries(props)) {
61
+ if (!required.includes(k) && v.default === undefined) continue;
62
+ let val;
63
+ if (v.default !== undefined) val = v.default;
64
+ else if (isDir(k)) val = 'src'; // real dir in the repo
65
+ else if (isFile(k)) val = 'src/scanner.js'; // real file
66
+ else if (isRule(k)) val = 'ast.command-injection'; // real rule id
67
+ else if (v.type === 'string') {
68
+ val = k === 'preset' ? 'react' // real preset
69
+ : k === 'command' ? 'ls -la'
70
+ : 'test';
71
+ } else {
72
+ const S = { integer: 1, number: 1, boolean: true, array: ['test'], object: {} };
73
+ val = v.enum ? v.enum[0] : S[v.type] !== undefined ? S[v.type] : 'test';
74
+ }
75
+ args[k] = val;
76
+ }
77
+ // For dir-scoped tools, point scans at the repo 'src' so they complete fast.
78
+ if (Object.entries(args).length === 0) args.dir = 'src';
79
+ return args;
80
+ }
81
+
82
+ function flatten(text) {
83
+ return String(text).replace(/\s+/g, ' ').trim().slice(0, 140);
84
+ }
85
+
86
+ async function main() {
87
+ const out = { pass: [], graceful: [], bugs: [] };
88
+ try {
89
+ await send('initialize', { protocolVersion: '2024-11-05', capabilities: {}, clientInfo: { name: 'audit', version: '1' } });
90
+ const list = await send('tools/list', {});
91
+ const tools = (list.result && list.result.tools) || [];
92
+ for (const t of tools) {
93
+ let res;
94
+ try {
95
+ res = await send('tools/call', { name: t.name, arguments: sampleArgs(t.inputSchema) });
96
+ } catch (e) {
97
+ out.bugs.push({ tool: t.name, why: 'call crashed: ' + e.message });
98
+ continue;
99
+ }
100
+ const r = res.result;
101
+ if (!r) { out.bugs.push({ tool: t.name, why: 'empty result' }); continue; }
102
+ if (r.isError) {
103
+ const text = flatten(Array.isArray(r.content) ? r.content.map((c) => c.text || '').join(' ') : JSON.stringify(r));
104
+ // Graceful validation errors name the missing arg / bad input; bugs crash.
105
+ if (/unknown tool|typeerror|internal error|cannot read|is not a function|undefined is not/i.test(text) && !/required/i.test(text)) {
106
+ out.bugs.push({ tool: t.name, why: text });
107
+ } else {
108
+ out.graceful.push({ tool: t.name, why: text });
109
+ }
110
+ } else {
111
+ out.pass.push(t.name);
112
+ }
113
+ }
114
+ } finally {
115
+ child.stdin.end();
116
+ child.kill();
117
+ }
118
+ const json = process.argv.includes('--json');
119
+ if (json) { console.log(JSON.stringify(out, null, 2)); return; }
120
+ console.log(`tools audited: ${out.pass.length + out.graceful.length + out.bugs.length}`);
121
+ console.log(`PASS : ${out.pass.length}`);
122
+ console.log(`graceful-err : ${out.graceful.length} (expected: missing-arg / not-found)`);
123
+ for (const g of out.graceful) console.log(` ~ ${g.tool}: ${g.why}`);
124
+ console.log(`BUGS : ${out.bugs.length}`);
125
+ for (const b of out.bugs) console.log(` ! ${b.tool}: ${b.why}`);
126
+ process.exitCode = out.bugs.length ? 1 : 0;
127
+ }
128
+
129
+ main().catch((e) => { console.error('audit failed:', e.message); process.exitCode = 2; });
@@ -0,0 +1,27 @@
1
+ 'use strict';
2
+
3
+ // scripts/postinstall.js — runs after npm install.
4
+ // Prints a one-line suggestion. NEVER modifies shell profiles or any file
5
+ // outside the installed package. A security tool that silently edits user
6
+ // files is doing the thing it warns about.
7
+
8
+ try {
9
+ // Opt-out + CI quiet: a security tool should not add install-time noise or
10
+ // surprise. VIBEGUARD_NO_POSTINSTALL=1 silences this entirely.
11
+ if (process.env.VIBEGUARD_NO_POSTINSTALL === '1' || process.env.CI) {
12
+ process.exit(0);
13
+ }
14
+
15
+ const path = require('path');
16
+ const fs = require('fs');
17
+
18
+ const cliPath = path.join(__dirname, '..', 'bin', 'cli.js');
19
+ if (!fs.existsSync(cliPath)) {
20
+ process.exit(0);
21
+ }
22
+
23
+ process.stderr.write('\n VibeGuard installed. Run "vibeguard auto" to enable layered protection.\n\n');
24
+ process.exit(0);
25
+ } catch {
26
+ process.exit(0);
27
+ }
@@ -0,0 +1,100 @@
1
+ 'use strict';
2
+
3
+ /*
4
+ * scripts/security-bench.js — reproducible local performance measurements for
5
+ * the v2 security primitives. No network. Results are environment-specific;
6
+ * the report records hardware/Node so numbers are not comparable across
7
+ * machines without context.
8
+ */
9
+
10
+ const os = require('os');
11
+ const fs = require('fs');
12
+ const path = require('path');
13
+ const { performance } = require('perf_hooks');
14
+ const { IdentityAuthority } = require('../src/platform/identity');
15
+ const { StrictPolicyEngine } = require('../src/platform/policy');
16
+ const { SignedAuditLog } = require('../src/platform/signed-audit');
17
+ const { scanTextForInjection } = require('../src/mcp-audit');
18
+ const { runInProcess } = require('../src/sandbox');
19
+ const { createEngine } = require('../src/mcp-firewall');
20
+
21
+ function nowMs() { return performance.now(); }
22
+ function bench(name, iterations, fn) {
23
+ const times = [];
24
+ const start = nowMs();
25
+ for (let i = 0; i < iterations; i++) {
26
+ const t0 = nowMs();
27
+ fn(i);
28
+ times.push(nowMs() - t0);
29
+ }
30
+ const total = nowMs() - start;
31
+ times.sort((a, b) => a - b);
32
+ return {
33
+ name,
34
+ iterations,
35
+ totalMs: Number(total.toFixed(2)),
36
+ opsPerSec: Number(((iterations / total) * 1000).toFixed(1)),
37
+ p50Ms: Number(times[Math.floor(times.length * 0.5)].toFixed(4)),
38
+ p95Ms: Number(times[Math.floor(times.length * 0.95)].toFixed(4)),
39
+ };
40
+ }
41
+
42
+ function main() {
43
+ const auth = new IdentityAuthority({ issuer: 'human:bench/security', tenant: 'bench' });
44
+ const roots = fs.mkdtempSync(path.join(os.tmpdir(), 'vg-bench-'));
45
+ const policy = new StrictPolicyEngine({
46
+ schemaVersion: '2.0',
47
+ policyId: 'bench',
48
+ policyVersion: '1',
49
+ mode: 'strict',
50
+ defaults: { decision: 'deny' },
51
+ subjects: [{ principal: 'agent:bench/ci', capabilities: ['fs.read', 'mcp.tool.invoke'] }],
52
+ tools: [{ id: 'allow-read', effect: 'allow', match: { tool: 'read_file', capability: 'fs.read' }, resources: { paths: ['src/**'] } }],
53
+ }, { root: roots });
54
+ const text = 'normal developer documentation with no instruction at all. '.repeat(16);
55
+
56
+ const results = [];
57
+ results.push(bench('identity.issue+verify', 1000, () => {
58
+ const t = auth.issue({ principal: 'agent:bench/ci', capabilities: ['fs.read'], ttlSeconds: 300 });
59
+ auth.verify(t.token, { replay: false });
60
+ }));
61
+ results.push(bench('policy.evaluate', 5000, () => {
62
+ policy.evaluate({ principal: 'agent:bench/ci', server: 'files', tool: 'read_file', capability: 'fs.read', arguments: { path: 'src/index.js' } });
63
+ }));
64
+ results.push(bench('detect.injectionScan.1KB', 2000, () => scanTextForInjection(text)));
65
+
66
+ const auditFile = path.join(roots, 'audit.jsonl');
67
+ const audit = new SignedAuditLog({ file: auditFile, tenant: 'bench' });
68
+ const auditStart = nowMs();
69
+ for (let i = 0; i < 200; i++) audit.append('bench.event', { i }, { principal: 'agent:bench/ci', decision: 'allow' });
70
+ const auditMs = nowMs() - auditStart;
71
+ results.push({ name: 'audit.append+fsync', iterations: 200, totalMs: Number(auditMs.toFixed(2)), opsPerSec: Number(((200 / auditMs) * 1000).toFixed(1)) });
72
+ const vStart = nowMs();
73
+ const verification = SignedAuditLog.verifyFile(auditFile, { publicKey: audit.publicKey });
74
+ results.push({ name: 'audit.verify', iterations: 200, totalMs: Number((nowMs() - vStart).toFixed(2)), valid: verification.valid });
75
+
76
+ if (require('../src/sandbox').processIsolationSupported()) {
77
+ results.push(bench('sandbox.process.spawn+run', 5, () => runInProcess('const x = 1 + 2; x', { timeout: 2000 })));
78
+ }
79
+
80
+ const gateway = createEngine({ root: roots, policy: {}, logger: { log() {} } });
81
+ results.push(bench('mcp.engine.checkToolCall', 2000, () => gateway.checkToolCall('bench', 'read_file', { path: 'src/index.js' })));
82
+
83
+ const report = {
84
+ generatedAt: new Date().toISOString(),
85
+ node: process.version,
86
+ platform: `${os.platform()} ${os.release()} (${process.arch})`,
87
+ cpu: (os.cpus()[0] && os.cpus()[0].model) || 'unknown',
88
+ memoryBytes: os.totalmem(),
89
+ iterationsNote: 'Wall-clock measurements on this machine only; use the same environment for comparisons.',
90
+ results,
91
+ };
92
+ const outArg = process.argv.indexOf('--out');
93
+ if (outArg !== -1 && process.argv[outArg + 1]) {
94
+ fs.mkdirSync(path.dirname(path.resolve(process.argv[outArg + 1])), { recursive: true });
95
+ fs.writeFileSync(path.resolve(process.argv[outArg + 1]), JSON.stringify(report, null, 2) + '\n');
96
+ }
97
+ console.log(JSON.stringify(report, null, 2));
98
+ }
99
+
100
+ main();
package/src/install.js CHANGED
@@ -24,7 +24,7 @@ function serverSpec(local) {
24
24
  }
25
25
  // Pin the package+version: an unpinned `npx -y vibeguard` can resolve an
26
26
  // unrelated/older package and makes the MCP config non-reproducible.
27
- return { command: 'npx', args: ['-y', '@yagyeshvyas/vibeguard@1.10.0', 'mcp'] };
27
+ return { command: 'npx', args: ['-y', `@yagyeshvyas/vibeguard@${require('../package.json').version}`, 'mcp'] };
28
28
  }
29
29
 
30
30
  function exists(p) {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "tool": "vibeguard",
3
- "generatedAt": "2026-11-22T18:46:53.274Z",
3
+ "generatedAt": "2026-11-22T19:06:01.043Z",
4
4
  "algo": "sha256",
5
5
  "hashes": {
6
6
  "action-guard.js": "764f02ee6d4a1dc95939642f120ac7c233f66aee2794dd71efa15f5690fc43b0",