generate-audit
Generate security audits for n8n instances to identify vulnerabilities in credentials, database, nodes, filesystem, and instance configurations.
Instructions
Generate a security audit for your n8n instance.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| clientId | Yes | ||
| daysAbandonedWorkflow | No | ||
| categories | No |
Implementation Reference
- src/index.ts:1922-1956 (handler)Handler function that executes the generate-audit tool by calling N8nClient.generateAudit and returning the audit results.case "generate-audit": { const { clientId, daysAbandonedWorkflow, categories } = args as { clientId: string; daysAbandonedWorkflow?: number; categories?: Array<'credentials' | 'database' | 'nodes' | 'filesystem' | 'instance'>; }; const client = clients.get(clientId); if (!client) { return { content: [{ type: "text", text: "Client not initialized. Please run init-n8n first.", }], isError: true }; } try { const audit = await client.generateAudit({ daysAbandonedWorkflow, categories }); return { content: [{ type: "text", text: JSON.stringify(audit, null, 2), }] }; } catch (error) { return { content: [{ type: "text", text: error instanceof Error ? error.message : "Unknown error occurred", }], isError: true }; } }
- src/index.ts:833-847 (schema)Input schema defining parameters for the generate-audit tool: clientId (required), optional daysAbandonedWorkflow and categories.inputSchema: { type: "object", properties: { clientId: { type: "string" }, daysAbandonedWorkflow: { type: "number" }, categories: { type: "array", items: { type: "string", enum: ["credentials", "database", "nodes", "filesystem", "instance"] } } }, required: ["clientId"] }
- src/index.ts:830-848 (registration)Registration of the generate-audit tool in the listTools response, including name, description, and inputSchema.{ name: "generate-audit", description: "Generate a security audit for your n8n instance.", inputSchema: { type: "object", properties: { clientId: { type: "string" }, daysAbandonedWorkflow: { type: "number" }, categories: { type: "array", items: { type: "string", enum: ["credentials", "database", "nodes", "filesystem", "instance"] } } }, required: ["clientId"] } }
- src/index.ts:342-355 (helper)N8nClient method that performs the actual API call to generate the audit report via POST /audit.async generateAudit(options: { daysAbandonedWorkflow?: number; categories?: Array<'credentials' | 'database' | 'nodes' | 'filesystem' | 'instance'>; } = {}): Promise<N8nAuditResult> { return this.makeRequest<N8nAuditResult>('/audit', { method: 'POST', body: JSON.stringify({ additionalOptions: { daysAbandonedWorkflow: options.daysAbandonedWorkflow, categories: options.categories, }, }), }); }