mirror of
https://github.com/nextcloud/server.git
synced 2025-07-20 16:42:04 +00:00
fix(bruteforce): limit appconfig lazy loading
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
This commit is contained in:
@ -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);
|
||||
|
@ -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')
|
||||
|
Reference in New Issue
Block a user