Weekly Security Audit Report Generator with Multi-Language Email - n8n Workflow

Deploy this essential n8n workflow to automatically generate weekly security audit reports for your n8n instance, including risk levels, credential exposure, and execution status, delivered via Gmail. Use this powerful n8n template for DevOps monitoring.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

System Administrators and DevOps Engineers responsible for n8n instance health and security.
Technical managers requiring regular, automated risk assessments.
Users looking for advanced n8n templates utilizing the internal n8n node for monitoring.
Anyone needing an automated weekly security n8n trigger.

Overview

Maintaining security compliance and operational health is critical for any self-hosted n8n instance. This specialized n8n workflow template solves the challenge of manual auditing by automatically generating a comprehensive security report every week. Leveraging the dedicated n8n node for auditing, this automation reviews exposed credentials, dangerous node usage (like Code and Execute Command), and instance security settings. The report is then enriched with real-time execution data, showing the status (success/failure) of the analyzed n8n workflow runs. Finally, it uses a multi-language Code n8n node to format the results into a rich, color-coded HTML report and delivers it instantly via Gmail. This is a crucial n8n workflow for proactive security management.

How it Works

The entire process is initiated by the Schedule n8n trigger.


  1. Initialization: The Schedule n8n trigger is set to run weekly (defaulting to Monday morning). It immediately feeds into the Set Config Variables n8n node, where crucial parameters (recipient email, project name, server URL, and report language) are defined.

  2. Audit Generation: The dedicated n8n node (using the API) executes the core function: Generate a security audit. This action scans the entire n8n instance for security vulnerabilities.

  3. Data Preparation: The output, which contains many redundant entries, is cleaned by the Filter duplicate WorkflowID Code n8n node. This ensures that unique n8n workflow IDs are isolated for subsequent lookups.

  4. Execution Status Retrieval: For each identified unique workflow, the Get last executions n8n node is called, retrieving the latest run status (success or failure) and execution timestamps directly from the n8n API. This step enriches the final report.

  5. Language Routing: The If Language n8n node checks the configured 'Language' variable. If set to 'FR', it routes to the French formatter; otherwise, it defaults to the English formatter.

  6. Report Formatting: The respective Code n8n node (Format Audit Report - EN/FR) compiles all data (audit findings, execution statuses, security settings) into a single, comprehensive HTML email body and determines the risk level (Low, Moderate, High) for the email subject line.

  7. Delivery: Finally, the Send Gmail (HTML) n8n node sends the fully formatted HTML report to the configured recipient, completing the scheduled n8n workflow.

Installation Guide

To deploy this powerful n8n workflow template, follow these steps:


  1. Import: Copy the provided JSON data and paste it into your n8n instance using the 'New' button and selecting 'Import from JSON'.

  2. n8n API Credential Setup (Nodes 3 & 5):

Go to your n8n Settings -> API. Generate a new API Key with appropriate audit and execution permissions.
In the Generate a security audit n8n node and the Get last executions n8n node, configure a new 'n8n API' credential using the generated API Key.

  1. Gmail Credential Setup (Node 8):

Configure a Gmail OAuth2 credential. This requires setting up an OAuth application in the Google Cloud Console and enabling the Gmail API.
Assign this credential to the Send Gmail (HTML) n8n node.

  1. Configure Variables (Node 2 - Set Config Variables):

Edit the emailto value to your target recipient address.
Set project
name (e.g., 'Production Instance').
Crucially, set server_url to your n8n domain (e.g., https://n8n.mydomain.com). Do not include a trailing slash (/).
Set Language to 'EN' or 'FR' (uppercase).

Node Details

Schedule Trigger (Weekly) (n8n trigger):
Function: Initiates the entire n8n workflow on a weekly basis (default: Monday, 6 AM).
Key Configuration: mode: everyWeek, hour: 6.
Set Config Variables (Set n8n node):
Function: Defines runtime variables used throughout the n8n workflow, including the email recipient, project identifier, server base URL, and report language.
Key Configuration: Defines global variables via expressions for downstream nodes.
Generate a security audit (n8n node):
Function: Uses the internal n8n API to perform a security audit of the instance, including credential exposure and node risk assessment.
Key Configuration: resource: audit, operation: generate.
Filter duplicate WorkflowID (Code n8n node):
Function: Processes the raw audit output to extract a list of unique n8n workflow IDs that contain security issues, preventing redundant API calls.
Key Configuration: Custom JavaScript to deduplicate based on workflowId.
Get last executions (n8n node):
Function: Fetches the recent execution status (last run) for each unique problematic n8n workflow identified in the previous step.
Key Configuration: Uses an expression for the workflowId filter; limit: 1.
If Language (If n8n node):
Function: Routes the data stream based on the 'Language' configuration variable, ensuring the correct formatting script runs.
Key Configuration: Checks if Language equals 'FR'.
Format Audit Report - EN/FR (Code n8n node):
Function: Aggregates audit findings, security settings, and execution statuses into a final, structured HTML and Markdown report, calculating the overall risk level.
Key Configuration: Extensive JavaScript to build the report dynamically, including embedded links to the affected n8n workflow pages.
Send Gmail (HTML) (Gmail n8n node):
Function: Sends the final, richly formatted HTML security report via email.
Key Configuration: Uses expressions for toList and subject (which includes the calculated risk level and emoji) and includes the HTML message body.

Related n8n Workflows

Free

Nodes: 7 Nodes
Updated: December 26 2025
View all
Created by
Matthieu
Matthieu

8 years exp in IT over different kind of task, from support to sysadmin. Automation learner and builder. I will share simple workflow that can be used in various situation.

Featured*