Skip to content

Commit

Permalink
fix(files_sharing): rate limit share creation 10 times per 10 minutes
Browse files Browse the repository at this point in the history
Signed-off-by: skjnldsv <[email protected]>
  • Loading branch information
skjnldsv committed Feb 19, 2025
1 parent ff86bac commit 70d0d8d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion apps/files_sharing/lib/Controller/ShareAPIController.php
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,7 @@ public function deleteShare(string $id): DataResponse {
* 200: Share created
*/
#[NoAdminRequired]
#[UserRateLimit(limit: 10, duration: 600)]

Check failure on line 560 in apps/files_sharing/lib/Controller/ShareAPIController.php

View workflow job for this annotation

GitHub Actions / static-code-analysis

InvalidNamedArgument

apps/files_sharing/lib/Controller/ShareAPIController.php:560:29: InvalidNamedArgument: Parameter $duration does not exist on function OCP\AppFramework\Http\Attribute\UserRateLimit::__construct (see https://psalm.dev/238)
public function createShare(
?string $path = null,
?int $permissions = null,
Expand Down Expand Up @@ -2146,7 +2147,7 @@ private function checkInheritedAttributes(IShare $share): void {
* 200: The email notification was sent successfully
*/
#[NoAdminRequired]
#[UserRateLimit(limit: 5, period: 120)]
#[UserRateLimit(limit: 10, period: 600)]
public function sendShareEmail(string $id, $password = ''): DataResponse {
try {
$share = $this->getShareById($id);
Expand Down

0 comments on commit 70d0d8d

Please sign in to comment.