Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix(bruteforce): limit appconfig lazy loading
Signed-off-by: Maxence Lange <[email protected]>
  • Loading branch information
ArtificialOwl committed Jul 20, 2025
commit 484491e7cc61a17b115b66b0cb2535ccf9f850b7
5 changes: 1 addition & 4 deletions lib/private/Security/Ip/BruteforceAllowList.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ public function isBypassListed(string $ip): bool {
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);
Expand Down
4 changes: 2 additions & 2 deletions tests/lib/Security/Ip/BruteforceAllowListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ public function testIsBypassListed(
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')
Expand Down
Loading