Skip to main content
InterviewHubPRO
Section Overview
Q28

Question 28 of 50

Part 3: Advanced Internals, Performance & Production (Senior / Staff)

56%
Nuxt & Universal SSR (50 Qs)•Part 3: Advanced Internals, Performance & Production (Senior / Staff)

How do you prevent Server-Side Request Forgery (SSRF) in Nuxt Nitro routes?

senior LevelFormsPerformanceSSR & Hydration

In Simple Words: When a Nitro server route fetches external URLs based on user input (e.g. generating link previews, webhooks), attackers can pass internal private IP addresses (http://169.254.169.254 or http://localhost:5432) to steal cloud credentials or query local databases.

Defense Strategies:

  1. URL Whitelisting: Strict protocol check (https: only) and allowlist of trusted external hostnames.
  2. DNS Resolution & Private IP Blacklisting: Resolve the DNS first and block private subnet CIDRs (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 127.0.0.1/8).
  3. Disable Redirects: Prevent the HTTP client from following redirects to private internal subnets.