| @@ -26,9 +26,9 @@ | ||
| 26 | 26 | * |
| 27 | 27 | * @var bool |
| 28 | 28 | * @defender_property |
| 29 | 29 | */ |
| 30 | - public $enabled = false; | |
| 30 | + public bool $enabled = false; | |
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | 33 | * How many 404 error happen before we lock out the IP. |
| 34 | 34 | * |
| @@ -130,12 +130,12 @@ | ||
| 130 | 130 | */ |
| 131 | 131 | public function get_default_values(): array { |
| 132 | 132 | return array( |
| 133 | 133 | 'message' => esc_html__( |
| 134 | - 'You have been locked out due to too many attempts to access a file that doesn`t exist.', | |
| 134 | + 'You have been locked out due to too many 404 requests.', | |
| 135 | 135 | 'defender-security' |
| 136 | 136 | ), |
| 137 | - 'whitelist' => ".css\n.js\n.map", | |
| 137 | + 'whitelist' => ".css\n.js\n.map\n/cdn-cgi/challenge-platform/", | |
| 138 | 138 | ); |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | /** |
| @@ -158,9 +158,16 @@ | ||
| 158 | 158 | * @return array |
| 159 | 159 | */ |
| 160 | 160 | public function get_lockout_list( $type = 'blocklist' ): array { |
| 161 | 161 | $data = ( 'blocklist' === $type ) ? $this->blacklist : $this->whitelist; |
| 162 | - $arr = is_array( $data ) ? $data : array_filter( explode( PHP_EOL, $data ) ); | |
| 162 | + $arr = is_array( $data ) | |
| 163 | + ? $data | |
| 164 | + : array_filter( | |
| 165 | + explode( PHP_EOL, $data ), | |
| 166 | + function ( $line ) { | |
| 167 | + return strlen( trim( $line ) ) > 0; | |
| 168 | + } | |
| 169 | + ); | |
| 163 | 170 | $arr = array_map( 'trim', $arr ); |
| 164 | 171 | $arr = array_map( 'strtolower', $arr ); |
| 165 | 172 | |
| 166 | 173 | return $arr; |