Merge pull request #42794 from nextcloud/fix/invalid-trusted-proxies

fix(Request): Catch exceptions in `isTrustedProxy`
pull/43185/head
Ferdinand Thiessen 4 months ago committed by GitHub
commit 85978593fe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -573,7 +573,14 @@ class Request implements \ArrayAccess, \Countable, IRequest {
* @return boolean true if $remoteAddress matches any entry in $trustedProxies, false otherwise
*/
protected function isTrustedProxy($trustedProxies, $remoteAddress) {
return IpUtils::checkIp($remoteAddress, $trustedProxies);
try {
return IpUtils::checkIp($remoteAddress, $trustedProxies);
} catch (\Throwable) {
// We can not log to our log here as the logger is using `getRemoteAddress` which uses the function, so we would have a cyclic dependency
// Reaching this line means `trustedProxies` is in invalid format.
error_log('Nextcloud trustedProxies has malformed entries');
return false;
}
}
/**

Loading…
Cancel
Save