diff options
author | Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com> | 2024-04-17 11:18:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-17 11:18:21 +0200 |
commit | c4370b625b1d24f8646a7cd87e07d138068efbdb (patch) | |
tree | 965c7be68e34501ba5f595a5abdbd1ae591f5943 /apps | |
parent | 66abfb43222ca1363b1e9d7f057ad7a33f3b2090 (diff) | |
parent | 3203db81603d1025ec7237ffc026fffcab5d682c (diff) | |
download | nextcloud-server-c4370b625b1d24f8646a7cd87e07d138068efbdb.tar.gz nextcloud-server-c4370b625b1d24f8646a7cd87e07d138068efbdb.zip |
Merge pull request #44495 from nextcloud/backport/44483/stable28
Diffstat (limited to 'apps')
-rw-r--r-- | apps/settings/lib/SetupChecks/ForwardedForHeaders.php | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/apps/settings/lib/SetupChecks/ForwardedForHeaders.php b/apps/settings/lib/SetupChecks/ForwardedForHeaders.php index daf84e265af..98252c31247 100644 --- a/apps/settings/lib/SetupChecks/ForwardedForHeaders.php +++ b/apps/settings/lib/SetupChecks/ForwardedForHeaders.php @@ -59,6 +59,16 @@ class ForwardedForHeaders implements ISetupCheck { return SetupResult::error($this->l10n->t('Your "trusted_proxies" setting is not correctly set, it should be an array.')); } + foreach ($trustedProxies as $proxy) { + $addressParts = explode('/', $proxy, 2); + if (filter_var($addressParts[0], FILTER_VALIDATE_IP) === false || !ctype_digit($addressParts[1] ?? '24')) { + return SetupResult::error( + $this->l10n->t('Your "trusted_proxies" setting is not correctly set, it should be an array of IP addresses - optionally with range in CIDR notation.'), + $this->urlGenerator->linkToDocs('admin-reverse-proxy'), + ); + } + } + if (($remoteAddress === '') && ($detectedRemoteAddress === '')) { if (\OC::$CLI) { /* We were called from CLI */ |