Skip to content

Commit 484491e

Browse files
committed
fix(bruteforce): limit appconfig lazy loading
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
1 parent 20b908c commit 484491e

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

lib/private/Security/Ip/BruteforceAllowList.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,7 @@ public function isBypassListed(string $ip): bool {
3636
return false;
3737
}
3838

39-
$keys = $this->appConfig->getKeys('bruteForce');
40-
$keys = array_filter($keys, static fn ($key): bool => str_starts_with($key, 'whitelist_'));
41-
42-
foreach ($keys as $key) {
39+
foreach ($this->appConfig->searchKeys('bruteForce', 'whitelist_') as $key) {
4340
$rangeString = $this->appConfig->getValueString('bruteForce', $key);
4441
try {
4542
$range = $this->factory->rangeFromString($rangeString);

tests/lib/Security/Ip/BruteforceAllowListTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ public function testIsBypassListed(
138138
array $allowList,
139139
bool $isAllowListed,
140140
): void {
141-
$this->appConfig->method('getKeys')
142-
->with($this->equalTo('bruteForce'))
141+
$this->appConfig->method('searchKeys')
142+
->with($this->equalTo('bruteForce'), $this->equalTo('whitelist_'))
143143
->willReturn(array_keys($allowList));
144144

145145
$this->appConfig->method('getValueString')

0 commit comments

Comments
 (0)