Works with the AI Agents you already use
Next.js Config Security Audit
by CashonlyTian
Deploying a Next.js application with a misconfigured `next.config.js` can turn your image optimizer into an open proxy or leak secrets into the client bundle.
$7
Next.js Config Security Audit
Example session with this skill installed
Run a security audit on my Next.js project in the current directory. The project name is "Storefront-API".
- Read your context and instructions
- Compiled the next js config
- Generated the document
I have completed the security audit for
Storefront-API. The scan analyzed your next.config.mjs and .env.local files.
Audit Summary:
- Score: 65/100
- Grade: D
- Risk Level: HIGH
- Findings: 4 issues (2 Critical, 1 Medium, 1 Low)
Security Audit Report
| Check | Score | Status | Finding |
|---|---|---|---|
| Security Headers | 0/15 | FAIL | No headers() defined; missing CSP and HSTS. |
| Public Secrets | 0/15 | FAIL | NEXT_PUBLIC_STRIPE_SECRET detected in .env.local. |
| Image Remote Patterns | 5/10 | WARN | Wildcard hostname: '*' detected in remotePatterns. |
| Server Actions | 10/10 | PASS | Origins restricted to internal domains. |
| Build Checks | 10/10 | PASS | TypeScript and ESLint errors block builds. |
| Fingerprinting | 0/5 | FAIL | poweredByHeader is not set to false. |
| Strict Mode | 5/5 | PASS | reactStrictMode: true is enabled. |
| Experimental Flags | 10/10 | PASS | No dangerous experimental flags found. |
| Production Exposure | 10/10 | PASS | Source maps and compression configured correctly. |
| Rewrites/Redirects | 15/15 | PASS | No external or metadata endpoint rewrites. |
Top 3 Required Fixes
Move Secrets: Remove NEXT_PUBLIC_STRIPE_SECRET from .env.local. Any variable prefixed with NEXT_PUBLIC_ is bundled into the browser. Use a standard env var and access it in Server Components only.
2.
Add Headers: Implement headers() in next.config.mjs to include Content-Security-Policy and Strict-Transport-Security.
3.
Restrict Images: Replace the wildcard * in images.remotePatterns with specific, trusted domains to prevent your server from being used as an open image proxy.
Next steps
- View the visual scorecard at
scan-2024-05-20.png. - Apply the suggested fixes to
next.config.mjs. - Re-run the audit to verify your new score.
scan-2024-05-20.png
PDF · document
Example file from a real run - the skill writes it into your workspace.
Connects securely to your tools. The creator never sees your data.
About this skill
Deploying a Next.js application with a misconfigured next.config.js can turn your image optimizer into an open proxy or leak secrets into the client bundle. This skill audits your configuration files and environment variables to identify high-risk settings before they hit production.
What it does
- Security Header Audit checks for missing CSP, HSTS, X-Frame-Options, and other essential browser security headers.
- Image Proxy Validation identifies overly broad
remotePatternsor wildcards that allow unauthorized image processing. - Secret Leak Detection scans
NEXT_PUBLIC_variables for sensitive keywords likeAPI_KEYorSECRETthat expose credentials to the browser. - Server Action Hardening flags insecure
allowedOriginsand excessivebodySizeLimitsettings. - Dangerous Flag Detection catches experimental or risky settings like
dangerouslyAllowLocalIPandproductionBrowserSourceMaps.
How it works
- Provide the local path to your Next.js project directory.
- The agent runs a local-only scan that parses your config files as text without executing them.
- Review the generated
scan-report.mdcontaining a prioritized list of fixes and a 0-100 security score. - View the
scan-date.pngscorecard for a high-level visual summary of your project's risk level.
Frameworks & tools
Works with Next.js projects using next.config.js, .mjs, .cjs, or .ts. It also scans .env and .env.local files.
Why this beats prompting it yourself
Manual prompts often miss the nuance of how Next.js merges environment variables or the specific security implications of experimental flags. This skill uses a structured 10-point scoring system to ensure no critical configuration category is overlooked.
Use cases
- Auditing a project before a production release to Vercel or AWS.
- Reviewing a
next.config.jscopied from a tutorial or generated by an LLM. - Verifying that
NEXT_PUBLIC_variables are not leaking backend secrets. - Generating a security scorecard for client handovers or internal PR reviews.
Known limitations
Does not audit live deployments, Dockerfiles, or third-party package vulnerabilities. Files over 2MB and node_modules are ignored.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for LLM Ops.
Audits local config files only. Does not scan live URLs, Docker/CI configs, or npm dependencies for CVEs. Files over 2MB are skipped.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 3 days ago
- Software
Python 3Pillow