native_messaging_audit
Audit local native messaging hosts and AI browser bridges. Detect missing binaries, pre-authorized extensions, and invalid manifests to prevent insecure agent actions.
Instructions
Audit local browser native messaging hosts and AI browser bridges. Flags missing host binaries, pre-authorized extension bridges, and manifests for browsers not detected locally.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| platform | No | Optional platform override for manifest discovery. | |
| homeDir | No | Optional home-directory override for manifest discovery. | |
| aiOnly | No | When true, only AI/browser bridge manifests are returned. |
Implementation Reference
- Main handler function 'buildNativeMessagingAudit' that collects native messaging host manifests, analyzes them for security findings, and returns a structured audit report. Called by the MCP server for the 'native_messaging_audit' tool.
function buildNativeMessagingAudit(options = {}) { const collected = collectNativeMessagingEntries(options); const findings = summarizeFindings(collected.entries); const highSeverityCount = findings.filter((finding) => finding.severity === 'high').length; const mediumSeverityCount = findings.filter((finding) => finding.severity === 'medium').length; const browsersCovered = [...new Set(collected.entries.map((entry) => entry.browser))]; const aiBridgeCount = collected.entries.filter((entry) => entry.aiBridge).length; let status = 'clear'; if (highSeverityCount > 0) { status = 'review'; } else if (mediumSeverityCount > 0) { status = 'watch'; } return { name: 'thumbgate-native-messaging-audit', generatedAt: new Date().toISOString(), platform: collected.platform, homeDir: collected.homeDir, status, summary: { manifestCount: collected.entries.length, browsersCovered: browsersCovered.length, aiBridgeCount, highSeverityCount, mediumSeverityCount, }, notes: collected.notes, manifests: collected.entries, findings, recommendations: buildRecommendations(findings, options), }; } - adapters/mcp/server-stdio.js:980-985 (registration)MCP tool registration/switch case that maps the 'native_messaging_audit' tool name to the buildNativeMessagingAudit function, passing platform, homeDir, and aiOnly arguments.
case 'native_messaging_audit': return toTextResult(buildNativeMessagingAudit({ platform: args.platform, homeDir: args.homeDir, aiOnly: args.aiOnly === true, })); - scripts/cli-schema.js:153-164 (schema)CLI schema definition for 'native-messaging-audit' command (alias 'bridge-audit'), mapping it to MCP tool 'native_messaging_audit' with flags for platform, home-dir, ai-only, and json.
discoveryCommand({ name: 'native-messaging-audit', aliases: ['bridge-audit'], description: 'Audit local browser native messaging hosts and AI browser bridges', mcpTool: 'native_messaging_audit', flags: [ jsonFlag(), { name: 'platform', type: 'string', description: 'Override platform detection (darwin | linux | win32)' }, { name: 'home-dir', type: 'string', description: 'Override home directory for manifest discovery' }, { name: 'ai-only', type: 'boolean', description: 'Only report AI/browser bridge manifests' }, ], }), - adapters/mcp/server-stdio.js:95-95 (registration)Import of the buildNativeMessagingAudit function from the scripts module into the MCP server.
const { buildNativeMessagingAudit } = require('../../scripts/native-messaging-audit'); - Module exports exposing buildNativeMessagingAudit, collectNativeMessagingEntries, formatNativeMessagingAudit, and other helper utilities used by the tool.
module.exports = { AI_VENDOR_PATTERNS, BROWSER_TARGETS, buildNativeMessagingAudit, collectNativeMessagingEntries, formatNativeMessagingAudit, getBrowserTargets, guessVendor, normalizePlatform, };