| Posted by: WUICTeam - Tuesday, November 17, 2026 9:01:40 AM |
|---|
| [b]Question[/b] Our load test logs in hundreds of different users from a single machine, and after a while [c]MetaService.login[/c] starts answering HTTP 429 [c]errors.auth.login_rate_limited[/c]. How do we get past it without weakening the protection for real users? [b]Answer[/b] Add the test machine's IP to [c]loginRateLimitExemptIps[/c] in [c]AppSettings[/c]. An exempt IP is treated like loopback: its attempts are never limited and never counted. [b]Why it happens[/b] [c]MetaService.login[/c] checks the limits before it verifies credentials or captcha. There are two: [list] [*][b]Per user[/b]: always on, not configurable. 5 wrong passwords in 5 minutes on the same username lock that user for 1 minute; a successful login resets the counter. [*][b]Per IP[/b]: [c]loginRateLimitPerIpPerMinute[/c] (since 1.7.16). It counts every attempt, successful or not, and once exceeded the IP is locked for 1 minute. The default is [c]0[/c], which means off; a non-numeric or negative value also means off. [/list] The 429 response carries [c]retryAfterSeconds[/c] but deliberately does not say which limit was hit, so it does not reveal whether a username exists. If you never set the per-IP key, the per-user limit is the one you are hitting (for example a test that reuses one account with a wrong password). If you did set it, hundreds of logins from one IP will trip it. [b]The fix[/b] [code] { "AppSettings": { "loginRateLimitPerIpPerMinute": "30", "loginRateLimitExemptIps": "10.0.2.2, 192.168.1.50" } } [/code] [list] [*]Entries are comma-separated and matched exactly, no ranges. The IPv4-mapped form [c]::ffff:10.0.2.2[/c] is equivalent to [c]10.0.2.2[/c]. [*]A VirtualBox guest in NAT sees the host as [c]10.0.2.2[/c]. [*]Both keys are read at every login, so no restart is needed if your configuration reloads by itself; otherwise recycle the application pool. [*]Keep the per-IP limit on for installations exposed to the internet: it is the only defense against credential stuffing (many usernames from one IP). Exempt only the machines you control. [/list] [url=https://wuic-framework.com/docs/autenticazione-autorizzazioni]Documentation: Authentication & Authorizations[/url] |