SSRF Protection & Cloud Metadata IP Blocking in API Gateways
Any gateway that accepts caller-supplied URLs—especially scraping and enrichment routers—is a prime target for Server-Side Request Forgery against cloud metadata services and internal hosts. FuelRouter enforces a hard pre-dispatch SSRF deny-list across schemes, hostnames, and IPv4/IPv6 CIDRs.
FuelRouter SSRF Deny-List Policy (Security Redline #4)
| Validation Dimension | Blocked Rules / Values | Permitted Exception | Rejection Response |
|---|---|---|---|
| URL Schemes | file://, ftp://, gopher://, javascript:, data: | http:// and https:// only | HTTP 422 ssrf_blocked ($0) |
| IPv4 Private & Loopback | 127.0.0.0/8, 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 | Configured 127.0.0.1:18793 vault bridge | HTTP 422 ssrf_blocked ($0) |
| Cloud Metadata Link-Local | 169.254.0.0/16, 169.254.169.254, metadata.google.internal | None (unconditionally blocked) | HTTP 422 ssrf_blocked ($0) |
| IPv6 Private & Loopback | ::1/128, fc00::/7, fe80::/10 | None | HTTP 422 ssrf_blocked ($0) |
| Internal Hostnames | localhost, 0.0.0.0, metadata, *.local, *.internal, *.localhost | Explicit test-mode mock flag only | HTTP 422 ssrf_blocked ($0) |
Fail-Closed Pre-Dispatch URL Inspection
FuelRouter validates caller-provided URLs during input normalization—before cache lookup, before quota deduction, and before opening any outbound socket. Both literal IP addresses and blocked suffixes (.local, .internal, .localhost, .localdomain) are rejected instantaneously.
Because SSRF rejection returns HTTP 422 with charged_micros: 0, attackers cannot use malformed URL probes to drain a tenant's prepaid wallet or trip upstream circuit breakers.
Strict Sandbox Separation for Local Vault & Test Mode
The only loopback origin permitted in production is the explicitly configured Register-Anything Vault bridge (http://127.0.0.1:18793), which is never reachable through caller-supplied scraping URLs.
Local mock-upstream test servers require an explicit opt-in flag (allow_local_test_upstreams=True) restricted strictly to automated test suites.
Verify SSRF Guard Rejects Cloud Metadata Endpoint with $0 Charge
curl -i -X POST "https://fuelrouter.fastmesh.dev/v1/router/dispatch" \
-H "Content-Type: application/json" \
-d '{
"pool_id": "clean_scrape_extract",
"tenant_id": "security_audit",
"inputs": {"url": "http://169.254.169.254/latest/meta-data/"}
}'
# Expected: HTTP 422, {"ok": false, "error_code": "ssrf_blocked", "charged_micros": 0, "billed_usd": 0.0}
SSRF Hardening Verification Checklist
- Block 169.254.169.254 and metadata.google.internal across all URL-accepting pools.
- Reject non-HTTP schemes (file://, gopher://, ftp://, data:, javascript:) before parser normalization.
- Verify IPv6 loopback (::1) and unique-local (fc00::/7) ranges are blocked alongside IPv4 RFC-1918 subnets.
- Confirm SSRF rejections never trigger upstream network requests and strictly bill $0.00.
Frequently Asked Technical Questions
Can a caller reach the local 127.0.0.1:18793 vault proxy by submitting it as a scrape URL?
No. Caller-supplied URLs are evaluated strictly against the SSRF deny-list; 127.0.0.0/8 is blocked for all caller inputs.
Does an SSRF-blocked request affect upstream circuit breaker failure counters?
No. SSRF validation runs pre-dispatch and never touches upstream circuit state or quotas.
Are IPv6 link-local addresses blocked?
Yes. ::1/128, fc00::/7, and fe80::/10 are explicitly denied.
Live Try-Now Console & Machine Discovery
Test failover routing, dry-run quotes, and circuit breaker metrics on the live gateway or connect via JSON-RPC 2.0 MCP.
Related FuelRouter Architecture Guides
- SQLite WAL Thread-Safe Quota Ledger & Concurrency Architecture — SQLite WAL thread-safe API quota ledger concurrency
- $0 Exhaustion Billing Guarantee & Redacted Backoff Traces — zero dollar API exhaustion billing and redacted failover trace
- EWMA Dynamic Health Scoring Formula for Upstream Routing — EWMA dynamic health score API upstream routing formula