security-nextjs

Scan Next.js applications for security vulnerabilities using ripgrep.

Updated Feb 9, 2025
One-click install
npx skills add https://github.com/xeon826/dotfiles --skill security-nextjs-xeon826
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: security-nextjs
Source: https://github.com/xeon826/dotfiles/tree/main/opencode/skill/security-nextjs
Command: npx skills add https://github.com/xeon826/dotfiles --skill security-nextjs-xeon826

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill helps developers identify and fix common security vulnerabilities in Next.js applications, preventing data leaks and unauthorized access.

Core Features & Use Cases

  • Environment Variable Auditing: Detects accidental exposure of secrets via NEXT_PUBLIC_ prefix or next.config.js.
  • Server Action & API Security: Checks for missing authentication and input validation in Server Actions and API routes.
  • Middleware Configuration: Reviews middleware.ts for proper route matching and authentication enforcement.
  • Use Case: Before deploying a Next.js application, run this Skill to proactively scan for critical security flaws like exposed API keys or unauthenticated endpoints.

Quick Start

Run the security scan script to check the current directory for Next.js security issues.

Frequently Asked Questions about security-nextjs

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I scan a Next.js application for security vulnerabilities?

To scan a Next.js application for security vulnerabilities, run the provided security script which uses ripgrep to pattern-match project files. It identifies environment variable exposure, unauthenticated Server Actions, and insecure middleware configurations.

How do I check my Next.js app for exposed environment variables?

To check a Next.js app for exposed environment variables, scan for accidental secret exposure via the NEXT_PUBLIC_ prefix or insecure next.config.js env settings. The script detects these risks to prevent data leaks before deployment.

Does this Next.js security audit cover Server Actions and API routes?

Yes, this Next.js security audit covers Server Actions and API routes. It specifically checks for missing authentication and input validation within these endpoints to prevent unauthorized access to your application logic.

What is the best way to secure Next.js middleware configurations?

The best way to secure Next.js middleware configurations is to review middleware.ts for adequate matchers and proper authentication enforcement. The scan identifies inadequate route matching to ensure access controls function correctly.

Can I use this vulnerability scanning tool with an existing Next.js App Router project?

Yes, you can use this vulnerability scanning tool with an existing Next.js App Router project. It analyzes your current directory structure and files to pinpoint security flaws without requiring additional dependencies.