Skip to content

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

Merged
nickvergessen merged 1 commit into
masterfrom
feat/noid/ratelimit-with-attributes
Apr 24, 2023
Merged

feat(ratelimit): Add Attributes support to rate limit middleware#37864
nickvergessen merged 1 commit into
masterfrom
feat/noid/ratelimit-with-attributes

Conversation

@nickvergessen

@nickvergessen nickvergessen commented Apr 21, 2023

Copy link
Copy Markdown
Member

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
Comment thread lib/public/AppFramework/Http/Attribute/ARateLimit.php Fixed
@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

@kesselb kesselb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice 👍

Comment thread lib/public/AppFramework/Http/Attribute/ARateLimit.php Outdated
@ChristophWurst

ChristophWurst commented Apr 24, 2023

Copy link
Copy Markdown
Member

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

nickvergessen commented Apr 24, 2023

Copy link
Copy Markdown
Member Author

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
Comment thread lib/public/AppFramework/Http/Attribute/ARateLimit.php
@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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants