diff --git a/CHANGELOG.md b/CHANGELOG.md index 910ded6..c3438c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Upcoming... +* inclusive terminology: BC! please replace ip_whitelist/ip_blacklist to ip_allowlist/ip_denylist in your configuration.php * fonts update * catch/fix NavigationDuplicated errors diff --git a/backend/Services/Security/Security.php b/backend/Services/Security/Security.php index 4c0bc2c..1b4bdd5 100644 --- a/backend/Services/Security/Security.php +++ b/backend/Services/Security/Security.php @@ -48,9 +48,11 @@ class Security implements Service } } - if (! empty($config['ip_whitelist'])) { + if (! empty($config['ip_whitelist'])) $config['ip_allowlist'] = $config['ip_whitelist']; // deprecated, compatibility + + if (! empty($config['ip_allowlist'])) { $pass = false; - foreach ($config['ip_whitelist'] as $ip) { + foreach ($config['ip_allowlist'] as $ip) { if ($this->request->getClientIp() == $ip) { $pass = true; } @@ -62,9 +64,11 @@ class Security implements Service } } - if (! empty($config['ip_blacklist'])) { + if (! empty($config['ip_blacklist'])) $config['ip_denylist'] = $config['ip_blacklist']; // deprecated, compatibility + + if (! empty($config['ip_denylist'])) { $pass = true; - foreach ($config['ip_blacklist'] as $ip) { + foreach ($config['ip_denylist'] as $ip) { if ($this->request->getClientIp() == $ip) { $pass = false; } diff --git a/configuration_sample.php b/configuration_sample.php index a9c7d01..b5fd656 100644 --- a/configuration_sample.php +++ b/configuration_sample.php @@ -63,8 +63,8 @@ return [ 'handler' => '\Filegator\Services\Security\Security', 'config' => [ 'csrf_protection' => true, - 'ip_whitelist' => [], - 'ip_blacklist' => [], + 'ip_allowlist' => [], + 'ip_denylist' => [], ], ], 'Filegator\Services\View\ViewInterface' => [ diff --git a/docs/configuration/security.md b/docs/configuration/security.md index bafbd76..695a5b5 100644 --- a/docs/configuration/security.md +++ b/docs/configuration/security.md @@ -7,16 +7,16 @@ currentMenu: security Simple security service is included in the script by default. This service provides: - Basic session-based [CSRF](https://en.wikipedia.org/wiki/Cross-site_request_forgery) protection -- IP whitelisting -- IP blacklisting +- IP allow list +- IP deny list ``` 'Filegator\Services\Security\Security' => [ 'handler' => '\Filegator\Services\Security\Security', 'config' => [ 'csrf_protection' => true, - 'ip_whitelist' => [], - 'ip_blacklist' => [ + 'ip_allowlist' => [], + 'ip_denylist' => [ '172.16.1.2', '172.16.3.4', ], @@ -24,4 +24,4 @@ Simple security service is included in the script by default. This service provi ], ``` -If you set `ip_whitelist` then only users coming from listed IP addresses will be able to use the script. +If you set `ip_allowlist` then only users coming from listed IP addresses will be able to use the script.