Back to content
    CybersecurityDeveloperTechnical security guide

    Architectural Defense Against SSRF and DoS Risks in Server Actions

    A practical security architecture for Next.js Server Actions covering authentication, authorization, validation, outbound allowlists, rate limits and resource budgets.

    Published: July 23, 2026Updated: July 23, 2026InoviqLab
    Validation, network isolation and rate limiting controls against SSRF and DoS risks in Server Actions architecture.
    Audience
    Developer
    Content type
    Technical security guide
    Source verification date
    2026-07-22
    Verified version or policy
    Next.js Server Actions security documentation and related CVE advisories
    This article contains time-sensitive technical information; version and policy details should be rechecked before implementation.
    Server ActionsNext.jsSSRFDoSOWASPSecurity Architecture

    Short answer

    Next.js Server Actions and React Server Components allow client applications to invoke asynchronous server-side functions seamlessly. However, if a Server Action accepts arbitrary URL parameters to perform server-side `fetch` operations or processes heavy data queries without rate limiting, it creates **Server-Side Request Forgery (SSRF)** and **Denial of Service (DoS)** vulnerabilities.

    Architectural Defense Layers:

    Input Schema Sanitization (Zod Validation) + Outbound HTTP Domain Whitelisting + Rate Limiting & Middleware Request Throttling + Isolated VPC & Network Access Controls =

    Hardened Server Action Architecture

    Defense Matrix:

    Threat VectorVulnerability MechanismArchitectural Countermeasure
    Outbound SSRFAction fetches arbitrary internal IPs (e.g. `169.254.169.254`)Restrict outbound fetch to explicit external domain whitelists
    Application DoSUn-throttled action invocations saturate server resourcesImplement rate limiting (Redis token bucket) on public action routes
    Un-sanitized SQLRaw input passed directly to database ORM queriesUse parameterized queries and ORM data validation

    1. Hardening Server-Side Fetch Endpoints

    import { z } from 'zod';
    
    const AllowedDomains = ['api.stripe.com', 'api.github.com'];
    
    export async function fetchExternalData(targetUrlString: string) {
      'use server';
    
      const parsedUrl = new URL(targetUrlString);
    
      if (!AllowedDomains.includes(parsedUrl.hostname)) {
        throw new Error('Forbidden target domain for server-side request.');
      }
    
      return fetch(parsedUrl.toString());
    }

    Architectural Defense Checklist

    • [ ] Whitelist outbound hostnames for server-side HTTP requests
    • [ ] Implement rate limiting on sensitive Server Action endpoints
    • [ ] Block server-side requests targeting internal IP addresses (`127.0.0.1`, `169.254.169.254`)

    Sources

    • OWASP — Server-Side Request Forgery (SSRF) Prevention Cheat Sheet
    • NIST SP 800-95 — Guide to Secure Web Services Architecture

    Share