CodeZettaInterview Hub

Node.js · Security · Junior · Scenario

How do you prevent SSRF in a Node URL-fetching feature?

Short Interview Answer

Allowlist schemes/hosts, block link-local/metadata IPs, resolve DNS carefully, and don't follow redirects blindly.

Detailed Explanation

Cloud metadata endpoints (169.254.169.254) are classic targets. Parse URLs correctly — don't blacklist naively.

Did you know this answer?