AI Security Code Audit for JS, PHP, and Python Files - n8n Workflow

Use this powerful n8n workflow to scan single code file URLs (JS, PHP, Python) for exploitable security vulnerabilities using GPT-4 agents. This n8n automation template generates detailed HTML reports and saves them automatically to Google Drive.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Security Engineers and Penetration Testers needing fast, initial code analysis.
Developers looking to integrate automated security checks into their build process.
Users seeking powerful custom GPT agents leveraging the n8n node ecosystem.
Anyone interested in advanced AI automation using the n8n platform and LangChain capabilities.

Overview

Conducting security audits on individual files can be tedious and time-consuming. This specialized n8n workflow template solves this by leveraging highly instructed GPT-4 agents to perform static code analysis on remote JavaScript, PHP, or Python files fetched via a URL.

When you execute this n8n automation, it takes a target URL, fetches the code, and passes it to a dedicated AI expert. Each AI expert agent is configured with strict security protocols (SQLi, XSS, RCE detection, etc.) and is forced to output only standardized JSON results. Finally, the n8n workflow processes these raw results into a clean, stylized HTML report and automatically saves the file to Google Drive for easy access and collaboration. This complex n8n node structure offers robust, specialized code scanning.

How it Works

This powerful n8n workflow operates through the following steps:


  1. Trigger & Input: The process starts with an n8n trigger, the Form node, which collects the Single File URL and the choice of the AI-Powered Code Analyzer (JavaScript, PHP, or Python expert).

  2. Dispatch & Routing: A Split n8n node breaks down the user selection. Then, specialized Switch n8n node branches route the execution flow to the correct language analysis pipeline.

  3. Code Fetching: Within the selected branch (e.g., PHP Expert), the HTTP Request n8n tool fetches the raw code content from the provided URL.

  4. AI Analysis (Agent Execution): The core intelligence lies in the Agent n8n node. This agent, configured with an extremely detailed system prompt (acting as a 20-year security veteran), receives the code content and uses the connected OpenAI LLM n8n node to perform static analysis, strictly searching for exploitable vulnerabilities and formatting its findings into a specific JSON schema.

  5. Data Cleaning: A Code n8n node (Prettify Results) ensures the potentially messy raw text output from the LLM is correctly parsed into valid JSON objects.

  6. Filtering & Normalization: The flow uses Split Out and Filter n8n nodes to isolate each vulnerability finding and remove any empty results.

  7. Reporting: HTML n8n nodes transform the structured vulnerability data into a clean, professional HTML table.

  8. Storage: The final action uses the Google Drive n8n node to upload the generated HTML security report, completing the n8n workflow.

Installation Guide

To deploy this comprehensive n8n template, follow these steps:


  1. Import the n8n workflow: Copy the provided JSON data and paste it directly into your n8n instance using the 'Import Workflow' function.

  2. OpenAI Credential Setup: This n8n workflow requires a connection to OpenAI. You must set up an OpenAi account credential. Ensure you have funding and a valid API key for GPT models (e.g., gpt-4.1-mini) to power the AI agent n8n node.

  3. Google Drive Credential Setup: Set up your Google Drive OAuth2 API credential. This is necessary for the final Google Drive n8n node to save the HTML security reports.

  4. Testing the n8n trigger: Activate the workflow. You can test the Form n8n trigger using its webhook URL or by running a manual test execution within the n8n interface, providing a raw file URL and selecting the appropriate AI expert.

Node Details

Form (n8n trigger): Initiates the n8n workflow. It takes a Single File URL and requires the user to select one AI language expert (JavaScript, PHP, or Python).
Split AI-Powered Code Analyzer (Split Out n8n node): Prepares the selected language choice for routing by extracting it from the form input.
[Language] Expert (Switch n8n node): Directs the flow based on the selected language expert, ensuring only the relevant AI pipeline runs.
[Language] Expert Agent (Agent n8n node): The primary logic unit. This specialized n8n node uses a detailed system prompt to perform static code analysis, utilizing tools like the HTTP Request n8n node to fetch the code and the OpenAI n8n node for processing.
OpenAI [Language] (lmChatOpenAi n8n node): Provides the large language model backend (GPT-4.1-mini) used by the agent to understand and audit the code.
Prettify [Language] Results (Code n8n node): Contains JavaScript code to clean and validate the JSON output from the AI agent, which is crucial for downstream processing in this n8n workflow.
Create HTML Table / Template (HTML n8n node): Formats the cleaned vulnerability findings into a beautifully styled HTML table, ready for reporting.
Upload HTML [Language] Report (Google Drive n8n node): The final action of the n8n workflow, saving the generated security report file to Google Drive with a dynamic, timestamped filename.

Related n8n Workflows

Free

Nodes: 11 Nodes
Updated: December 26 2025
View all
Created by

I’m Javier Rieiro, a hacker pushing the limits of no-code automation in cybersecurity. Here I show how I use n8n to transform bug bounty and pentesting automating reconnaissance, analysis, and reporting with custom workflows. If you want to see how no code meets offensive security, you’re in the right place.