-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Security] Added login throttling feature #38204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
730a56d
to
586894b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really nice :).
Due to the architecture, I understand why there is config needed under framework
and security
. However, could we avoid this? From a user's perspective, I think:
I need login throttling!
And I would expect that I can enable that easily in security.yaml. Could we allow the user to create a "rate limiter" inline in the security config? If we need to, we could make it less configurable (and if you need a more configurable limiter, then you could define it properly under framework and reference that limiter from here).
...ymfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/LoginThrottlingFactory.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Security/Core/Exception/SessionLockedException.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Security/Http/EventListener/LoginThrottlingListener.php
Show resolved
Hide resolved
src/Symfony/Component/Security/Http/EventListener/LoginThrottlingListener.php
Outdated
Show resolved
Hide resolved
df93b39
to
477ab43
Compare
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
Outdated
Show resolved
Hide resolved
477ab43
to
a039c10
Compare
This PR is now ready to merge imho. Based on suggestions from @weaverryan, the SecurityBundle now configures a "default" limiter for login throttling. A user can override this by configuring the |
a039c10
to
e8981b2
Compare
src/Symfony/Component/Security/Http/EventListener/LoginThrottlingListener.php
Outdated
Show resolved
Hide resolved
e8981b2
to
c75533c
Compare
src/Symfony/Component/Security/Http/Tests/EventListener/LoginThrottlingListenerTest.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
Show resolved
Hide resolved
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
Outdated
Show resolved
Hide resolved
c75533c
to
94340c1
Compare
94340c1
to
afdd805
Compare
Thank you @wouterj. |
…ver) This PR was merged into the 5.x branch. Discussion ---------- [Bug] Fix RateLimiter framework configuration | Q | A | ------------- | --- | Branch? | 5.x for features <!-- see below --> | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | - <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT | Doc PR | - Small mistake in the rate limiter configuration, instead of unsetting the `storage_service` option the never existing `storage` option was unset, resulting into an application error when trying to use a Limiter in your application. The exception was: ``` Uncaught PHP Exception: The option "storage_service" does not exist. Defined options are: "id", "interval", "limit", "rate", "strategy"." ``` This was introduced in #38204, so a highlight for @wouterj to check this :) Commits ------- b360320 [Bug] Fix RateLimiter framework configuration
This "recreates" #37444 based on the RateLimiter component from #37546
(commits are included in this branch atm).Login throttling can be enabled on any user-based authenticator (thanks to the
UserBadge
) with this configuration: