Skip to content

Commit 202ffe5

Browse files
committed
Merge branch '5.2' into 5.x
* 5.2: [Security] Make Login Rate Limiter also case insensitive for non-ascii user identifiers only load Sfjs if it is not present
2 parents 120fc17 + 5c56326 commit 202ffe5

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

RateLimiter/DefaultLoginRateLimiter.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,12 @@ public function __construct(RateLimiterFactory $globalFactory, RateLimiterFactor
3737

3838
protected function getLimiters(Request $request): array
3939
{
40+
$username = $request->attributes->get(Security::LAST_USERNAME);
41+
$username = preg_match('//u', $username) ? mb_strtolower($username, 'UTF-8') : strtolower($username);
42+
4043
return [
4144
$this->globalFactory->create($request->getClientIp()),
42-
$this->localFactory->create(strtolower($request->attributes->get(Security::LAST_USERNAME)).'-'.$request->getClientIp()),
45+
$this->localFactory->create($username.'-'.$request->getClientIp()),
4346
];
4447
}
4548
}

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"symfony/security-core": "^5.3",
2222
"symfony/http-foundation": "^5.3",
2323
"symfony/http-kernel": "^5.3",
24+
"symfony/polyfill-mbstring": "~1.0",
2425
"symfony/polyfill-php80": "^1.15",
2526
"symfony/property-access": "^4.4|^5.0"
2627
},

0 commit comments

Comments
 (0)