Inclusive terminology

This commit is contained in:
Milos Stojanovic
2020-07-15 09:37:59 +02:00
parent 9b4d967c28
commit fdb596a2fc
4 changed files with 16 additions and 11 deletions

View File

@@ -2,6 +2,7 @@
## Upcoming... ## Upcoming...
* inclusive terminology: BC! please replace ip_whitelist/ip_blacklist to ip_allowlist/ip_denylist in your configuration.php
* fonts update * fonts update
* catch/fix NavigationDuplicated errors * catch/fix NavigationDuplicated errors

View File

@@ -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; $pass = false;
foreach ($config['ip_whitelist'] as $ip) { foreach ($config['ip_allowlist'] as $ip) {
if ($this->request->getClientIp() == $ip) { if ($this->request->getClientIp() == $ip) {
$pass = true; $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; $pass = true;
foreach ($config['ip_blacklist'] as $ip) { foreach ($config['ip_denylist'] as $ip) {
if ($this->request->getClientIp() == $ip) { if ($this->request->getClientIp() == $ip) {
$pass = false; $pass = false;
} }

View File

@@ -63,8 +63,8 @@ return [
'handler' => '\Filegator\Services\Security\Security', 'handler' => '\Filegator\Services\Security\Security',
'config' => [ 'config' => [
'csrf_protection' => true, 'csrf_protection' => true,
'ip_whitelist' => [], 'ip_allowlist' => [],
'ip_blacklist' => [], 'ip_denylist' => [],
], ],
], ],
'Filegator\Services\View\ViewInterface' => [ 'Filegator\Services\View\ViewInterface' => [

View File

@@ -7,16 +7,16 @@ currentMenu: security
Simple security service is included in the script by default. This service provides: 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 - Basic session-based [CSRF](https://en.wikipedia.org/wiki/Cross-site_request_forgery) protection
- IP whitelisting - IP allow list
- IP blacklisting - IP deny list
``` ```
'Filegator\Services\Security\Security' => [ 'Filegator\Services\Security\Security' => [
'handler' => '\Filegator\Services\Security\Security', 'handler' => '\Filegator\Services\Security\Security',
'config' => [ 'config' => [
'csrf_protection' => true, 'csrf_protection' => true,
'ip_whitelist' => [], 'ip_allowlist' => [],
'ip_blacklist' => [ 'ip_denylist' => [
'172.16.1.2', '172.16.1.2',
'172.16.3.4', '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.