fix(bruteforce): limit appconfig lazy loading

Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
This commit is contained in:
Maxence Lange
2025-07-18 23:53:18 -01:00
parent 20b908cf3f
commit 484491e7cc
2 changed files with 3 additions and 6 deletions

View File

@ -36,10 +36,7 @@ class BruteforceAllowList {
return false;
}
$keys = $this->appConfig->getKeys('bruteForce');
$keys = array_filter($keys, static fn ($key): bool => str_starts_with($key, 'whitelist_'));
foreach ($keys as $key) {
foreach ($this->appConfig->searchKeys('bruteForce', 'whitelist_') as $key) {
$rangeString = $this->appConfig->getValueString('bruteForce', $key);
try {
$range = $this->factory->rangeFromString($rangeString);

View File

@ -138,8 +138,8 @@ class BruteforceAllowListTest extends TestCase {
array $allowList,
bool $isAllowListed,
): void {
$this->appConfig->method('getKeys')
->with($this->equalTo('bruteForce'))
$this->appConfig->method('searchKeys')
->with($this->equalTo('bruteForce'), $this->equalTo('whitelist_'))
->willReturn(array_keys($allowList));
$this->appConfig->method('getValueString')