trustProxy was unconditionally true, so req.ip came from a client-forgeable X-Forwarded-For and the per-IP throttles (share-AI, /mcp brute-force) were spoofable. Make it env-configurable (TRUST_PROXY) with a safe default that trusts XFF only from loopback/private proxies, documented in .env.example. NOTE: this changes the default from trust-all; deployments whose proxy is on a public IP must set TRUST_PROXY (caveat documented). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
5.7 KiB
5.7 KiB