Next.js Security Guardian
Security scanning for Next.js projects in Visual Studio Code.
Overview
Next.js Security Guardian helps developers identify potentially insecure JavaScript and TypeScript patterns while working in VS Code. It displays findings in the Problems panel and provides a report with file locations, severity levels, and suggested remediation.
The scanner runs locally. Optional AI integrations can review finding metadata when you choose to use them.
Features
- Live diagnostics for supported JavaScript and TypeScript files.
- Workspace-wide security scans on demand.
- Findings in the VS Code Problems panel.
- Markdown security reports with remediation guidance.
- Optional GitHub Copilot model review and agent tool.
- Separate read-only MCP server for compatible AI assistants.
Security checks
Version 0.1.x uses basic heuristic rules to flag:
| Check |
Example |
| Hardcoded credentials |
Password or secret-like string assignments |
| Unsafe code execution |
eval() |
| Disabled TLS verification |
rejectUnauthorized: false |
| HTML rendering risk |
dangerouslySetInnerHTML |
| Raw database queries |
Prisma.$queryRawUnsafe |
| Cookie configuration |
Explicitly disabled httpOnly or secure flags |
| JWT handling |
jwt.decode calls requiring review |
| Public environment variables |
Sensitive-looking NEXT_PUBLIC_ names |
| CORS configuration |
Wildcard origins |
A finding is a prompt to investigate. It is not proof that an issue is exploitable.
Installation
In VS Code, open Extensions (Ctrl+Shift+X), search for Next.js Security Guardian, and install the extension published by syamprasadkalarikkal.
Alternatively, run:
code --install-extension syamprasadkalarikkal.nextjs-security-guardian
Usage
- Open a Next.js project in VS Code.
- Open the Command Palette (
Ctrl+Shift+P).
- Run Security Guardian: Scan Next.js Workspace.
- Review findings in Problems (
Ctrl+Shift+M).
- Run Security Guardian: Show Security Report for more details.
Live diagnostics are enabled by default for supported files. You can change this in VS Code settings using nextSecurity.liveScan.
Available commands
| Command |
Action |
Security Guardian: Scan Next.js Workspace |
Scan supported project files |
Security Guardian: Show Security Report |
Open a Markdown findings report |
Security Guardian: Review Findings with Copilot Model |
Request an optional AI review after approval |
Security Guardian: Copy Sanitized Findings for Any AI |
Copy a report without source snippets or secret values |
AI integration
GitHub Copilot: The extension provides an optional model-review command and a read-only agent tool named nextSecurity_scanProject (prompt reference: #nextSecurityScan). Tool availability depends on your VS Code and Copilot setup.
MCP: The repository includes a separate MCP server that exposes the scan_nextjs_security tool to compatible clients. Configure your client with a project root and the compiled out/mcp.js entry point. See examples/copilot-mcp-config.json for an example.
AI tools do not automatically apply fixes through this extension. Always review proposed changes before editing code.
Privacy
Local scanning does not require an AI account or send project source code over the network. Copilot review requires confirmation and sends finding metadata, which may include paths and line numbers, to an available model. The MCP tool returns findings to the connected client when called.
Development
Requirements: Node.js 20+, VS Code 1.104+, and npm.
git clone https://github.com/syamprasadkalarikkal/nextjs-security-guardian.git
cd nextjs-security-guardian
npm install
npm run compile
npm run test:scanner
code .
Press F5 to launch the Extension Development Host, open a Next.js project there, and run the workspace scan command.
Limitations
This is an early-stage, heuristic scanner. It can produce false positives and miss real vulnerabilities. It does not provide full authentication or authorization analysis, dependency vulnerability scanning, or a complete security audit. Use it alongside code review and dedicated security tools.
Maintainer
Syam Prasad
Website: syamprasad.xyz
Source: github.com/syamprasadkalarikkal/nextjs-security-guardian