1.8 KiB
1.8 KiB
A10: Server-Side Request Forgery (SSRF)
Last updated: March 1, 2026
Findings addressed
- Production
APP_ORIGINpreviously enforced HTTPS but did not explicitly block localhost/private-network targets. - SSRF posture needed explicit verification that API runtime code does not introduce generic outbound HTTP clients for user-influenced targets.
Fixes implemented
- Hardened production
APP_ORIGINvalidation in env parsing:
- Requires valid URL format.
- Rejects localhost/private-network hosts:
localhost,127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,169.254.0.0/16,::1,0.0.0.0,.local.
- Added dedicated A10 verification tests:
- Rejects private/loopback
APP_ORIGINin production mode. - Asserts API server source (
api/src/server.ts) does not use generic outbound HTTP request clients (fetch,axios,http.request,https.request).
Files changed
api/src/env.tsapi/tests/server-side-request-forgery.test.tsapi/vitest.security.config.ts
Verification
Command:
cd api
npx vitest run -c vitest.security.config.ts tests/server-side-request-forgery.test.ts
Verified output:
- Test Files:
1 passed (1) - Tests:
3 passed (3)
Dedicated A10 checks in server-side-request-forgery.test.ts:
- Asserts production env parsing rejects multiple private/localhost
APP_ORIGINvariants. - Asserts production env parsing accepts public HTTPS
APP_ORIGIN. - Asserts API source code has no generic outbound HTTP client usage (
fetch,axios,http.request,https.request) outside test scripts.
Residual notes
- Current API architecture has minimal outbound HTTP surface (primarily SMTP transport).
- If future features add URL fetch/proxy/webhook integrations, enforce strict destination allowlists and network egress controls at implementation time.