diff options
author | Maxence Lange <maxence@artificial-owl.com> | 2025-07-21 12:03:15 -0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-07-21 12:03:15 -0100 |
commit | 30fb9e3c5a91d8509f2c0c3299b51dd09069b45b (patch) | |
tree | df27ce289ecc9716c44590fd2091e2a687c3b6db | |
parent | 4954fbc3bda58c387ce53d4f0707d3d880cd1c4e (diff) | |
parent | 484491e7cc61a17b115b66b0cb2535ccf9f850b7 (diff) | |
download | nextcloud-server-30fb9e3c5a91d8509f2c0c3299b51dd09069b45b.tar.gz nextcloud-server-30fb9e3c5a91d8509f2c0c3299b51dd09069b45b.zip |
Merge pull request #54007 from nextcloud/fix/noid/no-lazy-loading-on-isBypassListed
fix(bruteforce): limit appconfig lazy loading
-rw-r--r-- | lib/private/Security/Ip/BruteforceAllowList.php | 5 | ||||
-rw-r--r-- | tests/lib/Security/Ip/BruteforceAllowListTest.php | 4 |
2 files changed, 3 insertions, 6 deletions
diff --git a/lib/private/Security/Ip/BruteforceAllowList.php b/lib/private/Security/Ip/BruteforceAllowList.php index cc4f0ceebe5..fb837690a7b 100644 --- a/lib/private/Security/Ip/BruteforceAllowList.php +++ b/lib/private/Security/Ip/BruteforceAllowList.php @@ -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); diff --git a/tests/lib/Security/Ip/BruteforceAllowListTest.php b/tests/lib/Security/Ip/BruteforceAllowListTest.php index 0cffc128d64..1454b779c1b 100644 --- a/tests/lib/Security/Ip/BruteforceAllowListTest.php +++ b/tests/lib/Security/Ip/BruteforceAllowListTest.php @@ -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') |