mirror of
https://github.com/nextcloud/server.git
synced 2026-03-10 10:21:38 -04:00
Merge pull request #43192 from nextcloud/backport/42794/stable28
[stable28] fix(Request): Catch exceptions in `isTrustedProxy`
This commit is contained in:
commit
6bdee0564e
1 changed files with 8 additions and 1 deletions
|
|
@ -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…
Reference in a new issue