MCPcopy Create free account
hub / github.com/boringstack-xyz/boringstack / buildKeyGenerator

Function buildKeyGenerator

apps/api/src/config/security/security.ts:87–97  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

85};
86
87const buildKeyGenerator = (): Generator | undefined => {
88 if (!env.TRUST_PROXY) {
89 return undefined;
90 }
91
92 return (request, server) =>
93 extractTrustedClientIp({
94 forwardedFor: request.headers.get("x-forwarded-for"),
95 socketAddress: server?.requestIP(request)?.address,
96 });
97};
98
99/**
100 * Per-IP rate limit. Storage is in-memory by default and Valkey-backed

Callers 2

buildRateLimitFunction · 0.85
buildAuthRateLimitFunction · 0.85

Calls 2

extractTrustedClientIpFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected