fix(federation): 🐛 Make an empty allowed_ip list for bridge correctly allow any IP

This commit is contained in:
Jesse Wierzbinski 2024-11-24 16:54:24 +01:00
parent b55237cdc8
commit 259fba17a7
No known key found for this signature in database

View file

@ -167,6 +167,10 @@ export class InboxProcessor {
}; };
} }
if (config.federation.bridge.allowed_ips.length === 0) {
return true;
}
if (!this.requestIp) { if (!this.requestIp) {
return { return {
message: "The request IP address could not be determined.", message: "The request IP address could not be determined.",
@ -174,13 +178,11 @@ export class InboxProcessor {
}; };
} }
if (config.federation.bridge.allowed_ips.length > 0) {
for (const ip of config.federation.bridge.allowed_ips) { for (const ip of config.federation.bridge.allowed_ips) {
if (matches(ip, this.requestIp.address)) { if (matches(ip, this.requestIp.address)) {
return true; return true;
} }
} }
}
return { return {
message: "The request is not from a trusted bridge IP address.", message: "The request is not from a trusted bridge IP address.",