mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 22:04:30 +00:00
fix(gateway): trim trusted proxy entries before matching
This commit is contained in:
@@ -210,12 +210,16 @@ export function isTrustedProxyAddress(ip: string | undefined, trustedProxies?: s
|
||||
}
|
||||
|
||||
return trustedProxies.some((proxy) => {
|
||||
const candidate = proxy.trim();
|
||||
if (!candidate) {
|
||||
return false;
|
||||
}
|
||||
// Handle CIDR notation
|
||||
if (proxy.includes("/")) {
|
||||
return ipMatchesCIDR(normalized, proxy);
|
||||
if (candidate.includes("/")) {
|
||||
return ipMatchesCIDR(normalized, candidate);
|
||||
}
|
||||
// Exact IP match
|
||||
return normalizeIp(proxy) === normalized;
|
||||
return normalizeIp(candidate) === normalized;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user