Skip to content
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

feat(ratelimit): Add Attributes support to rate limit middleware #37864

Merged
merged 1 commit into from
Apr 24, 2023

Conversation

nickvergessen
Copy link
Member

@nickvergessen nickvergessen commented Apr 21, 2023

Summary

Previously (and still supported)

	/**
	 * @UserRateThrottle(limit=20, period=200)
	 * @AnonRateThrottle(limit=10, period=100)
	 */
	public function testMethodWithAnnotation() {

New syntax

	#[UserRateLimit(limit: 20, period: 200)]
	#[AnonRateLimit(limit: 10, period: 100)]
	public function testMethodWithAttribute() {

Checklist

@nickvergessen nickvergessen added enhancement 3. to review Waiting for reviews security technical debt pending documentation This pull request needs an associated documentation update labels Apr 21, 2023
@nickvergessen nickvergessen added this to the Nextcloud 27 milestone Apr 21, 2023
@nickvergessen nickvergessen self-assigned this Apr 21, 2023
@nickvergessen nickvergessen force-pushed the feat/noid/ratelimit-with-attributes branch 2 times, most recently from b81973e to ba785fe Compare April 21, 2023 13:45
Copy link
Contributor

@kesselb kesselb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍

@ChristophWurst
Copy link
Member

ChristophWurst commented Apr 24, 2023

Previously (and still supported)

I would prefer to deprecate the old system right away so we can move everyone to attribute in the next few years and drop the legacy system as soon as possible.

The same was done with 26 and @UseSession https://docs.nextcloud.com/server/latest/developer_manual/app_publishing_maintenance/app_upgrade_guide/upgrade_to_26.html#migration-from-phpdoc-annotations-to-native-php-attributes

@nickvergessen
Copy link
Member Author

nickvergessen commented Apr 24, 2023

I would prefer to deprecate the old system right away so we can move everyone to attribute in the next few years and drop the legacy system as soon as possible.

Yeah that was my plan. The problem is I didn't find a way (without totally spaming out of control on debug) to notify devs about the deprecation. So yeah a section in the "Changes for 27" will be added for BruteForceProtection and RateLimit later on (when the doc PRs are merged and can be linked to).

Signed-off-by: Joas Schilling <coding@schilljs.com>
@nickvergessen nickvergessen force-pushed the feat/noid/ratelimit-with-attributes branch from 6647d77 to 89c3c31 Compare April 24, 2023 10:25
@nickvergessen nickvergessen merged commit 0f0be52 into master Apr 24, 2023
@nickvergessen nickvergessen deleted the feat/noid/ratelimit-with-attributes branch April 24, 2023 11:55
@nickvergessen nickvergessen removed the pending documentation This pull request needs an associated documentation update label May 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants