test: export + unit-test resolveTrustProxy (#61) #105
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
PR #101 (commit
52159135, closes #61) addedresolveTrustProxy()— apps/server/src/main.ts:22 — the fix against X-Forwarded-For spoofing (safe defaultloopback, linklocal, uniquelocalinstead of trust-all).Gap: untested and not exported, so it cannot be tested as-is. A regression (e.g. parsing
falseas the string/int fallback, or losing the safe default →true) would silently re-open the XFF spoofing hole the /mcp + share-AI per-IP limiters depend on.Needed: export
resolveTrustProxy(or move to a small helper module) and unit-test each branch:''/undefined →'loopback, linklocal, uniquelocal';'true'→ true;'false'→ false;'2'→ 2;'10.0.0.0/8'→ passthrough; non-numeric/-1→ passthrough string.Found in code review of PR #101.