Skip to content

Commit

Permalink
Merge pull request #8693 from nextcloud/backport/8686/stable2.2
Browse files Browse the repository at this point in the history
[stable2.2] fix(proxy): Add image proxy rate limit
  • Loading branch information
ChristophWurst authored Aug 10, 2023
2 parents 3b19f12 + 89507cf commit 6db4c07
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/Controller/ProxyController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
use Exception;
use OCA\Mail\Http\ProxyDownloadResponse;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\Attribute\UserRateLimit;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\Http\Client\IClientService;
use OCP\IRequest;
Expand Down Expand Up @@ -93,6 +94,7 @@ public function redirect(string $src): TemplateResponse {
/**
* @NoAdminRequired
* @NoCSRFRequired
* @UserRateThrottle(limit=50, period=60)
*
* @param string $src
*
Expand All @@ -102,6 +104,7 @@ public function redirect(string $src): TemplateResponse {
*
* @return ProxyDownloadResponse
*/
#[UserRateLimit(limit: 50, period: 60)]
public function proxy(string $src): ProxyDownloadResponse {
// close the session to allow parallel downloads
$this->session->close();
Expand Down
5 changes: 5 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
<directory name="lib/Vendor" />
</extraFiles>
<issueHandlers>
<UndefinedAttributeClass>
<errorLevel type="info">
<referencedClass name="OCP\AppFramework\Http\Attribute\UserRateLimit" />
</errorLevel>
</UndefinedAttributeClass>
<UndefinedClass>
<errorLevel type="suppress">
<referencedClass name="Doctrine\DBAL\Platforms\MySQLPlatform" />
Expand Down

0 comments on commit 6db4c07

Please sign in to comment.