Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIDeepSeekDeepSeekMuseMuse+22 more

    Next.js Config Security Audit

    by CashonlyTian

    1

    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

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned
    Next.js Config Security Audit

    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

    CheckScoreStatusFinding
    Security Headers0/15FAILNo headers() defined; missing CSP and HSTS.
    Public Secrets0/15FAILNEXT_PUBLIC_STRIPE_SECRET detected in .env.local.
    Image Remote Patterns5/10WARNWildcard hostname: '*' detected in remotePatterns.
    Server Actions10/10PASSOrigins restricted to internal domains.
    Build Checks10/10PASSTypeScript and ESLint errors block builds.
    Fingerprinting0/5FAILpoweredByHeader is not set to false.
    Strict Mode5/5PASSreactStrictMode: true is enabled.
    Experimental Flags10/10PASSNo dangerous experimental flags found.
    Production Exposure10/10PASSSource maps and compression configured correctly.
    Rewrites/Redirects15/15PASSNo 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

    Generated

    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 remotePatterns or wildcards that allow unauthorized image processing.
    • Secret Leak Detection scans NEXT_PUBLIC_ variables for sensitive keywords like API_KEY or SECRET that expose credentials to the browser.
    • Server Action Hardening flags insecure allowedOrigins and excessive bodySizeLimit settings.
    • Dangerous Flag Detection catches experimental or risky settings like dangerouslyAllowLocalIP and productionBrowserSourceMaps.

    How it works

    1. Provide the local path to your Next.js project directory.
    2. The agent runs a local-only scan that parses your config files as text without executing them.
    3. Review the generated scan-report.md containing a prioritized list of fixes and a 0-100 security score.
    4. View the scan-date.png scorecard 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.js copied 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. 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. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 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

    Permissions

    Terminal / Shell
    Read Files
    Write Files
    Listed3 days ago

    What's inside

    Frequently Asked Questions

    The skill scans for 'NEXT_PUBLIC_' prefixes on sensitive keywords like 'API_KEY' or 'SECRET,' which incorrectly signals Next.js to expose those values to the client-side browser bundle. It also identifies overly broad image 'remotePatterns' that could allow attackers to use your server as an open proxy for third-party images.

    No, the agent performs a local-only scan that parses your configuration files as text without executing the code. This ensures your environment variables and secrets are never sent to an external server or run in a live environment.

    You receive the complete AI agent skill logic, a structured 10-point scoring framework, and templates for the Markdown security report and visual scorecard. It includes everything needed to integrate the audit into your existing development workflow or PR review process.

    This skill focuses specifically on Next.js framework configurations and environment variables. It does not scan third-party npm package vulnerabilities (like 'npm audit') or live network traffic, making it a specialized tool for hardening your application's architecture before deployment.

    New in LLM Ops